prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new ClusterIP service named ldap-service-clusterip by mapping port 9092 of the service to port 8000 of the target pods | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=9092:8000
```
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", "... |
Run the 'python' command in the 'cyber-sleuth' container of the 'monitoring-pod' pod and retrieve the output. | Command:
```bash
kubectl exec monitoring-pod -c cyber-sleuth -- python
```
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... |
Import the 'database_url' key from the 'namespace-config' config map and set it as an environment variable in the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/namespace-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... |
Interact with a container in a pod in raw terminal mode | Command:
```bash
kubectl attach proxy-service-pod -c mycontainer -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. If o... |
Forward local ports to a pod's ports | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8888 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... |
Create a new ExternalName service named external-notification-service with the external name "travel-sample.travel" | Command:
```bash
kubectl create service externalname external-notification-service --external-name travel-sample.travel
```
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 refe... |
Partially update a node by applying a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node node-1 -p '{"spec":{"type":"LoadBalancer"}'
```
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]`
Helpful fl... |
Copy the local file /tmp/foo to the remote pod task-processor-pod-17 in the cert-manager namespace, and place it in the /etc/kubernetes directory | Command:
```bash
kubectl cp :/tmp/foo cert-manager/task-processor-pod-17:/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,... |
set the resource limits and requests for all containers in the 'ruby' deployment to cpu=200m and memory=512Mi for limits, and cpu=1 and memory=512Mi for requests. | Command:
```bash
kubectl set resources deployment ruby --limits=cpu=200m,memory=512Mi --requests=cpu=1,memory=512Mi
```
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,... |
Forward traffic from port 8888 on all addresses to port 8000 in the "frontend-pod" pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8888: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... |
Check if you have permission to list the "cache-warming-job" job in the "production" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cache-warming-job -n production
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial U... |
Forward local port 9090 to port 8088 in the pod named chat-app-pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 9090: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... |
Create an ingress called 'public-api-ingress' that directs requests from foo.com/input to svc1:8082 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress public-api-ingress --rule="foo.com/input=svc1:8082,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": "", "usa... |
Forward local port to pod | Command:
```bash
kubectl port-forward pod/web-app-pod 8000 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 automa... |
Update the image of all containers in the daemonset "namespace-2" to "python:3.9.7" | Command:
```bash
kubectl set image daemonset namespace-2 *=python:3.9.7
```
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), replicaset (rs)
Syntax:
... |
Return snapshot logs from container 'security-service-pod-1' of the deployment 'email-server-deployment'. | Command:
```bash
kubectl logs deployment/email-server-deployment -c security-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]`
Helpful flag... |
Update the annotation 'custom-label' of pod 'foo' with the value 'my-custom-value', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods foo custom-label='my-custom-value'
```
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... |
import the redis_host key from the app-config-prod config map into the environment variables of the order-processing-deployment deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config-prod 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 de... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/global-config 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 definitions i... |
Forward port 9090 on all addresses to port 6379 in the pod named 'api-service-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 9090:6379
```
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 w... |
Add taint on nodes with specific label | Command:
```bash
kubectl taint node -l app-type=microservice datacenter=node-1: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": "", "usag... |
Run the 'jenkins-plugin-cli' command in the 'mycontainer' container from the 'cdn-service-pod' pod | Command:
```bash
kubectl exec cdn-service-pod -c mycontainer -- jenkins-plugin-cli
```
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 ... |
Set a custom TLS server name for validation in the edge-cluster cluster entry | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=my-k8s-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] [--certifica... |
Create a copy of the 'payment-gateway-pod' pod and change the command of the 'warp-drive' container | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=dgb-img --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... |
Copy the local file "/tmp/foo" to the remote pod "load-balancer-pod-9" in the "default" namespace, at the location "/tmp/bar" | Command:
```bash
kubectl cp /tmp/foo default/load-balancer-pod-9::/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 kubec... |
Copy the local file `/tmp/foo` to the remote pod `worker-pod-4` in the `kube-dns` namespace and place it in the `/tmp/bar_dir` directory. | Command:
```bash
kubectl cp :/tmp/foo kube-dns/worker-pod-4:/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 kubectl... |
Add a taint with the key 'environment' on nodes that have the label 'customer=acme-corp' | Command:
```bash
kubectl taint node -l customer=acme-corp environment=backup-node-14: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 pod disruption budget named notification-service-pdb that will select all pods with the role=worker label and require at least 9 of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget notification-service-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-avail... |
Create a copy of the 'payment-gateway-pod' with a debug container and a changed container image | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=debug-image-api --image=debian --set-image=cache=redis:alpine,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects ident... |
List deployments in JSON output format for a specific version and API group. | Command:
```bash
kubectl get deployments.dev-2.2.0.api-v2 -o json
```
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 ... |
Create a new ClusterIP service named 'log-service-clusterip' that forwards traffic from port 6379 to port 8089 | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=6379:8089
```
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", "d... |
Forward traffic from local port 9090 to port 8888 in the 'web-app-pod' pod | Command:
```bash
kubectl port-forward pod/web-app-pod 9090:8888
```
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... |
Create an ingress called 'web-ingress' that directs requests to website.com/module to a service named svc1 on port 8080 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress web-ingress --rule="website.com/module=svc1:8080,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... |
Create a deployment named jenkins with the ethereum/client-go image | Command:
```bash
kubectl create deployment jenkins --image=ethereum/client-go
```
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: ... |
Listen on port 8088 locally and forward the traffic to port 8081 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8088: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 aut... |
Listen on your local machine ports 8888 and 6000 and forward data to/from the pod named 'mypod' ports 8080 and 6000 | Command:
```bash
kubectl port-forward pod/mypod 8888 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 automaticall... |
Update the image of all containers in the daemonset 'test' to 'python:3.9.7' | Command:
```bash
kubectl set image daemonset test *=python:3.9.7
```
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), replicaset (rs)
Syntax:
`kubect... |
Switch to the raw terminal mode for the 'lunar-launcher' container in the 'monitoring-pod' pod, and interactively attach stdin and stdout/stderr | Command:
```bash
kubectl attach monitoring-pod -c lunar-launcher -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. If o... |
Open the cache-service service for editing using the Atom editor | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/cache-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, ... |
Get the output from running the 'pip --version' command in the analytics-pod | Command:
```bash
kubectl exec analytics-pod -- pip --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 omitted, use the kubec... |
Forward local port 8088 to port 8000 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8088: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 au... |
Add a taint with the key 'disktype' to nodes that have the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 disktype=backup-node-14: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... |
Add a taint with key 'zone' on nodes having label environment=production | Command:
```bash
kubectl taint node -l environment=production zone=web-node-8: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... |
Copy the contents of the "/var/run/secrets/kubernetes.io/serviceaccount/" directory from the "metrics-exporter-pod-10" pod in the "kubeapps" namespace to the local "/tmp/bar_dir" directory. | Command:
```bash
kubectl cp kubeapps/metrics-exporter-pod-10:/var/run/secrets/kubernetes.io/serviceaccount/ /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": "", "usag... |
Add a taint to the node 'monitoring-node-15' with the key 'datacenter' and no value | Command:
```bash
kubectl taint nodes monitoring-node-15 datacenter: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.... |
Create a new config map named env-vars with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap env-vars --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/options/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 config... |
Create an ingress called 'public-service-ingress' that directs requests from "testing.com/bar" to service "svc1" on port 8080, using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/bar=svc1:8080,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": ""... |
Output the modified deployment in YAML format without making any changes to the object on the server. | Command:
```bash
kubectl set env deployment/web-app-deployment REDIS_HOST=redis-server -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 pod... |
Update the environment variables of the `user-management-deployment` deployment by importing the `redis_host` key from the `app-name-config` config map. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-name-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 def... |
Retrieve the snapshot logs from container "vpn-service-pod-1" of the deployment named "authentication-service-deployment". | Command:
```bash
kubectl logs deployment/authentication-service-deployment -c vpn-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]`
Helpful... |
Create an ingress resource called 'app2-ingress' that directs requests to 'testing.com/bar' to service 'svc1' on port '8443' | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/bar=svc1:8443,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":... |
Update the image of all deployments and replication controllers to 'postgres:13.4' for the container named 'postgres'. | Command:
```bash
kubectl set image deployments,rc postgres=postgres:13.4 --all
```
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), replicaset (rs)
S... |
Copy the local file `~/.config/kube` to the remote pod `web-app-pod-1` in the `istio-system` namespace, and place it in the `/tmp/bar` directory. | Command:
```bash
kubectl cp ~/.config/kube istio-system/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 ... |
Apply the taint with key 'datacenter' and value 'storage-node-13:PreferNoSchedule' on nodes that have the label 'feature=feature-xyz' | Command:
```bash
kubectl taint node -l feature=feature-xyz 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": ""... |
Import the 'smtp_server' key from the 'kube-system-config' config map and set it as environment variable in the 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/kube-system-config 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 definit... |
Add a taint with the key 'environment' and value 'node-1:PreferNoSchedule' on all nodes that have the label 'role=database' | Command:
```bash
kubectl taint node -l role=database environment=node-1: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": "Ou... |
Import specific keys from a config map to an environment variable in a deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/log-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 definition... |
Automatically scale the replication controller "analytics" with the number of pods ranging from 1 to 4, based on the target CPU utilization of 60%. | Command:
```bash
kubectl autoscale rc analytics --max=4 --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 us... |
Create a cluster role named "view" with the ability to execute commands and access the specified non-resource URL "/swagger-ui/*". | Command:
```bash
kubectl create clusterrole "view" --verb=exec --non-resource-url=/swagger-ui/*
```
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", "sh... |
Scale the replica set named 'app-v2-replicaset' to have only 1 replica. | Command:
```bash
kubectl scale --replicas=1 rs/app-v2-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 --resource-version is specified, it is va... |
Copy the local file /tmp/foo_dir to the remote pod named worker-pod-4 in the cert-manager namespace, and save it as /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo_dir cert-manager/worker-pod-4:/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 kube... |
Auto scale the "email" deployment, allowing the number of pods to vary between 2 and 15. | Command:
```bash
kubectl autoscale deployment email --min=2 --max=15
```
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 t... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-name-config deployment/analytics-platform-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 copy of the 'email-service-pod' and change all container images to 'confluentinc/cp-kafka' with the name 'debug-image-web' | Command:
```bash
kubectl debug email-service-pod --copy-to=debug-image-web --set-image=*=confluentinc/cp-kafka
```
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 ... |
Execute the 'go' command in the first pod of the 'logging-service' service using the first container. | Command:
```bash
kubectl exec svc/logging-service -- 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 kubectl.ku... |
Create a cluster role named "custom_role" with the API Group specified for the resource "clusterroles.rbac.authorization.k8s.io" | Command:
```bash
kubectl create clusterrole custom_role --verb=list,create,update --resource=clusterroles.rbac.authorization.k8s.io
```
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]`
He... |
Update the deployment 'database-deployment' by setting a new environment variable called DB_USER with the value of 'username' | Command:
```bash
kubectl set env deployment/database-deployment DB_USER=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 more pod templates (wi... |
Set custom TLS server name for cluster kube-cluster-2 | Command:
```bash
kubectl config set-cluster kube-cluster-2 --tls-server-name=prod-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] [--certifica... |
Update node 'node-1' by adding a taint with key 'special', value 'backup', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes node-1 special=backup: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:... |
Create a deployment named grafana with the mcr.microsoft.com/dotnet/core/runtime image and expose port 8084 | Command:
```bash
kubectl create deployment grafana --image=mcr.microsoft.com/dotnet/core/runtime --port=8084
```
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": "", "u... |
Add a taint with the key 'disktype' on nodes having the label 'release=beta' | Command:
```bash
kubectl taint node -l release=beta 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": "Out... |
Delete the pods and services with the names "chat-app" and "web" | Command:
```bash
kubectl delete pod,service chat-app web
```
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.
So... |
Add a taint with key "workload" and no value to the node "app-node-6" | Command:
```bash
kubectl taint nodes app-node-6 workload: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: j... |
Execute 'psql' command in the first container of the 'backend-service' service's first pod | Command:
```bash
kubectl exec svc/backend-service -- psql
```
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.... |
Create a secret named ldap-credentials-secret with keys for each file in the configurations folder | Command:
```bash
kubectl create secret generic ldap-credentials-secret --from-file=path/to/configurations
```
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 th... |
Forward local ports 8080 and 6000 to ports 8081 and 6000 respectively in a pod selected by the deployment called "api-server-deployment" | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8080 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 b... |
Create a debug container with a copy of vpn-service-pod, replacing all container images with the Ruby image. | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-1 --set-image=*=ruby
```
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 reso... |
Add a taint with the key 'special' on nodes that have the label 'myLabel' with the value 'kube-master-9:PreferNoSchedule'. | Command:
```bash
kubectl taint node -l myLabel special=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": "Outpu... |
Retrieve detailed information about the client-2-context context from your kubeconfig file. | Command:
```bash
kubectl config get-contexts client-2-context
```
What it does:
Display one or many contexts from the kubeconfig file.
Syntax:
`kubectl config get-contexts [(-o|--output=)name)]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: name " |
Set environment variable API_KEY to your-api-key for deployment mydeployment and output the modified deployment in YAML format without making any changes on the server. | Command:
```bash
kubectl set env deployment/mydeployment API_KEY=your-api-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 one or more pod template... |
Execute the 'nginx' command in the first container of the first pod of the 'backend-microservice-deployment' deployment. | Command:
```bash
kubectl exec deploy/backend-microservice-deployment -- nginx
```
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 omitt... |
Create a cluster role named "bar" with specific resource names. | Command:
```bash
kubectl create clusterrole bar --verb=list --resource=configmaps --resource-name=search-elasticsearch --resource-name=message-queue
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Create a cluster role named "reader" with the verb "connect" and the non-resource URL "/attach/*" specified | Command:
```bash
kubectl create clusterrole "reader" --verb=connect --non-resource-url=/attach/*
```
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", "s... |
Create a new config map named app-config-prod using the files in the "configs" folder | Command:
```bash
kubectl create configmap app-config-prod --from-file=path/to/configs
```
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 basena... |
Add a taint to nodes with the label release=beta | Command:
```bash
kubectl taint node -l release=beta datacenter=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": "", "usage":... |
Delete pods and services with the names "backend" and "web" | Command:
```bash
kubectl delete pod,service backend web
```
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.
Som... |
Import the 'MAX_CONNECTIONS' key from the 'namespace-config' config map to the 'api-server-deployment' deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/namespace-config deployment/api-server-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 de... |
Retrieve the replica controller named "web", the service named "proxy-service-rc", and the pod named "web-app-pod" | Command:
```bash
kubectl get rc/web service/proxy-service-rc pods/web-app-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 namespac... |
Create a service for the PHP deployment that listens on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment php --port=8080 --target-port=801000
```
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 ... |
Create a debugger copy of e-commerce-pod with container images set to ethereum/client-go | Command:
```bash
kubectl debug e-commerce-pod --copy-to=my-debugger --set-image=*=ethereum/client-go
```
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... |
Add a taint to the node 'web-node-8' with the key 'app' and no value | Command:
```bash
kubectl taint nodes web-node-8 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: json|y... |
Create a copy of the auth-service-pod and change all container images to mongo | Command:
```bash
kubectl debug auth-service-pod --copy-to=debug-image-web --set-image=*=mongo
```
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 ... |
Create an ingress called 'app-ingress' that directs requests to foo.com/module to a service named 'svc1' on port 9092, and use the TLS secret 'my-cert' for secure communication. | Command:
```bash
kubectl create ingress app-ingress --rule="foo.com/module=svc1:9092,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": "... |
Create a job that runs a command | Command:
```bash
kubectl create job image-build-job --image=amazonlinux -- bash
```
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... |
Enable a new execution authentication plugin for the "developer" entry | Command:
```bash
kubectl config set-credentials developer --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
-... |
Attach to the 'lunar-launcher' container in the 'analytics-pod' pod to get the output. | Command:
```bash
kubectl attach analytics-pod -c lunar-launcher
```
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,... |
Set the custom TLS server name to "e2e" for the "staging-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster staging-cluster --tls-server-name=e2e
```
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-autho... |
Display the modified deployment in YAML format, without actually updating the object on the server. | Command:
```bash
kubectl set env deployment/order-processing-deployment S3_BUCKET=my-s3-bucket -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 ... |
Create a new config map named db-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap db-config --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/path/to/configs/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 creati... |
List deployments in JSON output format, specifically in the "stable-2.0.0" version of the "beta-apps" API group | Command:
```bash
kubectl get deployments.stable-2.0.0.beta-apps -o json
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.