prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Remove the NoExecute taint from node 'testing-node-11' | Command:
```bash
kubectl taint nodes testing-node-11 datacenter: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. On... |
Set the custom TLS server name 'staging-cluster' to use for validation for the 'my-k8s-cluster' cluster entry | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=staging-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] [--certif... |
Create a copy of the proxy-server-pod, changing all container images to "mcr.microsoft.com/dotnet/core/runtime". | Command:
```bash
kubectl debug proxy-server-pod --copy-to=dgb-img --set-image=*=mcr.microsoft.com/dotnet/core/runtime
```
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 b... |
Import environment variables into a deployment from a config map with a specific prefix. | Command:
```bash
kubectl set env --from=configmap/app-secrets --prefix=MYSQL_ deployment/web-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 definitions in on... |
Create a single ingress called 'api-v2-ingress' that directs requests to website.com/input to svc # svc1:8888 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v2-ingress --rule="website.com/input=svc1:8888,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Create a role named "view" with the API Group "storageclasses.storage.k8s.io" specified | Command:
```bash
kubectl create role view --verb=patch,proxy,delete --resource=storageclasses.storage.k8s.io
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful fla... |
Forward traffic from port 8000 on all addresses to port 9090 in the pod "web-app-pod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8000:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Add a 'dedicated' taint to the db-node-7 node, which has the label component=proxy. | Command:
```bash
kubectl taint node -l component=proxy dedicated=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
List deployments in "api-v2" API group with YAML output format, in the "v2.0.0" version. | Command:
```bash
kubectl get deployments.v2.0.0.api-v2 -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 will onl... |
Set the server field for a specific cluster | Command:
```bash
kubectl config set-cluster kube-cluster-1 --server=https://1.2.3.4
```
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-aut... |
Create a new config map named db-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap db-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config... |
Create a cluster role named "foo" with permissions to get configmaps resources with the names "order-fulfillment" and "dev-database" | Command:
```bash
kubectl create clusterrole foo --verb=get --resource=configmaps --resource-name=order-fulfillment --resource-name=dev-database
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|clien... |
Scale the deployment named db-migration-replicaset from 1 replica to 3 replicas. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=3 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... |
change the service account for the scheduler-app-deployment deployment to elasticsearch | Command:
```bash
kubectl set serviceaccount deployment scheduler-app-deployment elasticsearch
```
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:... |
Remove the taint with key 'hardware' and effect 'NoExecute' from the node 'node-1' if it exists | Command:
```bash
kubectl taint nodes node-1 hardware: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 of: json|... |
List the deployments in the "extensions" API group with the version "v2.0.0" in JSON format | Command:
```bash
kubectl get deployments.v2.0.0.extensions -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... |
Forward local port 3000 to the targetPort of the "https" service's port in the pod selected by the "order-service" service. | Command:
```bash
kubectl port-forward service/order-service 3000: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 selected... |
Start a pod with nginx image | Command:
```bash
kubectl run nginx --image=nginx
```
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": "--filename", "short"... |
Forward local port 8888 to port 5000 in a pod selected by the "database-deployment" deployment. | Command:
```bash
kubectl port-forward deployment/database-deployment 8888 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 ... |
Create an ingress called 'private-service-ingress' that directs requests to foo.com/module to svc1:8000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="foo.com/module=svc1:8000,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": ""... |
View the previous terminated logs of the 'quantum-quark' container in the 'web-app-pod' pod | Command:
```bash
kubectl logs -p -c quantum-quark web-app-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 output of 'elasticsearch-plugin --list' command from time-machine container in security-service-pod | Command:
```bash
kubectl exec security-service-pod -c time-machine -- elasticsearch-plugin --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": "Cont... |
Partially update the web-node-8 node by replacing the value of the "someField" field with "newValue" using a strategic merge patch. | Command:
```bash
kubectl patch node web-node-8 -p $'spec:\n someField: newValue'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful f... |
display information about the rc/web, service/payment-gateway-rc, pods/media-stream-pod resources | Command:
```bash
kubectl get rc/web service/payment-gateway-rc pods/media-stream-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 n... |
Create a copy of the backend-pod called debug-image-api, with a debug container | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-api --image=debian --set-image=scheduler=my-scheduler:1.0,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified... |
Create a cluster role named "foo" with the specified resource name and verb | Command:
```bash
kubectl create clusterrole foo --verb=delete --resource=configmaps --resource-name=document-storage --resource-name=search-elasticsearch
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=se... |
Create a pod disruption budget named "critical-services-pdb" that will select all pods with the label "version=v2" and require a minimum of one of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=version=v2 --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available... |
Forward port 6379 on all addresses to port 5000 in the proxy-server-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-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 ... |
Create a new NodePort service named proxy-server-nodeport that maps port 3306 of the cluster to port 8082 of the Node. | Command:
```bash
kubectl create service nodeport proxy-server-nodeport --tcp=3306: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", "default"... |
Create a Pod Disruption Budget named 'statefulset-pdb' that will select all pods with the 'release=1.0.0' label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=release=1.0.0 --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Import specific keys from a config map into a deployment's environment variables configuration. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-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 ... |
Start a Python pod with port 9000 exposed | Command:
```bash
kubectl run hazelcast --image=python --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": "--f... |
Create a new ClusterIP service named 'database-service-clusterip' that forwards traffic from port 8082 to port 8888. | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=8082:8888
```
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... |
Restart the pods managed by the staging daemon set | Command:
```bash
kubectl rollout restart daemonset/staging
```
What it does:
Restart a resource.
Resource rollout will be restarted.
Syntax:
`kubectl rollout restart RESOURCE`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the resource ... |
Start a pod named 'hazelcast' using the 'mcr.microsoft.com/dotnet/core/runtime' image, and expose port 8089 in the container | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --port=8089
```
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...... |
Create a new ClusterIP service named "order-service-clusterip" and map port 8443 of the service to port 5000. | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=8443:5000
```
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", ... |
provide a detailed description of the pods with the label release=beta. | Command:
```bash
kubectl describe po -l release=beta
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide ... |
Create an ingress resource called 'web-ingress' that directs requests to 'foo.com/bar' to the service 'svc1' on port '8010', with a TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress web-ingress --rule="foo.com/bar=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": "Out... |
View the previous terminated logs of the "code-explorer" container from the "auth-service-pod" pod | Command:
```bash
kubectl logs -p -c code-explorer auth-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"... |
Create an ExternalName service called external-email-service with the external name dummy-website.io | Command:
```bash
kubectl create service externalname external-email-service --external-name dummy-website.io
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference servi... |
Create an ingress called 'rontend-ingress' with the following rule: testing.com/input should be directed to the service svc1 on port 5432, and use the tls secret "my-cert". | Command:
```bash
kubectl create ingress rontend-ingress --rule="testing.com/input=svc1:5432,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Import the DATABASE_URL key from the app-config-prod config map into the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config-prod 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 ... |
create a job named "monitoring-job" with the image "ruby" and run the command "gem --version" | Command:
```bash
kubectl create job monitoring-job --image=ruby -- gem --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output forma... |
Create a new config map named ui-config using specified keys from files | Command:
```bash
kubectl create configmap ui-config --from-file=properties=/path/to/configs/file1.txt --from-file=key1=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a confi... |
Create a new ClusterIP service named ldap-service-clusterip with port mapping from 9092 to 8081 | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=9092:8081
```
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", "... |
Create a NodePort service named backend-nodeport that forwards traffic from port 5001 on the cluster nodes to port 9092 on the backend | Command:
```bash
kubectl create service nodeport backend-nodeport --tcp=5001:9092
```
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": "",... |
Update the annotation of a specific pod, overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods backend monitoring-tool='Prometheus'
```
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 a... |
Forward all traffic on port 6379 to port 8000 in the 'analytics-pod' pod. Listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 6379: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 wil... |
Remove the 'bar' label from the 'database' pod if it exists | Command:
```bash
kubectl label pods database env-
```
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 true... |
Add a taint with key 'environment' on nodes having label zone=us-east-1 | Command:
```bash
kubectl taint node -l zone=us-east-1 environment=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Create a service for the replicated WordPress using a replica set, which serves on port 3001 and connects to the containers on port 9092. | Command:
```bash
kubectl expose rs wordpress --port=3001 --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 specified po... |
Create a service for a replicated python application, serving on port 8089 and connecting to the containers on port 9090. | Command:
```bash
kubectl expose rc python --port=8089 --target-port=909000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Create a new config map named app-config-prod using the key=value pairs defined in the file located at path/to/profiles | Command:
```bash
kubectl create configmap app-config-prod --from-file=path/to/profiles
```
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... |
Scale the deployment named api-service-rs from its current size of 3 replicas to 1 replica | Command:
```bash
kubectl scale --current-replicas=3 --replicas=1 deployment/api-service-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-vers... |
Create a cron job called 'cron-task' that runs the 'docker run -it ubuntu' command every minute using the 'ubuntu' image. | Command:
```bash
kubectl create cronjob cron-task --image=ubuntu --schedule="*/1 * * * *" -- docker run -it ubuntu
```
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 project=my-project label and require at least one of them to be available at any point in time | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=project=my-project --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... |
Import the MAX_CONNECTIONS key from the app-config-prod config map and set it as an environment variable in the order-processing-deployment deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-config-prod 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 variab... |
Import the environment variables from the 'ssl-key-secret' secret and set them on the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/ssl-key-secret deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod... |
Add a taint to a specific node with no value | Command:
```bash
kubectl taint nodes prod-node-5 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: ... |
Execute the 'ash' command in the quantum-quark container from the security-service-pod pod | Command:
```bash
kubectl exec security-service-pod -c quantum-quark -- ash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Execute the 'go' command in the cyber-sleuth container of the e-commerce pod and retrieve the output. | Command:
```bash
kubectl exec e-commerce-pod -c cyber-sleuth -- 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... |
Create a cron job named "cleanup-task" that runs every minute and executes the command "ruby --version" inside a Ruby container. | Command:
```bash
kubectl create cronjob cleanup-task --image=ruby --schedule="*/1 * * * *" -- ruby --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o... |
Return the snapshot logs from the container named proxy-server-pod-1 in the api-server-deployment deployment. | Command:
```bash
kubectl logs deployment/api-server-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:
"fl... |
Copy a file named "foo" located in the "/tmp" directory on your local machine to the "/tmp/bar_dir" directory in a remote pod named "worker-pod-4" in the "kube-server" namespace. | Command:
```bash
kubectl cp :/tmp/foo kube-server/worker-pod-4:/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... |
create a service for the replicated python using the replica set "python", expose the service on port 8181 and connect to the containers on port 818100 | Command:
```bash
kubectl expose rs python --port=8181 --target-port=818100
```
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.... |
Start a mysql pod with the name 'nginx' and the mysql image, but override some of the spec values using the JSON provided in the command | Command:
```bash
kubectl run nginx --image=mysql --overrides='{ "apiVersion": "stable-2.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] -- [C... |
Roll back the deployment named "development" to the previous version. | Command:
```bash
kubectl rollout undo deployment/development
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the resource t... |
Embed the certificate authority data for the sun-cluster cluster entry using the command "kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/moon-cluster/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/moon-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-... |
Import the 'secret_key' key from the 'app-config' config map and set it as an environment variable in the 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-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 o... |
Remove the taint with key 'zone' and effect 'PreferNoSchedule' from the node named 'monitoring-node-15' | Command:
```bash
kubectl taint nodes monitoring-node-15 zone:PreferNoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format... |
Create a deployment named "mattermost" with 6 replicas running the "node" image | Command:
```bash
kubectl create deployment mattermost --image=node --replicas=6
```
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 copy of the pod "chat-app-pod" with all container images changed to "ruby" for debugging purposes. | Command:
```bash
kubectl debug chat-app-pod --copy-to=debug-image-web --set-image=*=ruby
```
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 resou... |
Forward local port 6379 to remote port 9090 in the pod labeled "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 6379:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Auto scale the replication controller "frontend" in the default namespace, with the minimum number of pods set to 1 and the maximum number of pods set to 6 | Command:
```bash
kubectl autoscale rc frontend --max=6 --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 use... |
Delete the pods and services with the names "chat-app" and "log-aggregator" | Command:
```bash
kubectl delete pod,service chat-app 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 label s... |
Create a new service account named tekton | Command:
```bash
kubectl create serviceaccount tekton
```
What it does:
Create a service account with the specified name.
Syntax:
`kubectl create serviceaccount NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-tem... |
Create a ClusterIP service named billing-service-clusterip for port mapping with 9000 on the service to 7000 on the pods | Command:
```bash
kubectl create service clusterip billing-service-clusterip --tcp=9000:7000
```
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"... |
Get output from running the 'mysql' command in rocket-ranger from pod database-pod. | Command:
```bash
kubectl exec database-pod -c rocket-ranger -- 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 t... |
Wait for the "analytics-pod" pod to be deleted after issuing the delete command, with a 60s timeout | Command:
```bash
kubectl delete pod/analytics-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 resource... |
Forward local port 5432 to port 8081 in the e-commerce-pod, allowing data to be sent and received between the ports. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 5432 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... |
Copy the directory '/tmp/foo_dir' from the remote pod 'velero/task-processor-pod-17' to the local directory '/tmp/bar_dir' | Command:
```bash
kubectl cp velero/task-processor-pod-17:/tmp/foo_dir /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 t... |
Set the custom TLS server name to "cluster-gamma" for the "my-k8s-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=cluster-gamma
```
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] [--certific... |
Import specific keys from a config map into a deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-secrets 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 defin... |
create a job named "testing" with an Alpine image that sleeps for 3600 seconds | Command:
```bash
kubectl create job testing --image=alpine -- sleep 3600
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One o... |
Output the modified 'database-deployment' deployment in YAML format with the updated environment variable 'DB_PASSWORD' set to 'secretpassword', without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/database-deployment DB_PASSWORD=secretpassword -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... |
Create a new config map named kube-system-config in the current namespace, with the keys "conf" and "data" corresponding to the contents of the /path/to/configurations/file1.txt and /path/to/settings/file2.txt files, respectively. | Command:
```bash
kubectl create configmap kube-system-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/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 cr... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-secrets 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 def... |
Listen on port 8888 on localhost and IP address 10.19.21.23, forwarding the traffic to port 8088 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 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 cr... |
Create a pod disruption budget named 'cache-cluster-pdb' that will select all pods with the 'app=rails' label and require at least 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=app=rails --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 [-... |
Update the app version of a pod in "preferences.json" file | Command:
```bash
kubectl annotate -f preferences.json 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 arbit... |
Set the cluster field of the my-context context to moon-cluster | Command:
```bash
kubectl config set contexts.team-beta-context.cluster moon-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value yo... |
Check if you have permission to list the job named "virus-scan-job" in the "kube-ingress" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/virus-scan-job -n kube-ingress
```
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 UR... |
Update the pod 'monitoring' with the annotation 'scaling-policy' and the value 'auto-horizontal-scaling', ensuring that any existing value is overwritten. | Command:
```bash
kubectl annotate --overwrite pods monitoring scaling-policy='auto-horizontal-scaling'
```
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 large... |
Add a taint with key 'datacenter' and value 'gpu-node-12:PreferNoSchedule' on nodes that have the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace datacenter=gpu-node-12:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Rename the context 'cluster-2-context' to 'admin-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context cluster-2-context admin-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will a... |
Add a taint with the key 'zone' and value 'db-node-7:PreferNoSchedule' on all nodes that have the label 'project=project-alpha' | Command:
```bash
kubectl taint node -l project=project-alpha zone=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Forward local port 8000 to port 3000 in the pod 'cdn-service-pod', allowing access from both localhost and IP 10.19.21.23. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 8000: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 cri... |
Create a new config map named app-name-config using the settings file located at path/to/settings. | Command:
```bash
kubectl create configmap app-name-config --from-file=path/to/settings
```
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... |
Forward local port 3000 to port 8081 in the pod "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 3000 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 a... |
Import the environment variables from the 'ssh-key-secret' secret and apply them to the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/ssh-key-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 or more... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.