prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new config map named app-config-dev from a file containing key-value pairs. | Command:
```bash
kubectl create configmap app-config-dev --from-file=path/to/properties
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the base... |
Update the pod named 'backend' with the label 'role' and set its value to 'frontend' | Command:
```bash
kubectl label pods backend role=frontend
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": ... |
Create a deployment for monitoring using the specified image and additional command arguments | Command:
```bash
kubectl create deployment monitoring --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch --version
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short... |
Get interactive access to the stardust-shuttle container inside the security-service-pod and send input and output through the terminal. | Command:
```bash
kubectl attach security-service-pod -c stardust-shuttle -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container na... |
Create a new namespace named kube-node-lease | Command:
```bash
kubectl create namespace kube-node-lease
```
What it does:
Create a namespace with the specified name.
Syntax:
`kubectl create namespace NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-template|g... |
Create a cluster role binding called 'cluster-admin' and grant the 'cluster-admin' cluster role to the users 'developer3', 'k8s-admin', and the group 'qa-engineers' | Command:
```bash
kubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=developer3 --user=k8s-admin --group=qa-engineers
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--gr... |
Remove the pods and services with the names "auth" and "log-aggregator" | Command:
```bash
kubectl delete pod,service auth log-aggregator
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selec... |
Copy a local file to a remote pod in a specific container | Command:
```bash
kubectl cp :/tmp/foo file-server-pod-14:/tmp/bar_dir -c load-balancer
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Create a copy of the mypod pod with a debug container, using the debian image, and changing the container images for api to api:v2 and proxy to nginx:1.21. | Command:
```bash
kubectl debug mypod -it --copy-to=dgb-img --image=debian --set-image=api=api:v2,proxy=nginx:1.21
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be us... |
Autoscale the replication controller "frontend" with a target CPU utilization of 60% and a maximum of 5 pods. | Command:
```bash
kubectl autoscale rc frontend --max=5 --cpu-percent=60
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/oauth-secret deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates ... |
Import specific keys from a config map by setting environment variables in a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-config-prod deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Forward traffic from port 5000 on localhost and IP 10.19.21.23 to port 5432 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 5000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a p... |
Scale the deployment named backend-service-replicaset to the current size of 7 replicas | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/backend-service-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --r... |
Embed the certificate authority data for the 'my-k8s-cluster' cluster entry using the command "kubectl config set-cluster my-k8s-cluster --embed-certs --certificate-authority=~/.kube/cloud-cluster/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster my-k8s-cluster --embed-certs --certificate-authority=~/.kube/cloud-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config ... |
Open the "docker-registry" service for editing using the "micro" editor. | Command:
```bash
KUBE_EDITOR="micro" kubectl edit svc/docker-registry
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variable... |
Create a new config map named app-secrets with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-secrets --from-file=conf=/path/to/configs/file1.txt --from-file=data=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a con... |
Execute the 'elasticsearch' command in the first pod of the 'database-deployment' deployment | Command:
```bash
kubectl exec deploy/database-deployment -- elasticsearch
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Import the "config_file_path" key from the "app-config" ConfigMap into the "order-processing-deployment" deployment. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Create a new ExternalName service named external-caching-service with an external name of education-edu.edu | Command:
```bash
kubectl create service externalname external-caching-service --external-name education-edu.edu
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference se... |
Output the modified 'cache-cluster-deployment' deployment in YAML format, without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/cache-cluster-deployment QUEUE_NAME=task-queue -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/global-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Partially update the kubelet-config for a node, using the strategic merge patch specified in kubelet-config.yaml | Command:
```bash
kubectl patch -f kubelet-config.yaml -p '{"data":{"key":"new-value"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Hel... |
Forward local port 9090 to 9090 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 9090:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Forward traffic from local port 9090 to the targetPort of the service's "https" port in a selected pod | Command:
```bash
kubectl port-forward service/email-service 9090:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Apply a taint with the key 'environment' and value 'worker-node-3:PreferNoSchedule' on nodes labeled with 'environment=production'. | Command:
```bash
kubectl taint node -l environment=production environment=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Get the output of the 'elasticsearch --version' command running in the lunar-launcher container of the cdn-service-pod pod. | Command:
```bash
kubectl exec cdn-service-pod -c lunar-launcher -- elasticsearch --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container n... |
Update the annotation of the 'vpn' pod with the key 'owner' and the value 'alice-smith', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite pods vpn owner='alice-smith'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ar... |
List all pods in ps output format | Command:
```bash
kubectl get pods
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in your current... |
View the last-applied-configuration annotations of the nginx deployment in YAML format | Command:
```bash
kubectl apply view-last-applied deployment/nginx
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-applied ... |
Create a new ClusterIP service named monitoring-service-clusterip with the following configuration: map port 8443 on the service to port 8080 on the backend | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=8443:8080
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "... |
Create a copy of the 'e-commerce-pod' pod and add a debug container to it | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=my-custom-dbg --image=debian --set-image=logger=logging-app:debug,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource... |
Forward traffic from port 8088 on all addresses to port 3000 in the 'analytics-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 8088:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Create a new secret named 'database-secret' by copying the keys from the files in the 'path/to/parameters' folder. | Command:
```bash
kubectl create secret generic database-secret --from-file=path/to/parameters
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename o... |
Set the environment variable CONFIG_FILE_PATH in the payment-processor-deployment deployment from the CONFIG_FILE_PATH key in the namespace-config config map. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/namespace-config deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment var... |
Import the DEBUG_MODE key from the app-name-config ConfigMap into the mydeployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-name-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in on... |
Create a service for an alpine deployment that serves on port 8443 and connects to the containers on port 9090. | Command:
```bash
kubectl expose deployment alpine --port=8443 --target-port=909000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specifi... |
Create a job with the command "sleep 3600" running on a CentOS image. | Command:
```bash
kubectl create job backup --image=centos -- sleep 3600
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Copy the local file "/tmp/foo" to the remote pod "kube-proxy/cache-pod-5" in the "default" namespace | Command:
```bash
kubectl cp /tmp/foo kube-proxy/cache-pod-5:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kube... |
Add a taint with key 'disktype' on nodes having label component=proxy | Command:
```bash
kubectl taint node -l component=proxy disktype=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Set the resource request and limits for all containers in the 'centos' deployment to 200m CPU and 512Mi memory limits, and 500m CPU and 256Mi memory requests. | Command:
```bash
kubectl set resources deployment centos --limits=cpu=200m,memory=512Mi --requests=cpu=500m,memory=256Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource reque... |
Create a deployment named wordpress using the ubuntu image and expose port 3000 | Command:
```bash
kubectl create deployment wordpress --image=ubuntu --port=3000
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Create a NodePort service named ingress-controller-nodeport with a mapping from port 6379 on the cluster to port 8084 on the service. | Command:
```bash
kubectl create service nodeport ingress-controller-nodeport --tcp=6379:8084
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "de... |
Forward local ports 8080 and 6000 to ports 8080 and 6000 of the specified pod in the deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8080 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Update the label 'status=unhealthy' for the pod named 'monitoring' only if the pod's resource version is 1. | Command:
```bash
kubectl label pods monitoring status=unhealthy --resource-version=1
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "d... |
Copy the service account directory from a remote pod to a local directory. | Command:
```bash
kubectl cp kube-proxy/web-app-pod-1:/var/run/secrets/kubernetes.io/serviceaccount/ /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "... |
Create a cron job named 'database-maintenance' using the 'golang' image | Command:
```bash
kubectl create cronjob database-maintenance --image=golang --schedule="*/1 * * * *" -- go run hello.go
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "... |
Create an ingress named 'app2-ingress' that forwards requests for 'website.com/input' to the service 'svc1' on port '5001' with the TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress app2-ingress --rule="website.com/input=svc1:5001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Copy the ~/.config/kube local file to /tmp/bar in the remote pod kube-proxy/image-resizer-pod-20 in the specified namespace. | Command:
```bash
kubectl cp ~/.config/kube kube-proxy/image-resizer-pod-20:/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Create a copy of the web-app-pod in an interactive shell with the warp-drive container, and copy it to the debug-image-api, in order to change the command. | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-api --container=warp-drive -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by defaul... |
Port forward the local ports 8080 to 5000 in the pod security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8080 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Create a new secret with keys for each file in a folder | Command:
```bash
kubectl create secret generic tls-certificate-secret --from-file=path/to/properties
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the bas... |
Create a cron job named "email-notifications" with the image "mysql", scheduled to run every minute, executing the command "mysql" | Command:
```bash
kubectl create cronjob email-notifications --image=mysql --schedule="*/1 * * * *" -- mysql
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Set the custom TLS server name to use for the "my-k8s-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=cluster-beta
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifica... |
Get the output of the 'python --version' command from the cyber-sleuth container within the auth-service-pod. | Command:
```bash
kubectl exec auth-service-pod -c cyber-sleuth -- python --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
Run the command "kubectl exec email-service-pod -c cyber-sleuth -- elasticsearch-plugin --list" to get the output from running the 'elasticsearch-plugin --list' command in cyber-sleuth from the pod email-service-pod. | Command:
```bash
kubectl exec email-service-pod -c cyber-sleuth -- elasticsearch-plugin --list
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Contain... |
Create a new secret named api-key-secret with keys for each file in the folder "bar" | Command:
```bash
kubectl create secret generic api-key-secret --from-file=path/to/configs
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of th... |
Import the environment variables from the 'jwt-secret' secret into the 'search-engine-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/jwt-secret deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod ... |
Create a debug container of vpn-service-pod named debug-image-api, using nginx as the image for all containers in the debug container | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-api --set-image=*=nginx
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no r... |
Create a deployment named gateway using the image confluentinc/cp-kafka | Command:
```bash
kubectl create deployment gateway --image=confluentinc/cp-kafka
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One o... |
Execute the command "elasticsearch-plugin --list" in the pod named "chat-app-pod" and display the output. | Command:
```bash
kubectl exec chat-app-pod -- elasticsearch-plugin --list
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Execute the 'mysqld' command inside the 'auth-service-pod' pod and display the output. | Command:
```bash
kubectl exec auth-service-pod -- mysqld
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.k... |
Add a taint with the key 'environment' and the value 'prod-node-5:PreferNoSchedule' on nodes having the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend environment=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Automatically scale the replication controller "backend" by adjusting the number of pods between 1 and 7, targeting a CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc backend --max=7 --cpu-percent=50
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Begin streaming the logs of the cyber-sleuth container in the api-service-pod pod | Command:
```bash
kubectl logs -f -c cyber-sleuth api-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", ... |
Listen on port 8081 locally and forward it to port 8088 in the pod named 'chat-app-pod' | Command:
```bash
kubectl port-forward pod/chat-app-pod 8081:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/docker-registry-secret deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one ... |
Create an ingress resource named 'service-ingress' that will route requests to website.com/module to the 'svc1' service on port 3001 | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/module=svc1:3001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Set the custom TLS server name to "app-cluster" for the "cluster-alpha" cluster entry. | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=app-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate... |
Create a new secret named cert-manager-secret using the data in the path/to/data.env file | Command:
```bash
kubectl create secret generic cert-manager-secret --from-env-file=path/to/data.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the base... |
Retrieve the logs from the container named "media-stream-pod-1" in the deployment "notification-handler-deployment". | Command:
```bash
kubectl logs deployment/notification-handler-deployment -c media-stream-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful ... |
Rename the context 'staging-context' to 'client-2-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context staging-context client-2-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will ... |
Get the output from running the 'nginx -t' command in the 'warp-drive' container of the 'auth-service-pod' pod. | Command:
```bash
kubectl exec auth-service-pod -c warp-drive -- nginx -t
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Create an ingress called 'app-gateway-ingress' that routes requests from site.com/example to svc1:8010 with a TLS secret called "my-cert" | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="site.com/example=svc1:8010,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Update the 'analytics' pod by adding the annotation 'app-version' with the value 2.5.1. | Command:
```bash
kubectl annotate pods analytics app-version=2.5.1
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary ... |
Embed the certificate authority data for the kube-cluster-1 cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-1 --embed-certs --certificate-authority=~/.kube/cloud-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config ... |
Add a taint with key 'hardware' on nodes having label myLabel | Command:
```bash
kubectl taint node -l myLabel hardware=kube-master-9:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Create an ingress resource called 'website-ingress' with a rule that directs requests for testing.com/example to svc1:9091, and use a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/example=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Set the custom TLS server name to "galaxy-cluster" for the "dev-cluster" cluster entry | Command:
```bash
kubectl config set-cluster dev-cluster --tls-server-name=galaxy-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificat... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/monitoring-config deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/db-config deployment/user-management-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Copy the `~/.config/kube` local file to the `/tmp/bar_dir` directory on a remote pod named `admin-dashboard-pod-16` in the `web-app-container` container. | Command:
```bash
kubectl cp ~/.config/kube admin-dashboard-pod-16:/tmp/bar_dir -c web-app-container
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. ... |
Copy the kube config file from your local machine to a specific directory inside a remote pod, specifically in the container named "metrics-exporter". | Command:
```bash
kubectl cp ~/.config/kube file-server-pod-14:/tmp/bar_dir -c metrics-exporter
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/ui-config deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Add the label 'env=staging' to the pod named 'analytics' | Command:
```bash
kubectl label pods analytics env=staging
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": ... |
Create a single ingress called 'app-loadbalancer-ingress' that directs requests from 'website.com/input' to 'svc1:8084' with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/input=svc1:8084,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default"... |
Listen on port 9090 locally, forwarding data to/from port 5000 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 9090 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Return the snapshot logs from the pod named 'security-service-pod' including all containers. | Command:
```bash
kubectl logs security-service-pod --all-containers=true
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--cont... |
Create a new ExternalName service named external-cloud-storage-service | Command:
```bash
kubectl create service externalname external-cloud-storage-service --external-name document-company.com
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to ref... |
Create a new config map named "namespace-config" with the following keys and corresponding file paths: | Command:
```bash
kubectl create configmap namespace-config --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
... |
Add a taint to the 'app-node-6' node with the key 'hardware', value 'gpu', and effect 'NoExecute' | Command:
```bash
kubectl taint nodes app-node-6 hardware=gpu:NoExecute
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Import the 'my-example-key' from the 'app-settings' config map into the environment variables of the 'cache-cluster-deployment' deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-settings deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Execute command inside a pod container and install wget | Command:
```bash
kubectl exec proxy-service-pod -c nebula-navigator -- yum install -y wget
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container n... |
Add a taint with key 'dedicated' on nodes that have the label environment=production | Command:
```bash
kubectl taint node -l environment=production dedicated=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Create a new config map named db-config using specified keys instead of file basenames on the disk. | Command:
```bash
kubectl create configmap db-config --from-file=settings=/path/to/preferences/file1.txt --from-file=key2=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a... |
Create a new secret named email-credentials-secret with keys for each file in folder bar. | Command:
```bash
kubectl create secret generic email-credentials-secret --from-file=path/to/configs
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the base... |
Create a new ClusterIP service named cache-service-clusterip and forward traffic from port 3001 to port 3000 | Command:
```bash
kubectl create service clusterip cache-service-clusterip --tcp=3001:3000
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", ... |
Get the output from running the 'mongo' command inside the pod named mypod. | Command:
```bash
kubectl exec mypod -- mongo
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kubernetes.io... |
Create a new config map named log-config with specified keys sourced from files | Command:
```bash
kubectl create configmap log-config --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/properties/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
Create a cluster role named "foo" with access to specific resource names | Command:
```bash
kubectl create clusterrole foo --verb=use --resource=services --resource-name=auth-service --resource-name=api-server
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.