prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new config map named app-settings using specified file paths as keys | Command:
```bash
kubectl create configmap app-settings --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 creat... |
Forward local port 8081 to port 3000 in the pod selected by the search-engine-deployment deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8081 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... |
import the LOG_LEVEL key from the log-config config map and set it as an environment variable in the notification-handler-deployment deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/log-config 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 defi... |
Create a job named "cleanup" using the Redis image, and run the command "redis-cli" within the job. | Command:
```bash
kubectl create job cleanup --image=redis -- redis-cli
```
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:... |
Import the API_KEY key from the db-config ConfigMap and set it as an environment variable in the proxy-service-deployment deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/db-config deployment/proxy-service-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... |
Forward port 8081 on all addresses to port 8888 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8081: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 sel... |
Copy the local file ~/.config/kube to :/tmp/bar inside the file-server-pod-14 pod in the kube-proxy namespace. | Command:
```bash
kubectl cp ~/.config/kube kube-proxy/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 t... |
Create a single ingress called 'app-proxy-ingress' that directs requests to site.com/input to svc # svc1:8888 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="site.com/input=svc1:8888,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 a pod named "hazelcast" with the "mongo" image and expose port 5001. | Command:
```bash
kubectl run hazelcast --image=mongo --port=5001
```
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... |
Embed the certificate authority data for the testing-cluster cluster entry | Command:
```bash
kubectl config set-cluster testing-cluster --embed-certs --certificate-authority=~/.kube/web-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 s... |
Auto scale the replication controller "gateway" with a target CPU utilization of 90% and the number of pods between 1 and 5. | Command:
```bash
kubectl autoscale rc gateway --max=5 --cpu-percent=90
```
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... |
Execute the 'geth' command in the 'code-explorer' container of the 'analytics-pod' pod and get the output. | Command:
```bash
kubectl exec analytics-pod -c code-explorer -- geth
```
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 t... |
Remove all taints with key 'workload' from node 'edge-node-10' | Command:
```bash
kubectl taint nodes edge-node-10 workload-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml... |
Forward traffic from port 5000 on all addresses to port 6379 in the frontend-pod pod, allowing external access to the pod on port 5000. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-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 pod will... |
Create an ingress resource named 'app1-ingress' with a rule that directs requests from testing.com/module to the service 'svc1' on port 9092, and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress app1-ingress --rule="testing.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": "", "usag... |
Forward local port 8080 to port 9090 and local port 6000 to port 6000 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 8080 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... |
Provide a detailed description of the legacy-node-20.legacy-datacenter.local node. | Command:
```bash
kubectl describe nodes legacy-node-20.legacy-datacenter.local
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all obje... |
Import the 'CONFIG_FILE_PATH' key from the 'app-config-dev' config map to the 'scheduler-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config-dev deployment/scheduler-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 ... |
Switch to raw terminal mode and attach to the 'time-machine' container in the 'payment-gateway-pod' pod. | Command:
```bash
kubectl attach payment-gateway-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. I... |
Apply a taint with key 'disktype' on nodes that have the label 'myLabel' and set the taint value to 'backup-node-14:PreferNoSchedule'. | Command:
```bash
kubectl taint node -l myLabel disktype=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Rename a context in your kubeconfig file | Command:
```bash
kubectl config rename-context on-prem-context client-2-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 ... |
Create an ingress resource called 'app-gateway-ingress' with a rule that directs requests to site.com/bar to svc1:8080 | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="site.com/bar=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Add a taint with the key 'cpu-type' on nodes that have the label 'release=beta'. | Command:
```bash
kubectl taint node -l release=beta cpu-type=monitoring-node-15:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Partially update the prod-node-5 node by specifying the patch as YAML. Set the value of 'someField' to 'newValue'. | Command:
```bash
kubectl patch node prod-node-5 -p $'spec:\n 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]`
Helpful ... |
Create a new config map named log-config with the keys "properties" and "key1", using the files /path/to/profiles/file1.txt and /path/to/parameters/file2.txt respectively. | Command:
```bash
kubectl create configmap log-config --from-file=properties=/path/to/profiles/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... |
Begin streaming the logs from all containers in pods that have the label app-type=microservice | Command:
```bash
kubectl logs -f -l app-type=microservice --all-containers=true
```
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 deployment named jenkins using the redis image. | Command:
```bash
kubectl create deployment jenkins --image=redis
```
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|nam... |
Start listening on all addresses on port 5000 and forward the traffic to port 6379 in the web-app-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-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 pod will ... |
Expose the nginx deployment as a service on port 7000, connecting to the containers on port 500100 | Command:
```bash
kubectl expose deployment nginx --port=7000 --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 specifie... |
Create a pod disruption budget named 'monitoring-pdb' that selects all pods with the 'owner=team-1' label and ensures that at least four of them are available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget monitoring-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 [-... |
Forward port 6379 from all addresses to port 8088 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 6379:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a po... |
Update the label of pod 'api' to 'release=v2.0' | Command:
```bash
kubectl label pods api release=v2.0
```
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 t... |
List deployments in YAML output format for the v2.1.0 version of the sandbox-apps API group. | Command:
```bash
kubectl get deployments.v2.1.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... |
Create a pod disruption budget named auth-service-pdb that will select all pods with the release=1.0.0 label and require at least four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget auth-service-pdb --selector=release=1.0.0 --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... |
Add a taint with key 'disktype' on nodes having the label component=proxy using the command 'kubectl taint node -l component=proxy disktype=monitoring-node-15:PreferNoSchedule' | Command:
```bash
kubectl taint node -l component=proxy disktype=monitoring-node-15:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Enable a new exec auth plugin for the "prod-user" entry. | Command:
```bash
kubectl config set-credentials prod-user --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
-... |
Open a raw terminal session with the pod named database-pod and container named time-machine | Command:
```bash
kubectl attach database-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 omitt... |
Remove the taint with key 'app' and effect 'PreferNoSchedule' from node 'node-1'. | Command:
```bash
kubectl taint nodes node-1 app: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. One of: jso... |
Create an ingress rule for 'api-v1-ingress' that directs requests from 'foo.com/input' to 'svc1:8088' with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.com/input=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": "", "usage":... |
List the container name and image of the auth-service-pod in custom columns format. | Command:
```bash
kubectl get pod auth-service-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 ... |
Create an ingress named 'app-gateway-ingress' that routes requests from 'foo.com/module' to 'svc1:5000' with a TLS secret called 'my-cert' | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="foo.com/module=svc1:5000,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... |
Set a custom TLS server name for validation of the sun-cluster cluster entry | Command:
```bash
kubectl config set-cluster sun-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] [--certificate-a... |
Copy the kube config file from your local machine to the /tmp/bar directory in the load-balancer-pod-9 container, specifically the ingress-controller container. | Command:
```bash
kubectl cp ~/.config/kube load-balancer-pod-9::/tmp/bar -c ingress-controller
```
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 cron job named "report-generation" with the image "docker.elastic.co/elasticsearch/elasticsearch" | Command:
```bash
kubectl create cronjob report-generation --image=docker.elastic.co/elasticsearch/elasticsearch --schedule="*/1 * * * *" -- elasticsearch-plugin --list
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] ... |
Create a new ClusterIP service named messaging-service-clusterip that maps port 5432 on the service to port 9091 on the backend pods | Command:
```bash
kubectl create service clusterip messaging-service-clusterip --tcp=5432:9091
```
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": "-... |
Show the replication controller named "web", the service named "auth-service-rc", and the pod named "frontend-pod". | Command:
```bash
kubectl get rc/web service/auth-service-rc pods/frontend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespac... |
Create a job with a specific command | Command:
```bash
kubectl create job log-processing-job --image=node -- node
```
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... |
Get the output from running the 'apk add curl' command on the first container of the load-balancer-deployment deployment. | Command:
```bash
kubectl exec deploy/load-balancer-deployment -- apk add curl
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Create a new config map named 'global-config' using the files 'file1.txt' and 'file2.txt' | Command:
```bash
kubectl create configmap global-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config ... |
Remove all the taints with the key 'datacenter' from the 'edge-node-10' node. | Command:
```bash
kubectl taint nodes edge-node-10 datacenter-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|ya... |
Add a taint to a node with a specific key and no value | Command:
```bash
kubectl taint nodes monitoring-node-15 hardware: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. O... |
Get the logs of the previously terminated ruby container from the pod named cdn-service-pod | Command:
```bash
kubectl logs -p -c ruby cdn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short":... |
View the detailed configuration of a pod | Command:
```bash
kubectl describe pods/message-broker
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide... |
Check if you have permission to list the "queue-processing-job" job in the "kube-node-lease" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/queue-processing-job -n kube-node-lease
```
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 p... |
Add a taint with key 'datacenter' and value 'kube-master-9:PreferNoSchedule' on nodes having label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice datacenter=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": ""... |
Add a taint with key 'datacenter' on nodes having label 'region=eu-west-2' | Command:
```bash
kubectl taint node -l region=eu-west-2 datacenter=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Set the service account of a deployment to kube-scheduler | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment kube-scheduler
```
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
Synt... |
Forward local port 6379 to port 9090 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward pod/cdn-service-pod 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 pod will be selected au... |
Taint nodes with 'hardware' key on label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack hardware=monitoring-node-15:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Create a job named "testing" using the "python" image, with the command "python" | Command:
```bash
kubectl create job testing --image=python -- python
```
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: j... |
Set the "LOG_LEVEL" environment variable for the "user-management-deployment" deployment using the value from the "global-config" ConfigMap. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/global-config deployment/user-management-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Import the api_key key from the app-config-dev config map into the search-engine-deployment deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-config-dev deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Open and edit the configuration of a service using the Atom editor | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/api-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or... |
Create an ingress called 'private-api-ingress' that directs requests to a specific path and service, with TLS encryption. | Command:
```bash
kubectl create ingress private-api-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": "", "... |
Forward the local port 3000 to port 5000 in the security-service-pod pod, allowing connections from all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-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 ... |
Set the resource request and limits for all containers in the "runtime" deployment | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=cpu=5,memory=2Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested... |
Create a deployment named drupal with the alpine image and expose port 9092 | Command:
```bash
kubectl create deployment drupal --image=alpine --port=9092
```
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... |
Create a service for the replication controller identified in nginx-controller.yaml | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=80 --target-port=909200
```
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 sp... |
Copy the local file /tmp/foo_dir to the remote pod api-server-pod-3 in the kube-dns namespace at the path /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo_dir kube-dns/api-server-pod-3::/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 kub... |
Scale the replication controller "gateway" to automatically adjust the number of pods between 1 and 5 based on the target CPU utilization of 40%. | Command:
```bash
kubectl autoscale rc gateway --max=5 --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... |
Create a role named "foo" with the following properties: | Command:
```bash
kubectl create role foo --verb=get --resource=pods --resource-name=log-aggregator --resource-name=mail-server
```
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=server|client|n... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/chat-app-rc pods/web-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced yo... |
Attach to the analytics pod and interact with the warp-drive container | Command:
```bash
kubectl attach analytics-pod -c warp-drive -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 omitte... |
Create an ingress named 'www-ingress' that routes requests from foo.com/example to svc1:8081 with TLS encryption using the secret 'my-cert'. | Command:
```bash
kubectl create ingress www-ingress --rule="foo.com/example=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": "", "usage": ... |
Auto scale the replication controller "email" with a target CPU utilization of 40% and a maximum of 7 pods. | Command:
```bash
kubectl autoscale rc email --max=7 --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 t... |
Import the REDIS_HOST key from the app-config-dev config map and set it as an environment variable in the proxy-service-deployment deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-config-dev deployment/proxy-service-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 defini... |
Create a cron job named "weekly-summary" with the image "mongo", scheduling it to run every minute, and running the command "mongod". | Command:
```bash
kubectl create cronjob weekly-summary --image=mongo --schedule="*/1 * * * *" -- mongod
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Add a taint with key 'environment' on the nodes having label cluster=my-cluster, with the value 'PreferNoSchedule' on the node 'app-node-6' | Command:
```bash
kubectl taint node -l cluster=my-cluster environment=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Create a deployment named "scheduler" with the "wordpress" image and 7 replicas | Command:
```bash
kubectl create deployment scheduler --image=wordpress --replicas=7
```
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. On... |
Forward all traffic on port 5000 to port 5432 within the pod named 'security-service-pod', and listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-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 ... |
Create an ingress named 'public-ingress' that routes requests from site.com/input to svc1:5432 using the my-cert TLS secret. | Command:
```bash
kubectl create ingress public-ingress --rule="site.com/input=svc1:5432,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"... |
Output the frontend-deployment deployment as a YAML file with the MAX_CONNECTIONS environment variable set to 100, without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/frontend-deployment MAX_CONNECTIONS=100 -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod te... |
Set a custom TLS server name for the moon-cluster cluster entry | Command:
```bash
kubectl config set-cluster moon-cluster --tls-server-name=dev-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] [--certificate-... |
Create a cron job named "database-maintenance" with the image "ethereum/client-go", scheduled to run every minute, and execute the command "geth" | Command:
```bash
kubectl create cronjob database-maintenance --image=ethereum/client-go --schedule="*/1 * * * *" -- geth
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", ... |
Forward traffic from port 8080 on all addresses to port 8080 in the pod named "mypod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8080:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Add the taint with key 'special' on nodes having the label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack special=kube-master-9:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Start a pod named "hazelcast" using the "postgres" image and expose port 8083 | Command:
```bash
kubectl run hazelcast --image=postgres --port=8083
```
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": "-... |
Display the most recent 53 lines of logs for the pod named mypod. | Command:
```bash
kubectl logs --tail=53 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 debug copy of the proxy-service-pod by adding a debug container and changing the container images | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-memcached --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 res... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-config-dev deployment/payment-processor-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 varia... |
Forward local requests on port 8080 to port 3000 in the 'log-aggregator-deployment' pod. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 8080 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 wi... |
Update the 'monitoring-stack-deployment' deployment by adding a new environment variable 'DB_PASSWORD' with the value 'secretpassword'. | Command:
```bash
kubectl set env deployment/monitoring-stack-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 more... |
Create a new ExternalName service named external-notification-service with the external name "news-demo.news" | Command:
```bash
kubectl create service externalname external-notification-service --external-name news-demo.news
```
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 ... |
Forward local port 8081 to port 8080 in the pod with the name 'api-service-pod' | Command:
```bash
kubectl port-forward pod/api-service-pod 8081 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Set up automatic scaling for the "gateway" deployment with a minimum of 1 pod and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment gateway --min=1 --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... |
Create an ingress called 'app-loadbalancer-ingress' with the following rule: direct requests to testing.com/module to svc1:6379, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="testing.com/module=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... |
Set the cluster field to 'star-cluster' in the 'my-context' context | Command:
```bash
kubectl config set contexts.user-a-context.cluster star-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you w... |
Set the service account of the deployment "frontend-deployment" to "tekton". | Command:
```bash
kubectl set serviceaccount deployment frontend-deployment tekton
```
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 se... |
Forward traffic from local port 8088 to port 9090 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-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 automa... |
Create a pod disruption budget named logging-pdb that selects all pods with the version=v2 label and requires a minimum of one of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=version=v2 --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-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.