prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Automatically scale the replication controller named "foo" with the number of pods ranging from 1 to 6, targeting a CPU utilization of 81%. | Command:
```bash
kubectl autoscale rc foo --max=6 --cpu-percent=81
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Create a pod running the MySQL image and set labels "app=mysql" and "env=prod" on the container | Command:
```bash
kubectl run hazelcast --image=mysql --labels="app=mysql,env=prod"
```
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 fl... |
Import the environment variable "api-secret-key" from the secret resource into the "analytics-platform-deployment" deployment. | Command:
```bash
kubectl set env --from=secret/api-secret-key deployment/analytics-platform-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 or ... |
Forward traffic from port 5000 on all addresses to port 6379 in the e-commerce-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-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 wi... |
Create a copy of the 'e-commerce-pod' pod and open an interactive shell in the 'nebula-navigator' container for debugging | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=my-debugger --container=nebula-navigator -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by d... |
Import the 'DEBUG_MODE' key from the 'ui-config' config map to the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/ui-config deployment/analytics-platform-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... |
List deployments in YAML output format in the "alpha-2.0" version of the "mobile-apps" API group | Command:
```bash
kubectl get deployments.alpha-2.0.mobile-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 ... |
import the DATABASE_URL key from the log-config ConfigMap and set it as an environment variable in the payment-processor-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/log-config 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 variable defi... |
Create a cluster role named "custom_role" with the ability to use services, specifically the resource names "database-master" and "content-delivery" | Command:
```bash
kubectl create clusterrole custom_role --verb=use --resource=services --resource-name=database-master --resource-name=content-delivery
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=serv... |
Import specific keys from a config map: | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/db-config 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 defin... |
Start a Jenkins pod named "hazelcast" using the Jenkins image and expose port 8083 for the container. | Command:
```bash
kubectl run hazelcast --image=jenkins --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": "--... |
Create a priority class called 'internal-priority' with a value of 6, a description of "Priority for internal services and tasks", and a preemption policy of "Never". | Command:
```bash
kubectl create priorityclass internal-priority --value=6 --description="Priority for internal services and tasks" --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... |
Execute the 'ruby --version' command within the auth-service-pod pod and display the output. | Command:
```bash
kubectl exec auth-service-pod -- ruby --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
Update the 'email' pod by adding the annotation 'app-version' with the value of 2.5.1 | Command:
```bash
kubectl annotate pods email app-version=2.5.1
```
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 stri... |
Import the 'LOG_LEVEL' key from the 'app-settings' config map into the 'scheduler-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-settings 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 definitio... |
Create a service for a replicated alpine using replica set, which serves on port 8082 and connects to the containers on port 844300 | Command:
```bash
kubectl expose rs alpine --port=8082 --target-port=844300
```
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.... |
Remove all taints with key 'environment' from the 'backup-node-14' node | Command:
```bash
kubectl taint nodes backup-node-14 environment-
```
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... |
Get the output from running the 'mysql' command in the 'time-machine' container of the 'backend-pod' pod | Command:
```bash
kubectl exec backend-pod -c time-machine -- mysql
```
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... |
Listen on all addresses and forward incoming traffic on port 9090 to port 8888 inside the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 9090: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 ... |
Get the output from running the 'mongo --version' command in the first container of the 'chat-app-pod' pod. | Command:
```bash
kubectl exec chat-app-pod -- mongo --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kube... |
Update a node by applying a strategic merge patch in YAML format | Command:
```bash
kubectl patch node node-1 -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 accepted.
Syntax:... |
Create a new ClusterIP service named analytics-service-clusterip, mapping TCP port 9090 on the service to port 9091 on the target | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=9090: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": "-... |
Auto scale the replication controller "foo" with the number of pods between 1 and 3, targeting a CPU utilization of 60%. | Command:
```bash
kubectl autoscale rc foo --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... |
Apply a taint with the key 'dedicated' on nodes that have the label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack dedicated=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Update the pod specified in the "parameters.json" file by adding the annotation "alert-email" with the value "alerts@example.com" | Command:
```bash
kubectl annotate -f parameters.json alert-email=alerts@example.com
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and i... |
Create a new NodePort service named security-service-nodeport with the TCP port 8082 mapped to port 8082 | Command:
```bash
kubectl create service nodeport security-service-nodeport --tcp=8082:8082
```
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", "defa... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-name-config deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variab... |
Update the pod with the name 'gateway' by adding an annotation 'custom-label' with the value 'my-custom-value' | Command:
```bash
kubectl annotate pods gateway 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... |
Update the environment variable SMTP_USERNAME for the deployment cache-cluster-deployment. | Command:
```bash
kubectl set env deployment/cache-cluster-deployment SMTP_USERNAME=your-username
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more p... |
Execute the command 'kafka-server-start /etc/kafka/server.properties' in the stardust-shuttle container of the database-pod pod and print the output. | Command:
```bash
kubectl exec database-pod -c stardust-shuttle -- 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 pod disruption budget named monitoring-pdb that requires at least one pod with the release=1.0.0 label to be available at all times. | Command:
```bash
kubectl create poddisruptionbudget monitoring-pdb --selector=release=1.0.0 --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 [... |
Add a taint to the nodes with the label 'namespace=mynamespace' with the key 'zone' and the value 'app-node-6' and mark it as 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l namespace=mynamespace zone=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"... |
Create an ingress resource named 'public-service-ingress' with a rule that directs requests to testing.com/example to the service named 'svc1' on port 8443 | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/example=svc1:8443,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 CPU and memory limits to 200m and 512Mi respectively, and the CPU and memory requests to 500m and 2Gi respectively, for all containers in the deployment called 'ubuntu'. | Command:
```bash
kubectl set resources deployment ubuntu --limits=cpu=200m,memory=512Mi --requests=cpu=500m,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 request... |
Create a cron job named "email-notifications" that runs the command "nginx -t" every minute | Command:
```bash
kubectl create cronjob email-notifications --image=nginx --schedule="*/1 * * * *" -- nginx -t
```
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": "... |
Create a pod disruption budget named cron-jobs-pdb that will select all pods with the env=production label and require a minimum of 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=env=production --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [... |
Begin streaming the logs of the nano-bot container in the backend-pod pod | Command:
```bash
kubectl logs -f -c nano-bot backend-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":... |
Check if you have permission to list the "backup-job" in the "production" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/backup-job -n production
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/global-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... |
Copy the file /var/run/secrets/kubernetes.io/serviceaccount/ from your local machine to the directory /tmp/bar in the pod with the name image-resizer-pod-20 in the kube-node-lease namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kube-node-lease/image-resizer-pod-20::/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": "", "usa... |
Open the 'loadbalancer-service' service for editing using the 'gedit' editor | Command:
```bash
KUBE_EDITOR="gedit" kubectl edit svc/loadbalancer-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 var... |
Deny a certificate signing request (CSR) for 'csr-webserver-1' | Command:
```bash
kubectl certificate deny csr-webserver-1
```
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:
`kubec... |
Create a new config map named api-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/preferences/file1.txt --from-file=key2=/path/to/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... |
Import the `CONFIG_FILE_PATH` key from the `global-config` config map into the `api-server-deployment` deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/global-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Create a debugging session for the proxy-server-pod, making a copy of it with the name my-custom-dbg and changing all container images to docker.elastic.co/elasticsearch/elasticsearch | Command:
```bash
kubectl debug proxy-server-pod --copy-to=my-custom-dbg --set-image=*=docker.elastic.co/elasticsearch/elasticsearch
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and nam... |
Configure autoscaling for the 'frontend' deployment with a minimum of 2 pods and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment frontend --min=2 --max=10
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
Start a MySQL pod and expose container port 5001 | Command:
```bash
kubectl run hazelcast --image=mysql --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... |
Create a new cluster role named "custom_role" with the verb "watch" and the NonResourceURL "/exec/*". | Command:
```bash
kubectl create clusterrole "custom_role" --verb=watch --non-resource-url=/exec/*
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "... |
Switch to raw terminal mode and attach to the vpn-service-pod with the lunar-launcher container. | Command:
```bash
kubectl attach vpn-service-pod -c lunar-launcher -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 ... |
Create an ingress with TLS enabled and multiple path types | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="foo.com/=svc:https,tls" \
--rule="site.com/path/subpath*=othersvc:9000"
```
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": "--ou... |
Create a role named "foo" with ResourceName specified | Command:
```bash
kubectl create role foo --verb=use --resource=pods --resource-name=dashboard-ui --resource-name=staging-app-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|cli... |
Create an ingress named "website-ingress" that routes requests from "website.com/bar" to "svc1:8082" using the TLS secret "my-cert". | Command:
```bash
kubectl create ingress website-ingress --rule="website.com/bar=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": "", "usag... |
Set the service account of the deployment "mydeployment" to "cert-manager" | Command:
```bash
kubectl set serviceaccount deployment mydeployment cert-manager
```
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 set... |
Create a copy of the backend-pod and change all container images to "hazelcast/hazelcast" | Command:
```bash
kubectl debug backend-pod --copy-to=debug-image-web --set-image=*=hazelcast/hazelcast
```
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 defau... |
Create a copy of gateway-pod with a debug container and changed container images | Command:
```bash
kubectl debug gateway-pod -it --copy-to=debug-image-web --image=debian --set-image=web=nginx:latest,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and n... |
Create a new config map named app-config-prod using the environment variables specified in the data.env file. | Command:
```bash
kubectl create configmap app-config-prod --from-env-file=path/to/data.env
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the b... |
Output the modified deployment for the search-engine-deployment with the updated QUEUE_NAME=task-queue environment variable in YAML format, without making any changes to the object on the server. | Command:
```bash
kubectl set env deployment/search-engine-deployment QUEUE_NAME=task-queue -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... |
Start a new pod named "hazelcast" with the CentOS image and expose port 3000 in the container. | Command:
```bash
kubectl run hazelcast --image=centos --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": "--f... |
Get the output of the 'elasticsearch --version' command from the nebula-navigator container in the mypod pod | Command:
```bash
kubectl exec mypod -c nebula-navigator -- elasticsearch --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 ... |
Start streaming the logs of the 'cosmic-container' container in the 'database-pod' pod | Command:
```bash
kubectl logs -f -c cosmic-container database-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container",... |
Set the service account of the 'search-engine-deployment' deployment to 'flux' | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment flux
```
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... |
Create a service for the replication controller specified in "alpine-controller.yaml", serving on port 5001 and connecting to the containers on port 808100 | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=5001 --target-port=808100
```
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... |
Update the storage-node-13 node by adding a taint with the key 'workload', the value 'high-priority', and the effect 'NoSchedule'. | Command:
```bash
kubectl taint nodes storage-node-13 workload=high-priority: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": "Outpu... |
Forward traffic from port 6379 on all addresses to port 5000 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-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 criteria, a pod will... |
Import the 'log_level' key from the 'app-config-prod' ConfigMap and set it as an environment variable in the 'backend-microservice-deployment' deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-config-prod deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Edit the frontend-service service using the micro text editor instead of the default editor. | Command:
```bash
KUBE_EDITOR="micro" kubectl edit svc/frontend-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 variabl... |
Copy the local file `/tmp/foo` to the remote pod `file-server-pod-14` in the container `worker-container`, and save it as `/tmp/bar`. | Command:
```bash
kubectl cp :/tmp/foo file-server-pod-14::/tmp/bar -c worker-container
```
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, u... |
Set the custom TLS server name to use for validation for the "data-cluster" cluster entry | Command:
```bash
kubectl config set-cluster data-cluster --tls-server-name=edge-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... |
Describe all pods with the label "project=project-alpha" | Command:
```bash
kubectl describe po -l project=project-alpha
```
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,... |
Create a new ConfigMap named "ui-config" and populate it with key-value pairs based on the files located in the "path/to/configurations" folder. | Command:
```bash
kubectl create configmap ui-config --from-file=path/to/configurations
```
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 basen... |
Check if you have permission to list the job named "load-testing-job" in the "staging" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/load-testing-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 URL t... |
Add a taint with key 'dedicated' on nodes having label customer=acme-corp and value worker-node-3, with the effect PreferNoSchedule | Command:
```bash
kubectl taint node -l customer=acme-corp dedicated=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Auto scale the replication controller "monitoring" with a target CPU utilization of 81% and maximum of 8 pods. | Command:
```bash
kubectl autoscale rc monitoring --max=8 --cpu-percent=81
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that u... |
Set the service account of the deployment "monitoring-stack-deployment" to "dashboard" | Command:
```bash
kubectl set serviceaccount deployment monitoring-stack-deployment dashboard
```
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:
... |
create a new config map named app-secrets using key=value pairs from the file located at path/to/configurations | Command:
```bash
kubectl create configmap app-secrets --from-file=path/to/configurations
```
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 bas... |
Forward local port 5432 to port 8000 in the frontend-pod and listen for data to/from port 6000 in the pod | Command:
```bash
kubectl port-forward pod/frontend-pod 5432 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Update the annotation 'git-repo' for the pod 'log-aggregator' with the value 'https://github.com/example/my-app', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods log-aggregator git-repo='https://github.com/example/my-app'
```
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 ... |
Set the service account for the deployment "load-balancer-deployment" to "flux" | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment flux
```
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... |
Update the label of the 'proxy' pod to set the 'component' label as 'api' | Command:
```bash
kubectl label pods proxy component=api
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "I... |
Return snapshot logs from container media-stream-pod-1 of a deployment named email-server-deployment | Command:
```bash
kubectl logs deployment/email-server-deployment -c media-stream-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:
"... |
Execute the 'docker run -it ubuntu' command in the nebula-navigator container of the auth-service pod and get the output. | Command:
```bash
kubectl exec auth-service-pod -c nebula-navigator -- docker run -it ubuntu
```
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 ... |
Expose a deployment named "php" as a service on port 9092, and connect to the containers in the deployment on port 300000. | Command:
```bash
kubectl expose deployment php --port=9092 --target-port=300000
```
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 ... |
Update the pod 'proxy-server' by adding the label 'tier' with the value 'database' | Command:
```bash
kubectl label pods proxy-server tier=database
```
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", "usa... |
Forward local port 8000 to port 8081 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 8000: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 auto... |
Import the environment variables from the secret/app-config-secret and set them for the deployment/database-deployment | Command:
```bash
kubectl set env --from=secret/app-config-secret deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more po... |
Create a new secret named oauth-secret with keys for each file in folder configurations | Command:
```bash
kubectl create secret generic oauth-secret --from-file=path/to/configurations
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename ... |
Copy the .kube configuration file from a remote pod to a local directory | Command:
```bash
kubectl cp ingress-nginx/database-pod-2:~/.config/kube /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... |
Create a LoadBalancer service named "gateway-lb" that will forward traffic from port 9091 to port 27017. | Command:
```bash
kubectl create service loadbalancer gateway-lb --tcp=9091:27017
```
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", "defaul... |
Open the 'loadbalancer-service' service for editing using the 'micro' editor. | Command:
```bash
KUBE_EDITOR="micro" kubectl edit svc/loadbalancer-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 var... |
Import environment variables from a config map with a prefix to a deployment | Command:
```bash
kubectl set env --from=configmap/env-vars --prefix=MYSQL_ deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Execute the 'go version' command in the astro-container of the auth-service-pod and get the output. | Command:
```bash
kubectl exec auth-service-pod -c astro-container -- 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 omi... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/global-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 definit... |
Create a debug version of the web-app-pod by adding a container and changing the container images | Command:
```bash
kubectl debug web-app-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,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 resource and n... |
Change the service account of the deployment named 'scheduler-app-deployment' to 'fluentd' | Command:
```bash
kubectl set serviceaccount deployment scheduler-app-deployment fluentd
```
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:
`kube... |
Create an ingress named 'www-ingress' that directs requests from "foo.com/input" to the service "svc1:7000" using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress www-ingress --rule="foo.com/input=svc1:7000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Create an ingress called 'app-ingress' that directs requests to 'website.com/module' to service 'svc1:8010' with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress app-ingress --rule="website.com/module=svc1:8010,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... |
Get the output from running the 'jenkins --version' command in the quantum-quark container of the email-service-pod pod | Command:
```bash
kubectl exec email-service-pod -c quantum-quark -- 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. ... |
Update the pod named 'proxy' with the annotation 'last-deployment' and set it to the value '2023-03-15', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods proxy last-deployment='2023-03-15'
```
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... |
Import the API_KEY from the global-config config map to the scheduler-app-deployment deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/global-config 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 definition... |
Rename the 'testing-context' context to 'team-alpha-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context testing-context team-alpha-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 wil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.