prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a pod disruption budget named payment-gateway-pdb that will select all pods with the project=my-project label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=project=my-project --min-available=1
```
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-ava... |
Import the specific keys "max_connections" from the "global-config" ConfigMap into the "gateway-deployment" deployment. | Command:
```bash
kubectl set env --keys=max_connections --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 definiti... |
Create a cluster role named "default_role" that allows executing the "exec" action on "services" and with specific "ResourceNames" such as "file-storage" and "load-balancer". | Command:
```bash
kubectl create clusterrole default_role --verb=exec --resource=services --resource-name=file-storage --resource-name=load-balancer
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|c... |
Add a taint with key 'disktype' on nodes having the label feature=feature-xyz and assign it the value of testing-node-11:PreferNoSchedule. | Command:
```bash
kubectl taint node -l feature=feature-xyz disktype=testing-node-11: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": "", ... |
List the deployments in the "external-apps" API group, with the version "rc-1.1.0", in JSON output format. | Command:
```bash
kubectl get deployments.rc-1.1.0.external-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... |
Execute the 'python' command inside the pod named gateway-pod and retrieve the output | Command:
```bash
kubectl exec gateway-pod -- 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 the kubectl.kubern... |
Create a pod disruption budget named ingress-controller-pdb that will select all pods with the app=rails label and require at least four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=app=rails --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... |
Execute the 'postgres' command in the first container of the 'database-pod' pod and retrieve the output. | Command:
```bash
kubectl exec database-pod -- postgres
```
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.kub... |
Create a debug copy of the vpn-service-pod by adding a debug container and changing container images | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=debug-image-web --image=debian --set-image=worker=my-custom-worker:1.2.3,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified ... |
Copy the local file "foo" located in "/tmp" to the remote pod "image-resizer-pod-20" in the "/tmp/bar_dir" directory | Command:
```bash
kubectl cp :/tmp/foo image-resizer-pod-20:/tmp/bar_dir -c monitoring-agent
```
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 omitt... |
Create a new ClusterIP service named 'order-service-clusterip' that maps port 8080 to port 8888. | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=8080:8888
```
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", ... |
Begin streaming the logs of the "ruby" container in the "log-aggregator-pod" pod. | Command:
```bash
kubectl logs -f -c ruby log-aggregator-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", "shor... |
delete the pods and services with the names "backend" and "proxy-server" | Command:
```bash
kubectl delete pod,service backend proxy-server
```
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 sele... |
Create a copy of the "email-service-pod" with a debug container and modify container images | Command:
```bash
kubectl debug email-service-pod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and ... |
Create a service for a replicated alpine using replica set, which serves on port 8081 and connects to the containers on port 808900 | Command:
```bash
kubectl expose rs alpine --port=8081 --target-port=808900
```
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.... |
Create a pod disruption budget named worker-pdb that will select all pods with the app=rails label and ensure that at least one of them is available at any given time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=app=rails --min-available=1
```
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 [--dry-ru... |
Update the environment variable DB_PASSWORD in the deployment named 'notification-handler-deployment' | Command:
```bash
kubectl set env deployment/notification-handler-deployment DB_PASSWORD=secretpassword
```
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 secret named docker-registry-secret from the profiles.env file in the specified path. | Command:
```bash
kubectl create secret generic docker-registry-secret --from-env-file=path/to/profiles.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 t... |
Create a new config map named app-config-prod using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-prod --from-file=settings=/path/to/preferences/file1.txt --from-file=key2=/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 cr... |
Add a taint with the key 'workload' on nodes having the label role=database and the value edge-node-10:PreferNoSchedule. | Command:
```bash
kubectl taint node -l role=database workload=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": ... |
Create a deployment using the nginx image named prometheus | Command:
```bash
kubectl create deployment prometheus --image=nginx -- nginx
```
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: j... |
Attach to the first pod of the replica set named "kafka" to get the output | Command:
```bash
kubectl attach rs/kafka
```
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, use the kubectl.kubern... |
Return the snapshot logs from the container named monitoring-pod-1 in the load-balancer-deployment deployment | Command:
```bash
kubectl logs deployment/load-balancer-deployment -c monitoring-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 flags:
"f... |
Create a new pod named 'hazelcast' using the 'golang' image, and configure the pod to expose port 8089. | Command:
```bash
kubectl run hazelcast --image=golang --port=8089
```
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:
"flag": "--f... |
set the resource requests and limits for all containers in a Python deployment | Command:
```bash
kubectl set resources deployment python --limits=cpu=200m,memory=512Mi --requests=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 requeste... |
Create a deployment named 'my-dep' using the 'ubuntu' image and expose port 9091 | Command:
```bash
kubectl create deployment my-dep --image=ubuntu --port=9091
```
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: j... |
Execute the command 'pip --version' in the 'lunar-launcher' container of the 'security-service-pod' pod. | Command:
```bash
kubectl exec security-service-pod -c lunar-launcher -- 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. ... |
Create a debug pod from the frontend-pod with all container images changed to busybox | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-web --set-image=*=busybox
```
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 re... |
Switch to raw terminal mode and attach to the 'time-machine' container in the 'proxy-service-pod' pod, allowing you to send input and receive output from the 'bash' command. | Command:
```bash
kubectl attach proxy-service-pod -c time-machine -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 ... |
Import the keys CONFIG_FILE_PATH from the config map global-config into the deployment named order-processing-deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/global-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 variabl... |
Forward local port 5432 to port 8088 in the analytics-pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 5432: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 role named "default_role" with the ability to delete pods and specific resource names | Command:
```bash
kubectl create role default_role --verb=delete --resource=pods --resource-name=cache-redis --resource-name=app-worker-2
```
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=serve... |
Forward port 5000 from your local machine to the pod's port 5000. | Command:
```bash
kubectl port-forward pod/mypod 5000: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 automaticall... |
Add a taint with the key 'workload' on nodes having the label feature=feature-xyz | Command:
```bash
kubectl taint node -l feature=feature-xyz workload=gpu-node-12: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": "", "usa... |
Set up auto scaling for the 'proxy' replication controller | Command:
```bash
kubectl autoscale rc proxy --max=3 --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 t... |
Listen on port 3000 locally and forward data to/from port 5000 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward pod/analytics-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 be selected auto... |
Retrieve all deployments in the web-apps API group with the version v1.1.1, and display the output in JSON format. | Command:
```bash
kubectl get deployments.v1.1.1.web-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 will o... |
listen on port 8000 locally and forward traffic to port 8888 in the pod named 'cdn-service-pod' | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8000: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 au... |
Create an ingress with multiple hosts and pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:8181" \
--rule="module.com/admin*=svc2:http"
```
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": "--outpu... |
Forward traffic from local port 8088 to the target port of the "https" service in a selected pod named "payment-service" | Command:
```bash
kubectl port-forward service/payment-service 8088: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... |
Forward local port 8081 to port 9090 on a pod, selected by the deployment named "email-server-deployment". | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8081 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... |
Update the 'edge-node-10' node by adding a taint with key 'workload' and value 'high-priority', with effect 'NoSchedule' | Command:
```bash
kubectl taint nodes edge-node-10 workload=high-priority: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 f... |
Set cpu and memory limits for a container in a deployment | Command:
```bash
kubectl set resources deployment alpine -c=nginx --limits=cpu=1,memory=4Gi
```
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... |
Update the annotation of a pod | Command:
```bash
kubectl annotate pods gateway env=staging
```
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 string v... |
Expose a replica set as a service, serving on port 5001 and forwarding traffic to containers on port 8080. | Command:
```bash
kubectl expose rs node --port=5001 --target-port=808400
```
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. A... |
Copy the directory named 'foo_dir' located at '/tmp/foo_dir' from the 'message-broker-pod-15' pod in the 'rook-ceph' namespace to the '/etc/kubernetes' directory on your local machine. | Command:
```bash
kubectl cp rook-ceph/message-broker-pod-15:/tmp/foo_dir /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,... |
Forward local port 5000 to port 8888 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 5000 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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/api-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 one or m... |
Create a job called "cleanup" using the ubuntu image, and run the command "docker run -it ubuntu" inside the job container. | Command:
```bash
kubectl create job cleanup --image=ubuntu -- docker run -it ubuntu
```
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 fo... |
Create a new ExternalName service named external-authentication-service pointing to 'test-site.org' | Command:
```bash
kubectl create service externalname external-authentication-service --external-name test-site.org
```
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... |
Update the image of all containers in the 'prod' daemonset to 'centos:8.4.2105' | Command:
```bash
kubectl set image daemonset prod *=centos:8.4.2105
```
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:
`kub... |
Create a job named scaling-job using the centos image and running the bash command | Command:
```bash
kubectl create job scaling-job --image=centos -- 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. One of:... |
Set the custom TLS server name for the on-prem-cluster cluster entry | Command:
```bash
kubectl config set-cluster on-prem-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... |
Create a copy of the "security-service-pod" pod and change all container images to "wordpress" for debugging purposes | Command:
```bash
kubectl debug security-service-pod --copy-to=debug-image-web --set-image=*=wordpress
```
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... |
Delete a pod specified in the pod.json file | Command:
```bash
cat pod.json | kubectl delete -f -
```
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 re... |
Create a new ClusterIP service with the name "git-service-clusterip" and bind port 3000 of the service to port 8000 of the target. | Command:
```bash
kubectl create service clusterip git-service-clusterip --tcp=3000: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", "d... |
Create a debug copy of the proxy-service-pod by adding a debug container and changing container images | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-app --image=debian --set-image=cache=redis:alpine,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resour... |
Forward traffic from all addresses on port 5000 to port 6379 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 5000: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 po... |
List deployments in the JSON output format for the "rc-1.1.0" version of the "alpha-apps" API group | Command:
```bash
kubectl get deployments.rc-1.1.0.alpha-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 wi... |
Forward port 5432 from all addresses to port 9090 in the frontend-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 5432: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... |
Begin streaming the logs of the "stardust-shuttle" container in the "chat-app-pod" pod | Command:
```bash
kubectl logs -f -c stardust-shuttle chat-app-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",... |
Copy the local file /tmp/foo to the remote pod logging-agent-pod-7 in the container message-broker, and place it in the /etc/kubernetes directory. | Command:
```bash
kubectl cp /tmp/foo logging-agent-pod-7:/etc/kubernetes -c message-broker
```
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 omitte... |
Auto scale the "payment" deployment with a minimum of 7 pods and a maximum of 8 pods. | Command:
```bash
kubectl autoscale deployment payment --min=7 --max=8
```
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 ... |
Remove the label named 'component' from the pod named 'foo' if it exists | Command:
```bash
kubectl label pods foo component-
```
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... |
Forward local port 9090 to port 5000 in the analytics-pod pod | Command:
```bash
kubectl port-forward pod/analytics-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 auto... |
Execute the command 'jenkins-plugin-cli' in the first pod of the 'frontend-deployment' deployment. | Command:
```bash
kubectl exec deploy/frontend-deployment -- 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 omit... |
Listen on port 6379 for all addresses and forward the traffic to port 5432 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 6379: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... |
Edit the last-applied-configuration annotations in the pod.yaml file using JSON format | Command:
```bash
kubectl apply edit-last-applied -f pod.yaml -o json
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the ed... |
Update the cpu limits of the hazelcast container in the deployment named 'hazelcast' to "3" and the memory limits to "512Mi" | Command:
```bash
kubectl set resources deployment hazelcast -c=nginx --limits=cpu=3,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, but may burst up t... |
Embed the certificate authority data for the 'star-cluster' cluster entry by running the command 'kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/dev-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/dev-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 set-... |
Forward local port 8000 to port 6379 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8000: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 will be selected a... |
Configure the auto scaling of a replication controller named "backend" with the target CPU utilization set at 20% and the number of pods ranging from 1 to 3. | Command:
```bash
kubectl autoscale rc backend --max=3 --cpu-percent=20
```
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... |
Set the service account of the deployment "proxy-service-deployment" to "prometheus". | Command:
```bash
kubectl set serviceaccount deployment proxy-service-deployment prometheus
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`k... |
Import the key 'external_api_url' from the config map 'ui-config' into the environment variables of the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env --keys=external_api_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 defin... |
Forward local port 3000 to the target port of the 'https' service port in a pod selected by the 'backend-service' service. | Command:
```bash
kubectl port-forward service/backend-service 3000: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... |
Get output from the lunar-launcher container in the media-stream-pod pod | Command:
```bash
kubectl attach media-stream-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 omitt... |
Display the most recent 12 lines of logs for the pod named proxy-service-pod | Command:
```bash
kubectl logs --tail=12 proxy-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", "short"... |
Create a new config map named monitoring-config using the specified files as key-value pairs | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/settings/file1.txt --from-file=key2=/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 cre... |
Forward port 8888 on localhost and selected IP to port 8888 in the specified pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8888: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 ... |
Forward traffic from local port 5000 to port 5432 on the pod 'log-aggregator-pod' | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 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 pod will be selected... |
Copy the local file "/tmp/foo_dir" to the remote pod "security-scanner-pod-18" in the container "image-resizer", and place it in the directory "/tmp/bar_dir". | Command:
```bash
kubectl cp /tmp/foo_dir security-scanner-pod-18:/tmp/bar_dir -c image-resizer
```
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... |
Create a copy of the backend pod with all container images set to `php` | Command:
```bash
kubectl debug backend-pod --copy-to=my-debugger --set-image=*=php
```
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 resource is... |
Create an ingress with TLS enabled using the default ingress certificate and different path types | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="site.com/=svc:https,tls" \
--rule="website.com/path/subpath*=othersvc:3000"
```
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": "... |
Set the custom TLS server name to "app-cluster" for the cluster entry "on-prem-cluster" | Command:
```bash
kubectl config set-cluster on-prem-cluster --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] [--certifica... |
Remove a label named 'bar' from pod 'cdn' | Command:
```bash
kubectl label pods cdn 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 true, ch... |
Copy /var/run/secrets/kubernetes.io/serviceaccount/ local file to /tmp/bar in the remote pod (auth-service-pod-11) in the namespace (kube-server) | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kube-server/auth-service-pod-11:/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": "... |
Add a taint to a specific node with a given key, value, and effect, replacing the value if a taint with the same key and effect already exists. | Command:
```bash
kubectl taint nodes testing-node-11 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... |
Listen locally on port 6379 and forward the traffic to port 3000 in the 'mypod' pod. | Command:
```bash
kubectl port-forward pod/mypod 6379: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 will be selected automaticall... |
Create a pod disruption budget named 'logging-pdb' that will select all pods with the 'owner=team-1' label and require a minimum of four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=owner=team-1 --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 [--dr... |
Attach and get the output from the "warp-drive" container in the "mypod" pod. | Command:
```bash
kubectl attach mypod -c warp-drive
```
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, use the kub... |
restart the 'staging' deployment, triggering a new rollout | Command:
```bash
kubectl rollout restart deployment/staging
```
What it does:
Restart a resource.
Resource rollout will be restarted.
Syntax:
`kubectl rollout restart RESOURCE`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the resource... |
Set the cluster field in the specified context to the provided cluster | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster testing-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... |
Create a new NodePort service named web-app-nodeport that maps port 8443 of the cluster to port 5432 of the service | Command:
```bash
kubectl create service nodeport web-app-nodeport --tcp=8443:5432
```
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 9090 on localhost and IP 10.19.21.23 to port 9090 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-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 criteri... |
Forward local traffic to a pod on port 9090 | Command:
```bash
kubectl port-forward pod/web-app-pod :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 automatica... |
Start a pod named 'hazelcast' using the 'hazelcast/hazelcast' image and have the container expose port 3000. | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=3000
```
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:... |
Create a service for the replication controller specified in "ubuntu-controller.yaml", which serves on port 80 and connects to the containers on port 500100. | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=80 --target-port=500100
```
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... |
Output the modified search-engine-deployment deployment in YAML format with the DB_PASSWORD environment variable set to "secretpassword" but do not apply the changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/search-engine-deployment DB_PASSWORD=secretpassword -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 Pod Disruption Budget named 'critical-services-pdb' that will select all pods with the 'app=nginx' label and require at least 70% of the selected pods to be available at any given time. | Command:
```bash
kubectl create pdb critical-services-pdb --selector=app=nginx --min-available=70%
```
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 [--dry-run=s... |
Create an ingress called 'myapp-ingress' that directs requests from foo.com/input to the service 'svc1' on port 8000 | Command:
```bash
kubectl create ingress myapp-ingress --rule="foo.com/input=svc1:8000,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": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.