prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Autoscale the replication controller "log-aggregator" with the following settings: | Command:
```bash
kubectl autoscale rc log-aggregator --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 th... |
Create a job named "security-scan-job" using the Alpine image and run the command "apk add curl" inside the job | Command:
```bash
kubectl create job security-scan-job --image=alpine -- apk add curl
```
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 f... |
Create an ingress named 'ingtls' with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="foo.com/=svc:https,tls" \
--rule="foo.com/path/subpath*=othersvc:8082"
```
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": "--out... |
Create a copy of the media-stream-pod and change all container images to redis. Name the new pod debug-image-memcached. | Command:
```bash
kubectl debug media-stream-pod --copy-to=debug-image-memcached --set-image=*=redis
```
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 ... |
Create a new config map named env-vars using file contents instead of file basenames on disk | Command:
```bash
kubectl create configmap env-vars --from-file=conf=/path/to/options/file1.txt --from-file=data=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map b... |
Start a centos pod with custom spec overrides from JSON | Command:
```bash
kubectl run nginx --image=centos --overrides='{ "apiVersion": "feature-branch-2.3.0", "spec": { ... } }'
```
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] [--comma... |
Switch to the raw terminal mode and attach to the 'code-explorer' container in the 'api-service-pod' pod. | Command:
```bash
kubectl attach api-service-pod -c code-explorer -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... |
Taint node 'node-2' with a key-value pair 'environment=production' and effect 'NoSchedule', replacing the value if the taint already exists | Command:
```bash
kubectl taint nodes node-2 environment=production: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.... |
Update the label of the 'api' pod to 'status=unhealthy', overwriting any existing value | Command:
```bash
kubectl label --overwrite pods api status=unhealthy
```
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"... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-config deployment/backend-microservice-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... |
Delete pods and services with the names "proxy-server" and "vpn" | Command:
```bash
kubectl delete pod,service proxy-server vpn
```
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... |
Create a cluster role named "custom_role" with a specified NonResourceURL | Command:
```bash
kubectl create clusterrole "custom_role" --verb=watch --non-resource-url=/metrics
```
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", ... |
Forward traffic from local port 9090 to port 5000 in the pod named security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-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 select... |
Update the image of all containers in the daemonset named 'nginx' to 'centos:8.4.2105' | Command:
```bash
kubectl set image daemonset nginx *=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:
`ku... |
Create a copy of the vpn-service-pod, adding a debug container and changing the container images | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=web=nginx:latest,api=api:v2
```
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.... |
Create a new LoadBalancer service named 'log-aggregator-lb' that maps port 8082 to port 8084 | Command:
```bash
kubectl create service loadbalancer log-aggregator-lb --tcp=8082:8084
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "... |
Create an ingress with TLS enabled using a specific secret and pathType as Prefix. | Command:
```bash
kubectl create ingress ingsecret --class=default \
--rule="website.com/*=svc:8084,tls=secret1"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Start a golang pod and expose port 8084 | Command:
```bash
kubectl run hazelcast --image=golang --port=8084
```
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... |
Partially update the node specified in "kubelet-config.yaml" with the new value of "someField" using strategic merge patch | Command:
```bash
kubectl patch -f kubelet-config.yaml -p '{"spec":{"someField":"newValue"}'
```
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]`... |
Get the output from running the 'go version' command in the 'nano-bot' container of the 'mypod' pod. | Command:
```bash
kubectl exec mypod -c nano-bot -- go 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 kube... |
Create a deployment named jenkins using the node image and expose port 27017 | Command:
```bash
kubectl create deployment jenkins --image=node --port=27017
```
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... |
forward port 6379 from local host and IP 10.19.21.23 to the pod's port 6379 | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 6379: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 crit... |
Execute the 'python --version' command in the 'warp-drive' container of the 'frontend-pod' pod | Command:
```bash
kubectl exec frontend-pod -c warp-drive -- python --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Forward traffic from local port 8088 to port 9090 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8088: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 au... |
Rename the context 'prod-context' to 'team-beta-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context prod-context team-beta-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will al... |
Set the resource request and limits for all containers in the PHP deployment. | Command:
```bash
kubectl set resources deployment php --limits=cpu=200m,memory=512Mi --requests=cpu=5,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, bu... |
Add a taint with the key 'dedicated' and value 'node-2:PreferNoSchedule' to all nodes that have the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production dedicated=node-2:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Forward port 5000 on localhost and IP 10.19.21.23 to port 5000 in the 'analytics-pod' pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 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 crite... |
Import the 'secret_key' key from the 'api-config' config map into the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/api-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 definit... |
Create a new ingress resource named 'app1-ingress' that maps requests from 'foo.com/input' to service 'svc1' on port 3000, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress app1-ingress --rule="foo.com/input=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Forward local port 8088 to port 3000 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 8088:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a role named "default_role" with ResourceName specified as "file-processing" and "monitoring-prometheus" | Command:
```bash
kubectl create role default_role --verb=delete --resource=pods --resource-name=file-processing --resource-name=monitoring-prometheus
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--... |
Run a proxy to the Kubernetes API server on port 3001, serving static content from ./local/www/ | Command:
```bash
kubectl proxy --port=3001 --www=./local/www/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote... |
Forward port from pod to local machine | Command:
```bash
kubectl port-forward pod/proxy-server-pod :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 autom... |
Forward traffic from local port 3000 to port 5000 in the log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-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... |
Forward local ports 8081 and 6000 to ports 6379 and 6000 in a pod selected by the deployment "email-server-deployment" | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8081 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... |
Copy the contents of the '/var/run/secrets/kubernetes.io/serviceaccount/' directory from the 'istio-system/task-processor-pod-17' pod to the '/tmp/bar_dir' directory on the local machine. | Command:
```bash
kubectl cp istio-system/task-processor-pod-17:/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": "", "us... |
Create a service to expose a replicated nginx deployment with port 80 for external access and port 8000 for communication with the containers. | Command:
```bash
kubectl expose rs nginx --port=9000 --target-port=500000
```
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 new config map named 'env-vars' and populate it with the contents of the 'settings' file located at '/path/to/parameters/file1.txt' and the 'key2' file located at '/path/to/properties/file2.txt' | Command:
```bash
kubectl create configmap env-vars --from-file=settings=/path/to/parameters/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 creating a... |
Add a taint with the key 'datacenter' and value 'node-1:PreferNoSchedule' to all nodes that have the label 'instance=app-instance-1' | Command:
```bash
kubectl taint node -l instance=app-instance-1 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": "", "us... |
Forward port 8000 locally to port 8088 in the selected pod | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8000 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... |
Return the snapshot logs from the container named database-deployment-1 in the deployment called analytics-pod. | Command:
```bash
kubectl logs deployment/database-deployment -c analytics-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:
"flag": ... |
Create a new secret named database-secret by providing a file path and a literal value. | Command:
```bash
kubectl create secret generic database-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
```
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... |
Add a taint with the key 'datacenter' and value 'storage-node-13:PreferNoSchedule' on nodes having the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice 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": ... |
Run the 'redis-server --version' command in the warp-drive container of the e-commerce-pod pod and display the output | Command:
```bash
kubectl exec e-commerce-pod -c warp-drive -- redis-server --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. I... |
Create an ingress called 'website-ingress' that directs requests to website.com/module to svc1:9092 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="website.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": "", "u... |
Add a taint with key 'zone' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 zone=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 an ingress named "ingsecret" with TLS enabled using the secret named "secret1" and the pathType set to "Prefix" | Command:
```bash
kubectl create ingress ingsecret --class=default \
--rule="foo.com/*=svc:27017,tls=secret1"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Begin streaming the logs of the 'code-explorer' container in the 'mypod' pod. | Command:
```bash
kubectl logs -f -c code-explorer 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": ... |
Forward local port 3000 to port 3000 in the pod selected by the deployment "search-engine-deployment" | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 3000 3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Create an ingress called 'public-api-ingress' that directs requests from foo.com/module to svc1:8181 | Command:
```bash
kubectl create ingress public-api-ingress --rule="foo.com/module=svc1:8181,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": "", "us... |
Configure autoscaling for the replication controller "auth" with a target CPU utilization of 50%, allowing the number of pods to scale between 1 and 4 | Command:
```bash
kubectl autoscale rc auth --max=4 --cpu-percent=50
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses th... |
List the specified resources by their types and names | Command:
```bash
kubectl get rc/web service/e-commerce-rc pods/cdn-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespa... |
Add a taint with key 'cpu-type' on nodes having label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp cpu-type=k8s-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... |
Copy the local file "/tmp/foo" to the "/etc/kubernetes" directory in the remote pod "metrics-exporter-pod-10" in the "metallb-system" namespace. | Command:
```bash
kubectl cp /tmp/foo metallb-system/metrics-exporter-pod-10:/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 omitt... |
Create a cluster role named "reader" with the ability to perform "exec" actions on configmaps and specific resource names "audit-logger" and "database-master" | Command:
```bash
kubectl create clusterrole reader --verb=exec --resource=configmaps --resource-name=audit-logger --resource-name=database-master
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cli... |
Create a LoadBalancer service named ingress-controller-lb that maps port 8089 on the external IP to port 8081 on the service | Command:
```bash
kubectl create service loadbalancer ingress-controller-lb --tcp=8089:8081
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o... |
Update the 'cdn' pod by adding or updating the 'owner' annotation with the value 'alice-smith'. | Command:
```bash
kubectl annotate --overwrite pods cdn owner='alice-smith'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ar... |
Create a job named "certificate-renewal" using the "amazonlinux" image, and running the command "echo 'Hello'". | Command:
```bash
kubectl create job certificate-renewal --image=amazonlinux -- /bin/bash -c "echo 'Hello
```
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": ""... |
Create a copy of the 'e-commerce-pod' pod, replacing the command of the 'nebula-navigator' container with 'sh' | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=my-custom-dbg --container=nebula-navigator -- 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... |
Start a pod named "hazelcast" using the nginx image and expose port 8000 | Command:
```bash
kubectl run hazelcast --image=nginx --port=8000
```
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": "--fi... |
Forward local traffic on ports 5000 and 6000 to ports 8000 and 6000 in a pod selected by the 'email-server-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 5000 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... |
Update the deployment 'notification-handler-deployment' with a new environment variable named 'GOOGLE_API_KEY' and set its value to 'your-google-api-key' | Command:
```bash
kubectl set env deployment/notification-handler-deployment GOOGLE_API_KEY=your-google-api-key
```
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... |
Create an ingress that directs requests to a specific URL path to a service, using a TLS secret. | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="foo.com/bar=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... |
Start a node pod named 'busybox' and keep it in the foreground. Do not restart the pod if it exits. | Command:
```bash
kubectl run -i -t busybox --image=node --restart=Never
```
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"... |
Create a job named "testing" using the "busybox" image | Command:
```bash
kubectl create job testing --image=busybox
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|... |
Display only the most recent 5 lines of output in the pod "email-service-pod" | Command:
```bash
kubectl logs --tail=5 email-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":... |
Embed the certificate authority data for the kube-cluster-1 cluster entry and specify the path to the certificate authority file located at ~/.kube/galaxy-cluster/kubernetes.ca.crt. | Command:
```bash
kubectl config set-cluster kube-cluster-1 --embed-certs --certificate-authority=~/.kube/galaxy-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... |
List deployments in JSON format for the "dev-2.2.0" version of the "prod-apps" API group. | Command:
```bash
kubectl get deployments.dev-2.2.0.prod-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... |
Add a taint with the key 'datacenter' on nodes having the label instance=app-instance-1 | Command:
```bash
kubectl taint node -l instance=app-instance-1 datacenter=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 a service for a replication controller specified in the "nginx-controller.yaml" file, serving on port 3000 and connecting to containers on port 801000. | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=3000 --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 ... |
Create a new ClusterIP service named messaging-service-clusterip, mapping port 9000 on the service to port 8080 on the target | Command:
```bash
kubectl create service clusterip messaging-service-clusterip --tcp=9000:8080
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-... |
Copy the file /tmp/foo from the remote pod named 'file-server-pod-14' in the 'kube-system' namespace and extract it to the local directory /tmp/bar_dir. | Command:
```bash
kubectl exec -n kube-system file-server-pod-14 -- tar cf - /tmp/foo | tar xf - -C /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": "Cont... |
Create a new config map named ui-config using the files file1.txt and file2.txt, and set their keys as properties and key1, respectively | Command:
```bash
kubectl create configmap ui-config --from-file=properties=/path/to/data/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 a co... |
Create a pod named "hazelcast" using the "postgres" image and expose port 8010. | Command:
```bash
kubectl run hazelcast --image=postgres --port=8010
```
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": "-... |
Get the logs from the container "security-service-pod-1" of a deployment named "search-engine-deployment" | Command:
```bash
kubectl logs deployment/search-engine-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 fla... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/payment-gateway-secret deployment/notification-handler-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 ... |
Delete the pods and services named "api" and "proxy" | Command:
```bash
kubectl delete pod,service api proxy
```
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 ... |
Add a taint with the key 'app' and value 'web-node-8:PreferNoSchedule' on all nodes that have the label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster app=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": "O... |
Create a new secret named 'api-key-secret' from the environment variables in the 'path/to/data.env' file. | Command:
```bash
kubectl create secret generic api-key-secret --from-env-file=path/to/data.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename ... |
Create a copy of the 'frontend-pod' with a debug container and change the container image | Command:
```bash
kubectl debug frontend-pod -it --copy-to=debug-image-memcached --image=debian --set-image=worker=my-custom-worker:1.2.3,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 obj... |
Check if you have permission to list the cron job named "cron-job" in the namespace "development" | Command:
```bash
kubectl auth can-i list jobs.batch/cron-job -n development
```
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 URL that ... |
Update the environment annotation of the pod specified in "parameters.json" to "staging". | Command:
```bash
kubectl annotate -f parameters.json 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 st... |
Create a single ingress called 'private-api-ingress' that directs requests to website.com/bar to svc1:7000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress private-api-ingress --rule="website.com/bar=svc1:7000,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 the label 'component=api' to the 'email' pod | Command:
```bash
kubectl label pods email component=api
```
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": "I... |
Set the cluster field of the `my-context` context to `prod-cluster` | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster prod-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value yo... |
Listen on port 6379 locally and forward it to the targetPort of the service's port named "https" in a pod selected by the service "gateway-service" | Command:
```bash
kubectl port-forward service/gateway-service 6379: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... |
Set the resource request and limits for all containers in the 'go' deployment | Command:
```bash
kubectl set resources deployment go --limits=cpu=200m,memory=512Mi --requests=cpu=2,memory=64Mi
```
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, bu... |
Create a service for the replication controller specified in "node-controller.yaml" file | Command:
```bash
kubectl expose -f node-controller.yaml --port=5001 --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 s... |
Copy the file ~/.config/kube from the monitoring-agent-pod-6 pod in the cert-manager namespace to the /tmp/bar directory on your local machine. | Command:
```bash
kubectl cp cert-manager/monitoring-agent-pod-6:~/.config/kube /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/env-vars 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 definitions... |
Execute the command 'redis-server' in the 'code-explorer' container of the 'monitoring-pod' pod and capture the output. | Command:
```bash
kubectl exec monitoring-pod -c code-explorer -- redis-server
```
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... |
Import the 'api_key' key from the 'app-config-dev' ConfigMap and set it as an environment variable in the 'user-management-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-config-dev 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 definit... |
Create an ingress named 'public-api-ingress' that directs requests to the path '/bar' from the domain 'testing.com' to the service 'svc1' on port '8088' | Command:
```bash
kubectl create ingress public-api-ingress --rule="testing.com/bar=svc1:8088,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Execute the command "ruby --version" in the rocket-ranger container of the pod "proxy-server-pod" and display the output. | Command:
```bash
kubectl exec proxy-server-pod -c rocket-ranger -- ruby --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 o... |
Create a new pod named 'hazelcast' using the 'amazonlinux' image, and expose port 8081 in the container. | Command:
```bash
kubectl run hazelcast --image=amazonlinux --port=8081
```
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":... |
Set the service account for the deployment "database-deployment" to "jenkins". | Command:
```bash
kubectl set serviceaccount deployment database-deployment jenkins
```
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:
`kubectl s... |
Get the output from running the 'ash' command in the 'stardust-shuttle' container from the 'cdn-service-pod' pod | Command:
```bash
kubectl exec cdn-service-pod -c stardust-shuttle -- ash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Apply a taint on nodes with the label 'tier=frontend' by running the command 'kubectl taint node -l tier=frontend environment=storage-node-13:PreferNoSchedule' | Command:
```bash
kubectl taint node -l tier=frontend environment=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": "", "us... |
Forward all traffic on port 8888 to port 5432 in the 'proxy-server-pod' pod, allowing connections from all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 8888: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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.