prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new config map named "monitoring-config" using environment variables from the specified file | Command:
```bash
kubectl create configmap monitoring-config --from-env-file=path/to/preferences.env
```
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... |
Add a taint with the key 'cpu-type' and value 'testing-node-11:PreferNoSchedule' on nodes with the label 'role=database' | Command:
```bash
kubectl taint node -l role=database cpu-type=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": "", "usage... |
Create a service for the replicated python with the following configuration: the service will serve on port 80 and connect to the containers on port 8000 | Command:
```bash
kubectl expose rc python --port=3001 --target-port=808000
```
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 an ingress called 'default-ingress' with a rule that directs requests to testing.com/bar to svc1:6379 | Command:
```bash
kubectl create ingress default-ingress --rule="testing.com/bar=svc1:6379,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": "", "usag... |
Automatically scale the replication controller "media-stream" with the number of pods ranging between 1 and 4, based on a target CPU utilization of 81%. | Command:
```bash
kubectl autoscale rc media-stream --max=4 --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... |
Display only the most recent 20 lines of output for a specific pod | Command:
```bash
kubectl logs --tail=20 mypod
```
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": "-c", "def... |
Create a Pod Disruption Budget named api-service-pdb that will select all pods with the owner=team-1 label and require at least 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=owner=team-1 --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 [... |
Create a new config map named 'api-config' with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --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 creatin... |
retrieve the deployments in the "sandbox-apps" API group with version "v3.0.0" in YAML format. | Command:
```bash
kubectl get deployments.v3.0.0.sandbox-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 you wi... |
Forward traffic from port 5000 on your local machine to port 9090 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 5000: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 auto... |
Set an autoscaling policy for the "frontend" deployment with a minimum of 3 pods and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment frontend --min=3 --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 use... |
Run the 'postgres' command in the 'warp-drive' container of the 'media-stream-pod' pod and get the output | Command:
```bash
kubectl exec media-stream-pod -c warp-drive -- 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, u... |
Set the service account of the 'scheduler-app-deployment' deployment to 'gitlab-runner' | Command:
```bash
kubectl set serviceaccount deployment scheduler-app-deployment gitlab-runner
```
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:... |
Auto scale the 'vpn' deployment with the number of pods between 6 and 13. | Command:
```bash
kubectl autoscale deployment vpn --min=6 --max=13
```
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... |
Delete pods and services named "vpn" and "cdn" | Command:
```bash
kubectl delete pod,service vpn cdn
```
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... |
Forward local port 6379 to port 9090 in the pod selected by the deployment named "notification-handler-deployment". | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 6379 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 ... |
Add a taint with the key 'workload' on all nodes that have the label 'role=database', specifically targeting the node 'node-1', and set the taint to 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l role=database workload=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": "Outpu... |
Copy the local file '/tmp/foo_dir' to the remote pod 'web-app-pod-1' in the 'ingress-nginx' namespace, and rename it as '/tmp/bar'. | Command:
```bash
kubectl cp /tmp/foo_dir ingress-nginx/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 k... |
Update the 'notification-handler-deployment' deployment by adding a new environment variable SMTP_HOST with the value smtp.example.com | Command:
```bash
kubectl set env deployment/notification-handler-deployment SMTP_HOST=smtp.example.com
```
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 ... |
List deployments in YAML format for the "v1.0.0" version of the "internal-apps" API group | Command:
```bash
kubectl get deployments.v1.0.0.internal-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 you w... |
Listen on port 5000 locally and forward it to port 9090 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 5000: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 autom... |
Get the output from running the 'mysql --version' command inside the 'time-machine' container of the 'e-commerce-pod' pod. | Command:
```bash
kubectl exec e-commerce-pod -c time-machine -- mysql --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... |
Create a service for the replicated hazelcast using the replica set hazelcast | Command:
```bash
kubectl expose rs hazelcast --port=8081 --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 the specified po... |
Create a new NodePort service named proxy-service-nodeport that maps port 5000 on the cluster nodes to port 7000 on the service | Command:
```bash
kubectl create service nodeport proxy-service-nodeport --tcp=5000:7000
```
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... |
Create a new config map named db-config with the specified keys and file paths | Command:
```bash
kubectl create configmap db-config --from-file=properties=/path/to/settings/file1.txt --from-file=key1=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating ... |
Forward traffic from port 8888 on all addresses to port 5000 in the pod "cdn-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8888: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 w... |
Execute the 'go run hello.go' command from the first container in the media-stream-pod and get the output | Command:
```bash
kubectl exec media-stream-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 ... |
Update the image of all containers in the 'prod' DaemonSet to 'wordpress:5.8.1' | Command:
```bash
kubectl set image daemonset prod *=wordpress:5.8.1
```
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... |
Import the 'SMTP_SERVER' key from the 'log-config' ConfigMap and set it as an environment variable for the 'database-deployment' deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/log-config deployment/database-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... |
Apply a taint to nodes with the label 'app=web-app' by running the command 'kubectl taint node -l app=web-app cpu-type=kube-master-9:PreferNoSchedule'. | Command:
```bash
kubectl taint node -l app=web-app cpu-type=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": "... |
Add a taint with key 'hardware' on nodes having label environment=production | Command:
```bash
kubectl taint node -l environment=production hardware=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": "", "... |
Create an ingress called 'app-proxy-ingress' with a rule that directs requests from foo.com/input to the service svc1:9000 | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="foo.com/input=svc1:9000,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": "", "usag... |
Get the output from running the "python" command in the "stardust-shuttle" container from the pod "vpn-service-pod" | Command:
```bash
kubectl exec vpn-service-pod -c stardust-shuttle -- 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... |
Scale the deployment named dev-environment-rs to 1 replica, assuming its current size is 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=1 deployment/dev-environment-rs
```
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-... |
Forward local port 8088 to port 8088 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-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 will be select... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/kube-system-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 ... |
Create a single ingress named 'app-gateway-ingress' that routes incoming requests for 'website.com/bar' to the service 'svc1' running on port '9090' | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.com/bar=svc1:9090,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": "", "... |
Add a taint to node 'node-1' with the key 'datacenter' and no value, using the "kubectl taint" command with the parameters "nodes node-1 datacenter:NoSchedule". | Command:
```bash
kubectl taint nodes node-1 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. One of: jso... |
Apply a taint to nodes with the label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 environment=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-name-config 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... |
Update the 'api' pod with the annotation 'compliance-level' and the value 'PCI-DSS', make sure to overwrite any existing value. | Command:
```bash
kubectl annotate --overwrite pods api compliance-level='PCI-DSS'
```
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 inc... |
Create an ingress called 'app-proxy-ingress' that routes requests from site.com/input to svc1:8081, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="site.com/input=svc1:8081,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... |
create an ExternalName service named my-ns | Command:
```bash
kubectl create service externalname my-ns --external-name dummy-website.io
```
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 services that exist of... |
List deployments in YAML format for the "rc-1.1.0" version of the "experimental-apps" API group | Command:
```bash
kubectl get deployments.rc-1.1.0.experimental-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... |
display the API resources that are supported in the "apiextensions.k8s.io" API group. | Command:
```bash
kubectl api-resources --api-group=apiextensions.k8s.io
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Create a pod disruption budget that selects all pods with the owner=team-1 label and requires a minimum of one pod being available at all times. | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=owner=team-1 --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 [... |
Auto scale a replication controller "gateway" with a maximum of 4 pods and a target CPU utilization of 40% | Command:
```bash
kubectl autoscale rc gateway --max=4 --cpu-percent=40
```
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... |
Copy the /tmp/foo_dir directory on your local machine to the /tmp/bar_dir_dir directory in the remote pod named ingress-controller-pod-8, located in the default namespace. | Command:
```bash
kubectl cp /tmp/foo_dir ingress-controller-pod-8:/tmp/bar_dir_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 t... |
Retrieve the previous terminated logs of the "warp-drive" container from the "log-aggregator-pod" pod. | Command:
```bash
kubectl logs -p -c warp-drive 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",... |
Add a taint with the key 'environment' and value 'worker-node-3:PreferNoSchedule' on nodes having the label 'instance=app-instance-1' | Command:
```bash
kubectl taint node -l instance=app-instance-1 environment=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default":... |
Forward local ports 8000 and 6000 to ports 5432 and 6000 in the pod "log-aggregator-pod". | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8000 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... |
Apply the configuration in the manifest.yaml file to resources that have the label stack=tech-stack | Command:
```bash
kubectl apply --prune -f manifest.yaml -l stack=tech-stack
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' o... |
Create a job named monitoring-job using the alpine image. The job should execute the command 'ash'. | Command:
```bash
kubectl create job monitoring-job --image=alpine -- ash
```
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 o... |
Create a service for the replicated ubuntu containers, which serves on port 5432 and connects to the containers on port 808300 | Command:
```bash
kubectl expose rc ubuntu --port=5432 --target-port=808300
```
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 service for the nginx deployment, which serves on port 3306 and connects to the containers on port 330600 | Command:
```bash
kubectl expose deployment nginx --port=3306 --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 the specifie... |
Create a service for a replicated centos on port 9091, connecting to containers on port 8000. | Command:
```bash
kubectl expose rc centos --port=9091 --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 port. A... |
Update the 'proxy' pod by adding an annotation with the key 'alert-email' and the value 'alerts@example.com' | Command:
```bash
kubectl annotate pods proxy alert-email=alerts@example.com
```
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 a... |
Forward local port 6379 to port 3000 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-pod 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 select... |
Create a new config map named db-config, using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap db-config --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/properties/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating ... |
Create a deployment named wordpress using the mongo image | Command:
```bash
kubectl create deployment wordpress --image=mongo
```
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: json|yaml|n... |
Copy the file '/tmp/foo' from the 'payment-gateway-pod-19' pod in the 'prometheus' namespace to the '/etc/kubernetes' directory locally. | Command:
```bash
kubectl cp prometheus/payment-gateway-pod-19::/tmp/foo /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, ... |
get resource(s) by type and name | Command:
```bash
kubectl get rc/web service/frontend-rc pods/proxy-server-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... |
Listen on port 8088 on localhost and IP address 10.19.21.23, and forward the traffic to port 5000 in the analytics-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 8088: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 crite... |
Update the image of all containers in the daemonset "services" to "mysql:5.7.35" | Command:
```bash
kubectl set image daemonset services *=mysql:5.7.35
```
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:
`ku... |
Create an ingress named 'ingress1' with multiple hosts and the pathType set to Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:9090" \
--rule="example.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": "--outp... |
Create a new config map named app-config-dev using the specified keys from files | Command:
```bash
kubectl create configmap app-config-dev --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Taint a node with a specific key, value, and effect | Command:
```bash
kubectl taint nodes node-2 zone=us-west-1a: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": "Output format. ... |
Update the 'cdn' pod by setting the 'env' annotation to 'staging' | Command:
```bash
kubectl annotate pods cdn 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 value... |
Update the deployment 'proxy-service-deployment' by adding a new environment variable SMTP_USERNAME with the value 'your-username' | Command:
```bash
kubectl set env deployment/proxy-service-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 more p... |
Create a job to run a command on a container with an image. | Command:
```bash
kubectl create job image-build-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. On... |
Forward local traffic on port 8888 to port 6379 in the pod 'api-service-pod' | Command:
```bash
kubectl port-forward pod/api-service-pod 8888: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 au... |
Start streaming the logs of the 'lunar-launcher' container in the 'database-pod' pod | Command:
```bash
kubectl logs -f -c lunar-launcher database-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", "... |
Auto scale the replication controller "analytics" with a target CPU utilization of 81% and a maximum of 4 pods | Command:
```bash
kubectl autoscale rc analytics --max=4 --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 us... |
Import specific keys from a config map into a deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/api-config 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 definit... |
Create a new config map named ui-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=settings=/path/to/configs/file1.txt --from-file=key2=/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... |
Get deployments in JSON format for the "external-apps" API group in the "hotfix-1.1.2" version. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.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... |
Retrieve the previous terminated logs of the "rocket-ranger" container from the "chat-app-pod" pod. | Command:
```bash
kubectl logs -p -c rocket-ranger 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", "s... |
Auto scale the replication controller "analytics" with the number of pods between 1 and 5, targeting a CPU utilization of 60%. | Command:
```bash
kubectl autoscale rc analytics --max=5 --cpu-percent=60
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that us... |
Listen on port 3000 locally, forwarding data to/from port 8088 in a pod selected by the 'email-server-deployment' deployment | Command:
```bash
kubectl port-forward deployment/email-server-deployment 3000 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... |
Install and load bash completion for kubectl | Command:
```bash
source <(kubectl completion bash)
```
What it does:
Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .bash_profile.
Detailed instructions on how to do th... |
Embed the certificate authority data for the 'dev-cluster' cluster entry using the command "kubectl config set-cluster dev-cluster --embed-certs --certificate-authority=[path_to_certificate_authority_file]" | Command:
```bash
kubectl config set-cluster dev-cluster --embed-certs --certificate-authority=~/.kube/e2e/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-cluster N... |
Create a copy of the "gateway-pod" pod, add a debug container with the Debian image, and change the container images for "mailer" to "mailer:latest" and "worker" to "my-custom-worker:1.2.3". | Command:
```bash
kubectl debug gateway-pod -it --copy-to=debug-image-app --image=debian --set-image=mailer=mailer:latest,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 identified ... |
Update the image of all containers in the daemonset named "test" to 'php:7.4.22' | Command:
```bash
kubectl set image daemonset test *=php:7.4.22
```
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:
`kubectl ... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=LOG_LEVEL --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 variable defin... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/db-config 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 defin... |
Run the 'elasticsearch' command in the pod 'vpn-service-pod' and retrieve the output. | Command:
```bash
kubectl exec vpn-service-pod -- elasticsearch
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kub... |
Copy the file '~/.config/kube' from the local machine to '/tmp/bar' in the 'openfaas/file-server-pod-14' pod in the specified namespace. | Command:
```bash
kubectl cp ~/.config/kube openfaas/file-server-pod-14:/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 ... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config 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... |
Run the 'yum install -y wget' command in the cyber-sleuth container of the frontend-pod pod | Command:
```bash
kubectl exec frontend-pod -c cyber-sleuth -- yum install -y wget
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Display the last 53 lines of logs for the frontend-pod | Command:
```bash
kubectl logs --tail=53 frontend-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": "-c... |
Forward traffic from port 5432 on localhost and IP 10.19.21.23 to port 8888 inside the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 5432: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 ... |
Unset the namespace for the team-alpha-context context. | Command:
```bash
kubectl config unset contexts.team-alpha-context.namespace
```
What it does:
Unset 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.
Syntax:
`kubectl config unset PROPERTY_... |
Get the output from running the 'pg_dump --version' command from the first pod of the gateway-deployment deployment | Command:
```bash
kubectl exec deploy/gateway-deployment -- pg_dump --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 omitte... |
Create a pod disruption budget named "statefulset-pdb" that will select all pods with the "env=production" label and require at least 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=env=production --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... |
Execute the 'postgres' command in the 'cyber-sleuth' container of the 'backend-pod' pod and retrieve the output. | Command:
```bash
kubectl exec backend-pod -c cyber-sleuth -- 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 ... |
Autoscale the deployment "foo" with a minimum of 3 pods and a maximum of 11 pods. | Command:
```bash
kubectl autoscale deployment foo --min=3 --max=11
```
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 debug copy of a pod named "backend-pod" and change all container images to "amazonlinux". | Command:
```bash
kubectl debug backend-pod --copy-to=debug-image-1 --set-image=*=amazonlinux
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no r... |
Create a service for a replication controller using the configuration file "hazelcast-controller.yaml", which serves on port 3000 and connects to the containers on port 9090 | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=3000 --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 ... |
Create a new ClusterIP service named inventory-service-clusterip with port mapping TCP 8000 to 5001. | Command:
```bash
kubectl create service clusterip inventory-service-clusterip --tcp=8000:5001
```
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": "-... |
Forward local traffic from port 3000 to port 6379 on the pod named backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 3000 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 automa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.