prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --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 definit... |
Create a priority class with a medium-priority value, description, and resource allocation | Command:
```bash
kubectl create priorityclass medium-priority --value=50 --description="Moderate, standard resource allocation"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry... |
Create an ingress called 'external-ingress' that directs requests to site.com/bar to svc1:3306 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/bar=svc1:3306,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"... |
import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/monitoring-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Create an ingress named 'private-service-ingress' with a rule that directs requests to 'testing.com/module' to 'svc1:9000' using the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress private-service-ingress --rule="testing.com/module=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"... |
Forward local port 5432 to port 6379 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 5432:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
View the snapshot logs from the container monitoring-stack-deployment-1 in the deployment named auth-service-pod. | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c auth-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 flag... |
Set custom TLS server name for cluster my-k8s-cluster | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=sun-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] [--certificat... |
Get the output from running the 'mongo' command in the cyber-sleuth container from the email-service-pod pod. | Command:
```bash
kubectl exec email-service-pod -c cyber-sleuth -- 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, u... |
Execute the 'go version' command in the code-explorer container of the cdn-service-pod and get the output. | Command:
```bash
kubectl exec cdn-service-pod -c code-explorer -- 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 omitte... |
Create a cron job that runs a command to install aws-cli on an Amazon Linux image every minute. | Command:
```bash
kubectl create cronjob log-rotation --image=amazonlinux --schedule="*/1 * * * *" -- yum install -y aws-cli
```
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... |
Import specific keys from a config map to the deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Add a taint to nodes with a specific label | Command:
```bash
kubectl taint node -l myLabel 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": "Output... |
Import specific keys from a config map and set them as environment variables for a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/db-config deployment/monitoring-stack-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... |
Start a pod named hazelcast using the node image and expose port 3000 | Command:
```bash
kubectl run hazelcast --image=node --port=3000
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fil... |
Set a custom TLS server name for the sun-cluster cluster entry. | Command:
```bash
kubectl config set-cluster sun-cluster --tls-server-name=kube-cluster-1
```
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] [--certificat... |
Create a priority class named "urgent-priority" with a value of 100000, a description of "Immediate, urgent resource allocation", and a preemption policy of "Never". | Command:
```bash
kubectl create priorityclass urgent-priority --value=100000 --description="Immediate, urgent resource allocation" --preemption-policy="Never"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VAL... |
Create an ingress called 'external-ingress' with a rule that directs requests from testing.com/input to svc1:8084 | Command:
```bash
kubectl create ingress external-ingress --rule="testing.com/input=svc1:8084,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 'datacenter', value 'dc-1', and effect 'NoExecute' to the node 'web-node-8' | Command:
```bash
kubectl taint nodes web-node-8 datacenter=dc-1:NoExecute
```
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... |
Set the custom TLS server name to 'my-k8s-cluster' for the 'e2e' cluster entry. | Command:
```bash
kubectl config set-cluster e2e --tls-server-name=my-k8s-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-author... |
Wait for the deletion of the "monitoring-pod" pod with a timeout of 60 seconds after executing the delete command. | Command:
```bash
kubectl delete pod/monitoring-pod
kubectl wait --for=delete pod/busybox1 --timeout=60s
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resourc... |
Copy the directory /tmp/foo_dir from the load-balancer-pod-9 pod in the logging namespace to the /etc/kubernetes directory locally. | Command:
```bash
kubectl cp logging/load-balancer-pod-9:/tmp/foo_dir /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Get the output of running the 'node --version' command inside the 'stardust-shuttle' container within the 'proxy-service-pod' pod. | Command:
```bash
kubectl exec proxy-service-pod -c stardust-shuttle -- node --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. ... |
Forward local traffic on port 3000 to a pod selected by the deployment named "email-server-deployment" on port 3000. | Command:
```bash
kubectl port-forward deployment/email-server-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 will... |
Set the resource request and limits for all containers in the nginx deployment | Command:
```bash
kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=1,memory=1Gi
```
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, ... |
Set the annotation 'custom-label' with the value 'my-custom-value' for the pod 'payment'. | Command:
```bash
kubectl annotate pods payment custom-label=my-custom-value
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include a... |
Start a new pod named 'hazelcast' using the 'ruby' image and have the container expose port 9000. | Command:
```bash
kubectl run hazelcast --image=ruby --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 flags:
"flag": "--fil... |
Add the annotation "SLA='99.9% uptime'" to the pod identified by the type and name in the "docker-registry.yaml" file. | Command:
```bash
kubectl annotate -f docker-registry.yaml SLA='99.9% uptime'
```
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 ... |
Create a pod named 'hazelcast' using the 'redis' image and expose port 6379 | Command:
```bash
kubectl run hazelcast --image=redis --port=6379
```
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... |
Import the keys 'CONFIG_FILE_PATH' from the 'kube-system-config' config map into the 'user-management-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/kube-system-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 var... |
Create a new config map named api-config with specified keys instead of file base names on disk | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/configs/file1.txt --from-file=key1=/path/to/settings/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 ... |
Create a new LoadBalancer service named ingress-controller-lb with a TCP port mapping from 5001 to 8000. | Command:
```bash
kubectl create service loadbalancer ingress-controller-lb --tcp=5001:8000
```
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 called 'app-gateway-ingress' with a rule that directs requests from "website.com/example" to the service "svc1" on port 5000 | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.com/example=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": "... |
Create a service for a replicated Ruby application, serving on port 9090 and connecting to the containers on port 637900 | Command:
```bash
kubectl expose rc ruby --port=9090 --target-port=637900
```
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... |
Execute the 'go' command inside the first container of the first pod of the 'web-service' service and get the output. | Command:
```bash
kubectl exec svc/web-service -- go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kubern... |
Update the 'app-node-6' node by changing the 'password' field to 'new-password' using a strategic merge patch in YAML format. | Command:
```bash
kubectl patch node app-node-6 -p $'stringData:\n password: new-password'
```
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]`
... |
Start streaming the logs of the time-machine container in the payment-gateway-pod pod. | Command:
```bash
kubectl logs -f -c time-machine payment-gateway-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": "--containe... |
Attach and view the output of the nano-bot container in the log-aggregator-pod | Command:
```bash
kubectl attach log-aggregator-pod -c nano-bot
```
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, ... |
Retrieve snapshot logs from the container "mypod" in the deployment "proxy-service-deployment-1" | Command:
```bash
kubectl logs deployment/proxy-service-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:
"flag": "--... |
Display the resource utilization metrics for all pods in the 'external-logging-service' namespace | Command:
```bash
kubectl top pod --namespace=external-logging-service
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubec... |
Import the 'my-example-key' key from the 'app-secrets' config map into the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-secrets deployment/email-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 defini... |
Get the output from running the 'mongod' command in the proxy-server-pod using the first container. | Command:
```bash
kubectl exec proxy-server-pod -- mongod
```
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.k... |
Create a deployment named wordpress using the redis image and expose port 8181 | Command:
```bash
kubectl create deployment wordpress --image=redis --port=8181
```
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:... |
Taint the node 'kube-master-9' with a key 'hardware' and no value | Command:
```bash
kubectl taint nodes kube-master-9 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. One of... |
Forward local traffic from port 8080 to port 5432 in the pod selected by the notification-handler-deployment deployment. | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 8080 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 ... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/tls-certificate-secret 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 definitions in one... |
Forward local port 8081 to port 5000 in the 'mypod' pod | Command:
```bash
kubectl port-forward pod/mypod 8081:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config deployment/frontend-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 local port 8888 to port 8081 in the pod "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 8888: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 select... |
Execute the command 'java -jar /usr/share/jenkins/jenkins.war' in the 'stardust-shuttle' container of the 'e-commerce-pod' pod and retrieve the output. | Command:
```bash
kubectl exec e-commerce-pod -c stardust-shuttle -- 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": "", "us... |
Add a taint with key 'cpu-type' and value 'app-node-6:PreferNoSchedule' to all nodes with the label 'owner=john-doe' | Command:
```bash
kubectl taint node -l owner=john-doe cpu-type=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": "", "usage": "... |
Forward port 8081 in the 'log-aggregator-pod' pod to a random port locally | Command:
```bash
kubectl port-forward pod/log-aggregator-pod :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 aut... |
Update the 'spec.replicas' field of the 'monitoring-node-15' node to 3 using a strategic merge patch. | Command:
```bash
kubectl patch node monitoring-node-15 -p $'spec:\n replicas: 3'
```
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 f... |
Create an ingress called 'web-ingress' that directs requests to foo.com/module to a service named svc1 on port 9092 using the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress web-ingress --rule="foo.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": "", "usage": "... |
Import specific keys from a config map in a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-config-prod 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 variabl... |
Execute the 'redis-cli' command inside the 'cosmic-container' container in the 'analytics-pod' pod and get the output. | Command:
```bash
kubectl exec analytics-pod -c cosmic-container -- 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 omitte... |
Start an alpine pod with specific spec values from a JSON override | Command:
```bash
kubectl run nginx --image=alpine --overrides='{ "apiVersion": "v1.0.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] [--command] -- [COMMAN... |
Update the 'monitoring-node-15' node by applying a strategic merge patch provided as YAML, which specifies the addition of a new rule to the HTTP paths | Command:
```bash
kubectl patch node monitoring-node-15 -p $'spec:\n rules:\n- http:\n paths:\n - path: /\n backend:\n service:\n name: new-service'
```
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 accept... |
Create a copy of the 'media-stream-pod' pod by adding a debug container and changing container images to 'debian' and 'my-custom-worker:1.2.3' respectively | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-1 --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 objects... |
Create an ingress called 'web-ingress' with a rule that directs requests from site.com/input to svc1:8080 | Command:
```bash
kubectl create ingress web-ingress --rule="site.com/input=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": "", "usage": "... |
Create a cluster role named "admin_role" with specified resource names and verbs | Command:
```bash
kubectl create clusterrole admin_role --verb=watch --resource=configmaps --resource-name=mail-server --resource-name=mail-server
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cli... |
Run the 'kafka-topics --list' command inside the astro-container in the media-stream-pod and display the output. | Command:
```bash
kubectl exec media-stream-pod -c astro-container -- 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 nam... |
Add a taint with the key 'special' on nodes that have the label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops special=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": "... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=log_level --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 definit... |
Execute the 'postgres' command inside the 'e-commerce-pod' pod and retrieve the output. | Command:
```bash
kubectl exec e-commerce-pod -- postgres
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.k... |
Forward the local port 3000 to port 8888 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 3000:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Copy the local file "/tmp/foo" to the remote pod "kube-flannel/auth-service-pod-11" at the destination path "/tmp/bar" | Command:
```bash
kubectl cp /tmp/foo kube-flannel/auth-service-pod-11::/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
import the CONFIG_FILE_PATH key from the app-settings ConfigMap and apply it to the search-engine-deployment deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-settings 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 de... |
Create a ClusterIP service named 'catalog-service-clusterip' that maps port 6379 to port 8082. | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=6379:8082
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Start a golang pod using a custom command and arguments | Command:
```bash
kubectl run nginx --image=golang --command -- <cmd> <arg1> ... <argN>
```
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...]`
Helpfu... |
Scale the 'mysql' deployment in 'dev-environment-rs' to 3 replicas | Command:
```bash
kubectl scale --current-replicas=1 --replicas=3 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-... |
Add a taint with key 'disktype' on nodes having label environment=production | Command:
```bash
kubectl taint node -l environment=production disktype=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": "", "... |
Scale the mysql deployment to 7 replicas if the current size of the db-migration-replicaset deployment is also 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/db-migration-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 --reso... |
List the replication controllers, services, and pods by their names. | Command:
```bash
kubectl get rc/web service/email-service-rc pods/api-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 name... |
delete the pods and services with the names "web" and "web" | Command:
```bash
kubectl delete pod,service web web
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
Some re... |
Create a deployment with the given name and image, and expose a specified port. | Command:
```bash
kubectl create deployment nats --image=ubuntu --port=3001
```
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... |
Get the output from running the 'bash' command in the lunar-launcher container from the media-stream-pod pod | Command:
```bash
kubectl exec media-stream-pod -c lunar-launcher -- bash
```
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... |
List a pod identified by type and name specified in "parameters.yaml" in JSON output format | Command:
```bash
kubectl get -f parameters.yaml -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see r... |
attach to a specific container in a pod and get its output | Command:
```bash
kubectl attach chat-app-pod -c cosmic-container
```
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... |
Deny a Certificate Signing Request (CSR) for 'csr-node-2' | Command:
```bash
kubectl certificate deny csr-node-2
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kubectl ce... |
Create a single ingress called 'api-v1-ingress' that directs requests to testing.com/bar to the service 'svc1' with port 5000, and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress api-v1-ingress --rule="testing.com/bar=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": "", "usage... |
Retrieve a list of deployments in JSON output format, specifically in the "dev-2.2.0" version of the "alpha-apps" API group. | Command:
```bash
kubectl get deployments.dev-2.2.0.alpha-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you w... |
Forward port 3000 on all addresses to port 5000 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-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 pod w... |
List the replication controller named "media-stream-rc" in the ps output format | Command:
```bash
kubectl get replicationcontroller media-stream-rc
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will... |
Forward local port 6379 to port 5000 in the pod named cdn-service-pod, with the address set to listen on both localhost and 10.19.21.23 | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 6379: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 cri... |
Automatically scale the replication controller "proxy" to have a maximum of 2 pods and maintain a target CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc proxy --max=2 --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 t... |
Delete the pods and services named "monitoring" and "media-stream" | Command:
```bash
kubectl delete pod,service monitoring media-stream
```
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 s... |
import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/monitoring-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 variab... |
Copy a file or directory from a remote pod to a local directory | Command:
```bash
kubectl cp monitoring/front-end-pod-12:/tmp/foo /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": "Container name. If omitted, use the ku... |
List deployments in the "custom-version" version of the "web-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.custom-version.web-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced yo... |
Create an ingress called 'service-ingress' with a rule that directs requests for testing.com/bar to svc1:8083 | Command:
```bash
kubectl create ingress service-ingress --rule="testing.com/bar=svc1:8083,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 of all containers in the daemonset "namespace-1" to "python:3.9.7". | Command:
```bash
kubectl set image daemonset namespace-1 *=python:3.9.7
```
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:
... |
Create a new secret named private-key-secret with keys for each file in the specified folder. | Command:
```bash
kubectl create secret generic private-key-secret --from-file=path/to/parameters
```
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 basenam... |
Set the resource request and limits for all containers in the 'hazelcast' deployment | Command:
```bash
kubectl set resources deployment hazelcast --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=1Gi
```
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 a new secret named 'ldap-credentials-secret' using the environment variables in the 'path/to/options.env' file | Command:
```bash
kubectl create secret generic ldap-credentials-secret --from-env-file=path/to/options.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to t... |
Copy the file "/tmp/foo" from the remote pod "cache-pod-5" to the local directory "/tmp/bar_dir" | Command:
```bash
kubectl cp ingress-nginx/cache-pod-5:/tmp/foo /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": "Container name. If omitted, use the kube... |
Retrieve the output from running the 'elasticsearch' command in the nebula-navigator container from the pod named mypod. | Command:
```bash
kubectl exec mypod -c nebula-navigator -- elasticsearch
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/db-config deployment/authentication-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 de... |
Create a new config map named "app-secrets" with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-secrets --from-file=properties=/path/to/properties/file1.txt --from-file=key1=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creatin... |
Create a new config map named "app-config" from the key=value pairs in the file located at "path/to/properties" | Command:
```bash
kubectl create configmap app-config --from-file=path/to/properties
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basename... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.