prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a job named 'testing' with the image 'jenkins' and execute the command 'java -jar /usr/share/jenkins/jenkins.war' | Command:
```bash
kubectl create job testing --image=jenkins -- java -jar /usr/share/jenkins/jenkins.war
```
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": "",... |
Expose a deployment as a service on a specific port, connecting to the containers on another port | Command:
```bash
kubectl expose deployment ubuntu --port=7000 --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 specifi... |
Use an alternative editor (gedit) to edit the configuration of a service (order-service) | Command:
```bash
KUBE_EDITOR="gedit" kubectl edit svc/order-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,... |
Create a copy of the "proxy-service-pod" pod, adding a debug container and changing the container images to "debian" for the "worker" container and "logging-app:debug" for the "logger" container. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=worker=my-custom-worker:1.2.3,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects ide... |
Check if the current user has permission to list the "database-indexing-job" job in the "staging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n staging
```
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 ... |
Retrieve information about the replication controller with the name "web", the service with the name "vpn-service-rc", and the pod with the name "web-app-pod". | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/web-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced... |
Partially update the 'dev-node-4' node by applying a strategic merge patch provided in JSON format | Command:
```bash
kubectl patch node dev-node-4 -p '{"spec":{"type":"LoadBalancer"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpfu... |
Remove the environment variable 'ENV' from the container 'code-explorer' in all deployment configs | Command:
```bash
kubectl set env deployments --all --containers="code-explorer" ENV-
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates... |
Create an ingress with the name 'rontend-ingress' that routes requests for testing.com/module to the service 'svc1' on port 3001, using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress rontend-ingress --rule="testing.com/module=svc1:3001,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... |
Copy a local file to a remote pod | Command:
```bash
kubectl cp :/tmp/foo velero/security-scanner-pod-18:/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, use... |
Update the pod named 'proxy-server' by removing the annotation named 'description' if it exists | Command:
```bash
kubectl annotate pods proxy-server description-
```
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... |
Copy the local file /tmp/foo to the remote pod backend-pod-13 in the kube-dns namespace, and save it as /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo kube-dns/backend-pod-13:/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 kubectl.ku... |
Open a raw terminal connection to the 'code-explorer' container in the 'mypod' pod. | Command:
```bash
kubectl attach mypod -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 omitted, us... |
Set the custom TLS server name to 'cluster-alpha' for the 'web-cluster' cluster entry | Command:
```bash
kubectl config set-cluster web-cluster --tls-server-name=cluster-alpha
```
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 an ingress called 'service-ingress' with a rule that directs requests from website.com/example to svc1:3000, using a tls secret named "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/example=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": "", "... |
Expose the pods in a replication controller as a service on port 9000 which forwards traffic to the containers on port 500000. | Command:
```bash
kubectl expose rc node --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. A... |
Start streaming the logs of the 'code-explorer' container in the 'proxy-service-pod' pod. | Command:
```bash
kubectl logs -f -c code-explorer proxy-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container... |
Update the label of the pod 'database' with the label 'component' and value 'worker' | Command:
```bash
kubectl label pods database component=worker
```
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", "usag... |
Import the 'api_key' key from the 'ui-config' ConfigMap to the 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/ui-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one o... |
Remove the taint with key 'cpu-type' from the node 'web-node-8' | Command:
```bash
kubectl taint nodes web-node-8 cpu-type-
```
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|n... |
List the replication controller 'web', the service 'frontend-rc', and the pod 'log-aggregator-pod' | Command:
```bash
kubectl get rc/web service/frontend-rc pods/log-aggregator-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 namesp... |
Autoscale the replication controller "proxy-server" with the number of pods ranging from 1 to 2, and set the target CPU utilization to 40%. | Command:
```bash
kubectl autoscale rc proxy-server --max=2 --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... |
Execute the command 'kafka-server-start /etc/kafka/server.properties' in the security-service-pod using the container 'nano-bot' to retrieve the output. | Command:
```bash
kubectl exec security-service-pod -c nano-bot -- kafka-server-start /etc/kafka/server.properties
```
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": ""... |
Create a deployment named 'prometheus' using the 'jenkins' image and expose port 9000 | Command:
```bash
kubectl create deployment prometheus --image=jenkins --port=9000
```
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 ... |
Listen on port 5000 locally and forward the traffic to port 5432 in the backend-pod pod. | Command:
```bash
kubectl port-forward pod/backend-pod 5000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Forward local port 8000 to port 8088 in a pod selected by the deployment named "mydeployment". | Command:
```bash
kubectl port-forward deployment/mydeployment 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 be selecte... |
Add the client certificate data from the "~/.kube/admin.crt" file to the "jane.smith" entry in the kubectl config. | Command:
```bash
kubectl config set-credentials jane.smith --client-certificate=~/.kube/admin.crt --embed-certs=true
```
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:
--client-certificate=certfile --clien... |
Set the cluster field in a specific context to a given value | Command:
```bash
kubectl config set contexts.client-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 you... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-name-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 de... |
Retrieve the logs of the previous terminated "nano-bot" container from the "proxy-server-pod" pod. | Command:
```bash
kubectl logs -p -c nano-bot proxy-server-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", "sh... |
Get the output from running the 'jenkins --version' command in the container named mycontainer from the pod named proxy-server-pod. | Command:
```bash
kubectl exec proxy-server-pod -c mycontainer -- jenkins --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 ... |
Forward local port 8888 to port 8088 in the specified pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8888:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Attach to a pod and open a raw terminal mode | Command:
```bash
kubectl attach email-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... |
Execute the 'redis-cli' command inside the 'monitoring-pod' pod and display the output | Command:
```bash
kubectl exec monitoring-pod -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.... |
Forward local port 8088 to the targetPort of the "https" port in the search-service service, which is targeting a pod. | Command:
```bash
kubectl port-forward service/search-service 8088:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selecte... |
Start a pod named 'hazelcast' with the 'postgres' image and have the container expose port 3001 | Command:
```bash
kubectl run hazelcast --image=postgres --port=3001
```
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 service for the replication controller specified in "ruby-controller.yaml" which serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8000 --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 spe... |
Auto scale the replication controller "proxy-server" based on CPU utilization, with the number of pods ranging from 1 to 8 and a target CPU utilization of 60%. | Command:
```bash
kubectl autoscale rc proxy-server --max=8 --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... |
Listen on port 5432 on localhost and IP 10.19.21.23, and forward the traffic to port 8088 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 5432:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the crite... |
Retrieve the logs from the container named backend-microservice-deployment-1 in the deployment backend-microservice-deployment. | Command:
```bash
kubectl logs deployment/backend-microservice-deployment -c mypod-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:
"fla... |
Get the output from running the 'mongo' command in the 'nano-bot' container of the 'analytics-pod' pod. | Command:
```bash
kubectl exec analytics-pod -c nano-bot -- mongo
```
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 k... |
Create an ingress resource called 'website-ingress' with a rule that directs requests from foo.com/example to svc1:8181 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="foo.com/example=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": "", "usag... |
Update the image version (tag) of a single-container pod to v4. | Command:
```bash
kubectl get pod security-service-pod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtain... |
Create an ingress resource called 'external-ingress' that directs requests to "site.com/bar" to the service "svc1:9091" with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/bar=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Create a deployment named grafana running the alpine image | Command:
```bash
kubectl create deployment grafana --image=alpine
```
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|na... |
Create an ingress resource named "api-ingress" with a rule that directs requests for "website.com/module" to the service "svc1:5001", and use the TLS secret "my-cert". | Command:
```bash
kubectl create ingress api-ingress --rule="website.com/module=svc1:5001,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... |
Add a taint with the key 'disktype' and value 'testing-node-11:PreferNoSchedule' on nodes that have the label 'team=devops'. | Command:
```bash
kubectl taint node -l team=devops disktype=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Forward local port 5000 to port 8088 in the pod "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 5000: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... |
Return the snapshot logs from container 'proxy-server-pod-1' of the 'search-engine-deployment' deployment. | Command:
```bash
kubectl logs deployment/search-engine-deployment -c proxy-server-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:
... |
Forward traffic from local port 5000 to port 5000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward 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 criteria, a pod will be selected auto... |
Create a pod disruption budget named payment-gateway-pdb that selects all pods with the region=us-east label and requires a minimum of one pod to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=region=us-east --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-availab... |
Copy the file "/tmp/foo" from the pod "worker-pod-4" in the "ingress-nginx" namespace to the local directory "/etc/kubernetes". | Command:
```bash
kubectl cp ingress-nginx/worker-pod-4:/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, use the ... |
Set the cluster field in a specific context to a given cluster name | Command:
```bash
kubectl config set contexts.client-1-context.cluster sun-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 ... |
Update the image of all containers in the 'prod' DaemonSet to 'nginx:1.21.3' | Command:
```bash
kubectl set image daemonset prod *=nginx:1.21.3
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kubect... |
Create a NodePort service named auth-service-nodeport with a mapping from port 9092 on the host to port 8089 on the service. | Command:
```bash
kubectl create service nodeport auth-service-nodeport --tcp=9092:8089
```
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"... |
Remove all the taints with key 'hardware' from node 'worker-node-3' | Command:
```bash
kubectl taint nodes worker-node-3 hardware-
```
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|yam... |
Run the 'redis-cli' command from the 'nano-bot' container in the 'email-service-pod' pod and get the output. | Command:
```bash
kubectl exec email-service-pod -c nano-bot -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Add a taint with key 'datacenter' on nodes having label tier=frontend | Command:
```bash
kubectl taint node -l tier=frontend 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": "", "usa... |
Embed the certificate authority data for the star-cluster cluster entry | Command:
```bash
kubectl config set-cluster star-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 set-... |
Forward port 6379 on localhost and IP 10.19.21.23 to port 8888 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 6379: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 cri... |
Scale the replica set named 'backend-service-replicaset' to have just 1 replica | Command:
```bash
kubectl scale --replicas=1 rs/backend-service-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified,... |
Import specific keys from a config map to your deployment's environment variables | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/ui-config 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 defin... |
Create a new NodePort service named proxy-server-nodeport that exposes port 9091 on all nodes and forwards traffic to port 5001 on the pods | Command:
```bash
kubectl create service nodeport proxy-server-nodeport --tcp=9091:5001
```
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"... |
Auto scale a replication controller named "media-stream" by setting the minimum number of pods to 1 and the maximum number of pods to 4 | Command:
```bash
kubectl autoscale rc media-stream --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... |
Create a deployment named logging with 3 replicas, running the mongo image. | Command:
```bash
kubectl create deployment logging --image=mongo --replicas=3
```
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: ... |
Create a debug container named my-debugger that is an exact copy of database-pod, but with all container images changed to python. | Command:
```bash
kubectl debug database-pod --copy-to=my-debugger --set-image=*=python
```
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 resourc... |
Set the CPU and memory resource limits and requests for all containers in the 'hazelcast' deployment | Command:
```bash
kubectl set resources deployment hazelcast --limits=cpu=200m,memory=512Mi --requests=cpu=1,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource request... |
Add the certificate authority data for the 'galaxy-cluster' cluster entry by running the command 'kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/testing-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/testing-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 confi... |
Create a deployment named "auth" using the "centos" image and expose port 5432 | Command:
```bash
kubectl create deployment auth --image=centos --port=5432
```
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: jso... |
Forward local port 6379 to port 8081 in the mypod pod | Command:
```bash
kubectl port-forward pod/mypod 6379:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Copy the directory /tmp/foo_dir from the openfaas/load-balancer-pod-9 pod to the local directory /tmp/bar. | Command:
```bash
kubectl cp openfaas/load-balancer-pod-9:/tmp/foo_dir :/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 ... |
Add a taint on nodes with label team=devops | Command:
```bash
kubectl taint node -l team=devops special=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": "", "usage": "Out... |
Create an ingress called 'api-v1-ingress' that directs requests for site.com/module to svc1:3000 with the tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="site.com/module=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... |
Set the cluster field of the my-context context to sun-cluster | Command:
```bash
kubectl config set contexts.staging-context.cluster sun-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... |
Create a service for the replication controller specified in "php-controller.yaml" file | Command:
```bash
kubectl expose -f php-controller.yaml --port=9091 --target-port=808400
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the sp... |
Create a new NodePort service named analytics-nodeport, and map port 8088 on the service to port 8000 on the node. | Command:
```bash
kubectl create service nodeport analytics-nodeport --tcp=8000:8088
```
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": "... |
Scale the 'mysql' deployment to 7 replicas, only if the current size of the 'dev-environment-rs' deployment is 5. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=7 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-... |
Set the cluster field in the my-context context to cloud-cluster | Command:
```bash
kubectl config set contexts.service-account-context.cluster cloud-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 v... |
Create a secret named tls-certificate-secret by reading the values from a file at the given path | Command:
```bash
kubectl create secret generic tls-certificate-secret --from-env-file=path/to/parameters.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... |
Create an ingress named 'myapp-ingress' that routes requests from 'website.com/module' to the service 'svc1' on port 8082 | Command:
```bash
kubectl create ingress myapp-ingress --rule="website.com/module=svc1:8082,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Update the label of a pod named 'email' to 'release=v2.0' | Command:
```bash
kubectl label pods email 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... |
Delete the pods and services with the names "log-aggregator" and "log-aggregator" | Command:
```bash
kubectl delete pod,service log-aggregator log-aggregator
```
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 l... |
Set the resource request and limits for all containers in the wordpress deployment to limit the CPU to 200 milliCPU and memory to 512Mi, and request a minimum of 500 milliCPU and 4Gi of memory. | Command:
```bash
kubectl set resources deployment wordpress --limits=cpu=200m,memory=512Mi --requests=cpu=500m,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 requ... |
Create an autoscaler for the 'cdn' replication controller with a maximum of 3 pods and a target CPU utilization of 60% | Command:
```bash
kubectl autoscale rc cdn --max=3 --cpu-percent=60
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Get the output from running the 'kafka-topics --list' command in the container named 'mycontainer' from the pod named 'chat-app-pod'. | Command:
```bash
kubectl exec chat-app-pod -c mycontainer -- kafka-topics --list
```
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 om... |
Create a cluster role named "custom_role" with a specified non-resource URL | Command:
```bash
kubectl create clusterrole "custom_role" --verb=connect --non-resource-url=/port-forward
```
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": "--ou... |
Create a new ClusterIP service named messaging-service-clusterip | Command:
```bash
kubectl create service clusterip messaging-service-clusterip --tcp=8082:6379
```
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 local file /tmp/foo_dir to the remote pod named task-processor-pod-17 and place it at /tmp/bar in the specified container named admin-dashboard. | Command:
```bash
kubectl cp /tmp/foo_dir task-processor-pod-17:/tmp/bar -c admin-dashboard
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Run the 'python' command in the stardust-shuttle container of the security-service-pod and get the output. | Command:
```bash
kubectl exec security-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 om... |
Create an ingress with multiple hosts and the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:8081" \
--rule="input.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": "--output", "... |
Add a taint with the key 'datacenter' and value 'edge-node-10:PreferNoSchedule' on nodes having the label 'role=database'. | Command:
```bash
kubectl taint node -l role=database datacenter=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Run the 'jenkins-plugin-cli' command inside the e-commerce-pod and retrieve the output | Command:
```bash
kubectl exec e-commerce-pod -- jenkins-plugin-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
List the deployments in the "v1.1.0" version of the "backup-apps" API group in YAML output format | Command:
```bash
kubectl get deployments.v1.1.0.backup-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 wil... |
Import the "log_level" key from the "env-vars" config map and set it as an environment variable for the "cache-cluster-deployment" deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/env-vars deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Forward data between port 8888 on your local machine and port 3000 in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8888 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... |
Expose a replication controller as a service with specified ports | Command:
```bash
kubectl expose -f php-controller.yaml --port=8084 --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 sp... |
Update the pod 'web' with the annotation 'deployment-script' and the value 'https://example.com/deploy.sh' | Command:
```bash
kubectl annotate pods web deployment-script='https://example.com/deploy.sh'
```
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 lab... |
Run the command 'java -jar /usr/share/jenkins/jenkins.war' inside the pod named security-service-pod and get the output | Command:
```bash
kubectl exec security-service-pod -- java -jar /usr/share/jenkins/jenkins.war
```
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": "Contain... |
Set the annotation 'criticality' with the value 'high' for the pod named 'api' | Command:
```bash
kubectl annotate pods api criticality=high
```
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 ... |
Create a pod named 'hazelcast' using the 'confluentinc/cp-kafka' image and expose port 9000 from the container. | Command:
```bash
kubectl run hazelcast --image=confluentinc/cp-kafka --port=9000
```
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 flag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.