prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Remove the taints with key 'cpu-type' from the 'backup-node-14' node | Command:
```bash
kubectl taint nodes backup-node-14 cpu-type-
```
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: json|ya... |
Remove the label 'role' from the pod 'chat-app' | Command:
```bash
kubectl label pods chat-app role-
```
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": "If tru... |
Create a cron job named "cron-task" using the "amazonlinux" image, scheduled to run every minute | Command:
```bash
kubectl create cronjob cron-task --image=amazonlinux --schedule="*/1 * * * *" -- /bin/bash -c "echo 'Hello
```
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 a service for the ruby deployment, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose deployment ruby --port=80 --target-port=8000
```
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 specified por... |
Create a new config map named 'app-config-dev' with the following keys instead of file basenames on disk: 'properties' from the file '/path/to/profiles/file1.txt' and 'key1' from the file '/path/to/data/file2.txt' | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/data/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... |
Rename a context in your kubeconfig file | Command:
```bash
kubectl config rename-context testing-context user-b-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 al... |
Set environment variables for a deployment by importing specific keys from a config map. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/env-vars deployment/frontend-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... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config-dev deployment/monitoring-stack-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 variab... |
replace the pod based on the JSON passed into stdin by reading the contents of the docker-registry.yaml file and using it as input for the kubectl replace command. | Command:
```bash
cat docker-registry.yaml | kubectl replace -f -
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl repl... |
Create a NodePort service named web-app-nodeport that listens on port 3306 and forwards traffic to port 9091. | Command:
```bash
kubectl create service nodeport web-app-nodeport --tcp=3306:9091
```
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", "default": "",... |
Forward traffic from port 3000 on all addresses to port 5000 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 3000: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 ... |
Create a job named "backup" using the "busybox" image. | Command:
```bash
kubectl create job backup --image=busybox
```
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: json|yaml|n... |
create a service for a replicated alpine using replica set, serving on port 9092 and connecting to the containers on port 909000 | Command:
```bash
kubectl expose rs alpine --port=9092 --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 specified port.... |
Set up autoscaling for the "cdn" replication controller to have a minimum of 1 pod, a maximum of 3 pods, and target CPU utilization at 50%. | Command:
```bash
kubectl autoscale rc cdn --max=3 --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 the... |
Create a service for the python deployment, which serves on port 8080 and connects to the containers on port 808800. | Command:
```bash
kubectl expose deployment python --port=8080 --target-port=808800
```
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... |
Forward local port 8080 to port 5432 in the pod named api-service-pod | Command:
```bash
kubectl port-forward pod/api-service-pod 8080: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 pod will be selected au... |
Get information about replication controllers, services, and pods named "web", "api-service-rc", and "security-service-pod". | Command:
```bash
kubectl get rc/web service/api-service-rc pods/security-service-pod
```
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 n... |
Forward all traffic on port 8088 from all addresses to port 8088 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 8088: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 ... |
Create a new config map named app-name-config using the files file1.txt and file2.txt | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/configurations/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 ... |
Forward local port 8000 to pod port 8000 | Command:
```bash
kubectl port-forward pod/analytics-pod 8000:8000
```
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 auto... |
Retrieve the snapshot logs from the container named email-service-pod-1 in the deployment authentication-service-deployment. | Command:
```bash
kubectl logs deployment/authentication-service-deployment -c email-service-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]`
Helpf... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-secrets deployment/gateway-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 definition... |
Create an ingress named 'ingdefault' with a default backend | Command:
```bash
kubectl create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="testing.com/*=svc:8181,tls=secret1"
```
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": "... |
Create an autoscaler for the replication controller "security" | Command:
```bash
kubectl autoscale rc security --max=3 --cpu-percent=81
```
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... |
partially update the node using a strategic merge patch from the contents of "containerd-config.toml" file and set the "replicas" field to 3. | Command:
```bash
kubectl patch -f containerd-config.toml -p '{"spec":{"replicas":3}'
```
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]`
Helpf... |
Import the 'my-example-key' key from the 'app-settings' config map to the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-settings 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 def... |
Create a cluster role named "bar" with the verb "use" and the non-resource URL "/exec/*" specified. | Command:
```bash
kubectl create clusterrole "bar" --verb=use --non-resource-url=/exec/*
```
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]`
Helpful flags:
"flag": "--output", "short": "-... |
Get output from running the 'docker run -it ubuntu' command in the quantum-quark container of the chat-app-pod. | Command:
```bash
kubectl exec chat-app-pod -c quantum-quark -- docker run -it ubuntu
```
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. I... |
Get the output from running the 'ash' command inside the 'time-machine' container in the 'proxy-service-pod' pod. | Command:
```bash
kubectl exec proxy-service-pod -c time-machine -- ash
```
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... |
Create a deployment named "gateway" that uses the "ubuntu" image and exposes port 7000. | Command:
```bash
kubectl create deployment gateway --image=ubuntu --port=7000
```
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: ... |
update the annotation 'app-version' of the pod 'backend' to '2.5.1', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods backend 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 includ... |
Forward port 8888 on all addresses to port 8088 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8888: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 po... |
Open a raw terminal mode and connect to the rocket-ranger container in the payment-gateway-pod. | Command:
```bash
kubectl attach payment-gateway-pod -c rocket-ranger -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 name. ... |
Get the output of the 'gem --version' command from the rocket-ranger container in the vpn-service-pod | Command:
```bash
kubectl exec vpn-service-pod -c rocket-ranger -- gem --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 omi... |
Get the output of the 'python --version' command in the lunar-launcher container from the payment-gateway-pod | Command:
```bash
kubectl exec payment-gateway-pod -c lunar-launcher -- 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... |
Update the deployment named 'debian' by setting the container image for 'busybox' to 'busybox' and the container image for 'debian' to 'debian:11.0'. | Command:
```bash
kubectl set image deployment/debian busybox=busybox debian=debian:11.0
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicase... |
Open and edit the "api-service" service using the nano editor | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/api-service
```
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 variables, or... |
Create a service for the replication controller specified in the "ruby-controller.yaml" file | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8088 --target-port=844300
```
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 s... |
Create a new ExternalName service named 'external-caching-service' and map it to the external DNS name 'document-company.com' | Command:
```bash
kubectl create service externalname external-caching-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 reference... |
Create a pod disruption budget named 'ingress-controller-pdb' that will select all pods with the 'tier=frontend' label and require at least four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=tier=frontend --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-avail... |
Partially update a resource using a strategic merge patch | Command:
```bash
kubectl patch -f cni.conf -p '{"stringData":{"password":"new-password"}'
```
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]`
... |
Start a hazelcast pod and expose port 3001 to the container | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=3001
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:... |
Copy a file from a local directory to a remote pod inside a namespace. | Command:
```bash
kubectl cp :/tmp/foo kubeapps/web-app-pod-1::/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 the kubectl.k... |
Create a copy of the vpn-service-pod with the command of nano-bot using the kubectl debug command | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=my-custom-dbg --container=nano-bot -- 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... |
Create a job named "monitoring-job" with the image "mongo" and the command "mongod" | Command:
```bash
kubectl create job monitoring-job --image=mongo -- mongod
```
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... |
Delete the pods and services with the names "auth" and "email" | Command:
```bash
kubectl delete pod,service auth email
```
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 selector.
Some... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/jwt-secret deployment/web-app-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 templa... |
Update the cluster field in the 'staging-context' context to 'prod-cluster' | Command:
```bash
kubectl config set contexts.staging-context.cluster prod-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you ... |
Create a new ClusterIP service named messaging-service-clusterip | Command:
```bash
kubectl create service clusterip messaging-service-clusterip --tcp=9090:5432
```
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 service for the replicated alpine pod, which serves on port 8084 and connects to the pods on port 543200 | Command:
```bash
kubectl expose rc alpine --port=8084 --target-port=543200
```
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 specified port.... |
Listen on port 9090 locally and forward the traffic to port 8080 in the analytics-pod pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 9090: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 will be selected auto... |
Forward traffic from local port 5432 to port 5000 in the pod "cdn-service-pod" | Command:
```bash
kubectl port-forward pod/cdn-service-pod 5432: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 au... |
Import the CONFIG_FILE_PATH key from the config map 'env-vars' into the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/env-vars deployment/web-app-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 ... |
Create an ingress named 'app-gateway-ingress' that routes requests from foo.com/module to the service named 'svc1' on port 3000 | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="foo.com/module=svc1:3000,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... |
Update the pod named 'media-stream' with the annotation 'scaling-policy' and the value 'auto-horizontal-scaling', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods media-stream scaling-policy='auto-horizontal-scaling'
```
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 lar... |
Rename the context 'cloud-context' to 'client-1-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context cloud-context client-1-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 al... |
Copy the kubeconfig file from a remote pod to a local directory. | Command:
```bash
kubectl cp openfaas/auth-service-pod-11:~/.config/kube :/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 th... |
Add a taint with key 'environment' on nodes having label 'myLabel' and value 'dev-node-4' with the effect of 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l myLabel environment=dev-node-4: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 a role named "default_role" with the ability to create pods with the names "auth-proxy" and "content-delivery" | Command:
```bash
kubectl create role default_role --verb=create --resource=pods --resource-name=auth-proxy --resource-name=content-delivery
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=se... |
Apply a taint with the key 'workload' on nodes that have the label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops workload=app-node-6: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": "Out... |
Start the postgres pod with custom command and arguments | Command:
```bash
kubectl run nginx --image=postgres --command -- <cmd> <arg1> ... <argN>
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Help... |
Forward local port 8000 to the targetPort of the "https" service port in a selected pod, using the command `kubectl port-forward service/gateway-service 8000:https` | Command:
```bash
kubectl port-forward service/gateway-service 8000: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 select... |
Remove all the taints with key 'disktype' from the node 'worker-node-3' | Command:
```bash
kubectl taint nodes worker-node-3 disktype-
```
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: json|yam... |
Taint nodes with label 'feature=feature-xyz' with the taint 'datacenter=monitoring-node-15:PreferNoSchedule' | Command:
```bash
kubectl taint node -l feature=feature-xyz datacenter=monitoring-node-15: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":... |
Copy a directory from a remote pod to a local directory. | Command:
```bash
kubectl cp prometheus/image-resizer-pod-20:/tmp/foo_dir /tmp/bar_dir
```
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, us... |
Attach to the cyber-sleuth container in the email-service-pod and get the output. | Command:
```bash
kubectl attach email-service-pod -c cyber-sleuth
```
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 name. If omitte... |
List deployments in YAML output format for the "backup-apps" API group in the "custom-version" version. | Command:
```bash
kubectl get deployments.custom-version.backup-apps -o yaml
```
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... |
Create a service for the replication controller specified in the 'hazelcast-controller.yaml' file | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=8083 --target-port=330600
```
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 ... |
Auto scale the "web" replication controller with a target CPU utilization of 60%, ensuring the number of pods remains between 1 and 6. | Command:
```bash
kubectl autoscale rc web --max=6 --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 uses the... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-settings 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 definit... |
Output modified deployment in YAML without altering the object on the server | Command:
```bash
kubectl set env deployment/analytics-platform-deployment SECRET_KEY=your-secret-key -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 o... |
Create a service for a replicated Ubuntu container, serving on port 80 and connecting to the containers on port 8000 | Command:
```bash
kubectl expose rs ubuntu --port=8088 --target-port=818100
```
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 specified port.... |
Taint the nodes with the label 'instance=app-instance-1' by adding a taint with the key 'zone' and value 'node-2:PreferNoSchedule'. | Command:
```bash
kubectl taint node -l instance=app-instance-1 zone=node-2: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": ... |
Configure auto scaling for replication controller "security" with the target CPU utilization at 50% and the number of pods between 1 and 3. | Command:
```bash
kubectl autoscale rc security --max=3 --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 use... |
Update the last-applied-configuration of a resource to match the contents of a file | Command:
```bash
kubectl apply set-last-applied -f setup.yaml --create-annotation=true
```
What it does:
Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run, without updat... |
Get the output from running the 'php --version' command in the astro-container from the database-pod pod. | Command:
```bash
kubectl exec database-pod -c astro-container -- php --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 omit... |
Set the CPU limits of the MySQL container in the deployment named "mysql" to 3 and the memory limits to 2Gi. | Command:
```bash
kubectl set resources deployment mysql -c=nginx --limits=cpu=3,memory=2Gi
```
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 requested, but may burst up to its ... |
Execute the 'go' command in the 'code-explorer' container of the 'payment-gateway-pod' pod and display the output. | Command:
```bash
kubectl exec payment-gateway-pod -c code-explorer -- go
```
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... |
Remove the label named 'bar' from the 'database' pod | Command:
```bash
kubectl label pods database app-
```
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": "If true... |
Create a service for a replication controller specified in "node-controller.yaml" that serves on port 8089 and connects to the containers on port 844300. | Command:
```bash
kubectl expose -f node-controller.yaml --port=8089 --target-port=844300
```
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 s... |
Set the CPU limits of the Hazelcast container in the deployment to "1" and the memory limits to "128Mi" | Command:
```bash
kubectl set resources deployment hazelcast -c=nginx --limits=cpu=1,memory=128Mi
```
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 requested, but may burst up t... |
Create a new config map named api-config with specified keys from file paths | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/options/file1.txt --from-file=key2=/path/to/settings/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 co... |
Forward port 8081 of the pod "web-app-pod" to port 8000 on your local machine | Command:
```bash
kubectl port-forward pod/web-app-pod 8000:8081
```
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... |
Update the label of the pod 'cdn' by adding the label 'env' with the value 'production' | Command:
```bash
kubectl label pods cdn env=production
```
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": "If... |
Open the 'payment-processor-deployment' deployment in YAML format for editing, and when you finish, save the modified configuration in its annotation. | Command:
```bash
kubectl edit deployment/payment-processor-deployment -o yaml --save-config
```
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 EDITO... |
Get the deployment configuration with modified environment variables in YAML format without making any changes on the server. | Command:
```bash
kubectl set env deployment/api-server-deployment SMTP_HOST=smtp.example.com -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 mo... |
Add a taint with key 'disktype' and value 'prod-node-5:PreferNoSchedule' on nodes having the label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth disktype=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": "O... |
Create a NodePort service named log-aggregator-nodeport that maps port 3001 on the host to port 9091 on the pod | Command:
```bash
kubectl create service nodeport log-aggregator-nodeport --tcp=3001:9091
```
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", "defaul... |
Update the environment variable SMTP_USERNAME in the payment-processor-deployment | Command:
```bash
kubectl set env deployment/payment-processor-deployment SMTP_USERNAME=your-username
```
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 mo... |
Copy the local file '/tmp/foo_dir' to the remote pod 'backend-pod-13' in the namespace 'kube-public' and place it at '/tmp/bar_dir' | Command:
```bash
kubectl cp /tmp/foo_dir kube-public/backend-pod-13:/tmp/bar_dir
```
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... |
Create a config map named db-config using specified keys from files | Command:
```bash
kubectl create configmap db-config --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/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 a co... |
Forward local port 8888 to port 8088 in the analytics-pod | Command:
```bash
kubectl port-forward pod/analytics-pod 8888: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 auto... |
Create a pod disruption budget named logging-pdb that will select all pods with the project=my-project label and ensure that at least four of them are always available. | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=project=my-project --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N... |
Execute the 'go run hello.go' command from pod chat-app-pod and display the output | Command:
```bash
kubectl exec chat-app-pod -- go run hello.go
```
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 kube... |
Create a service for a CentOS deployment, serving on port 80, and connecting to containers on port 8000. | Command:
```bash
kubectl expose deployment centos --port=9092 --target-port=888800
```
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... |
Add a taint to nodes that have the label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack datacenter=storage-node-13: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 output from the 'mycontainer' container in the 'e-commerce-pod' pod | Command:
```bash
kubectl attach e-commerce-pod -c mycontainer
```
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 name. If omitted, u... |
Add a taint with key 'app' and no value to a node named 'worker-node-3' | Command:
```bash
kubectl taint nodes worker-node-3 app:NoSchedule
```
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: jso... |
Create a pod disruption budget named 'statefulset-pdb' that selects all pods with the 'role=worker' label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=role=worker --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [-... |
Start streaming the logs of the nebula-navigator container in the cdn-service-pod pod. | Command:
```bash
kubectl logs -f -c nebula-navigator cdn-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": "--containe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.