prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Start a ruby pod named hazelcast, using the ruby image, and expose port 8010. | Command:
```bash
kubectl run hazelcast --image=ruby --port=8010
```
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... |
Return the snapshot logs from the container 'email-service-pod-1' of the deployment 'order-processing-deployment'. | Command:
```bash
kubectl logs deployment/order-processing-deployment -c email-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 fla... |
Update the image of all containers in the daemonset named "prod" to "node:14.17.3" | Command:
```bash
kubectl set image daemonset prod *=node:14.17.3
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kubect... |
create a new config map named log-config using specified files | Command:
```bash
kubectl create configmap log-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating ... |
Apply a label to a pod named 'web' with the label 'status' and the value 'unhealthy', replacing any existing value | Command:
```bash
kubectl label --overwrite pods web status=unhealthy
```
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"... |
Update the pod named 'auth' with the annotation 'release-notes' and the value 'https://example.com/release-notes/v2.5.1'. | Command:
```bash
kubectl annotate pods auth release-notes='https://example.com/release-notes/v2.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 ... |
Create a new ClusterIP service named cache-service-clusterip that maps port 8010 to port 8000. | Command:
```bash
kubectl create service clusterip cache-service-clusterip --tcp=8010:8000
```
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", ... |
Update the cluster field in the specified context to the desired cluster name. | Command:
```bash
kubectl config set contexts.cloud-context.cluster testing-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you... |
Copy the local file /tmp/foo to the remote pod payment-gateway-pod-19 in the container image-resizer, and save it as /tmp/bar. | Command:
```bash
kubectl cp :/tmp/foo payment-gateway-pod-19:/tmp/bar -c image-resizer
```
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... |
Delete the pods and services with the names "frontend" and "api" | Command:
```bash
kubectl delete pod,service frontend api
```
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.
So... |
Update the container images for the deployment named "mongo" | Command:
```bash
kubectl set image deployment/mongo busybox=busybox mongo=mongo:5.0.2
```
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 ... |
Import the 'DATABASE_URL' key from the 'app-settings' config map to the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-settings 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 def... |
Create a new config map named app-name-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/preferences/file1.txt --from-file=data=/path/to/options/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 ... |
Add a taint with key 'zone' on nodes having label app=web-app | Command:
```bash
kubectl taint node -l app=web-app zone=prod-node-5: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... |
Forward port 3000 on your local machine to port 5432 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward pod/e-commerce-pod 3000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Auto scale the replication controller "payment" with the number of pods between 1 and 5, and the target CPU utilization set to 40%. | Command:
```bash
kubectl autoscale rc payment --max=5 --cpu-percent=40
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
update the image of all containers in the daemonset named "nginx" to "java:11.0.12" | Command:
```bash
kubectl set image daemonset nginx *=java:11.0.12
```
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:
`kubec... |
Import the 'CONFIG_FILE_PATH' key from the 'app-secrets' config map into the 'proxy-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-secrets deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Update the annotation 'alert-email' of the pod 'payment' with the value 'alerts@example.com' | Command:
```bash
kubectl annotate pods payment 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 include... |
Output the modified deployment in YAML format without making any changes to the server object. | Command:
```bash
kubectl set env deployment/scheduler-app-deployment API_KEY=your-api-key -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 ... |
Forward port 5432 on your local machine to port 3000 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward pod/e-commerce-pod 5432:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Create an ingress named 'public-ingress' that routes requests to 'testing.com/module' to the service 'svc1' running on port 9000 | Command:
```bash
kubectl create ingress public-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": "", "us... |
Create a cluster role named "default_role" with the ability to create services and specific resource names "app-worker-1" and "error-logger" | Command:
```bash
kubectl create clusterrole default_role --verb=create --resource=services --resource-name=app-worker-1 --resource-name=error-logger
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Forward local ports to a pod's ports | Command:
```bash
kubectl port-forward pod/api-service-pod 9090 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Expose the wordpress deployment as a service with port 3306, and connect to the containers on port 500100. | Command:
```bash
kubectl expose deployment wordpress --port=3306 --target-port=500100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Forward local port 8088 to the targetPort of the "https" port in the user-service service pod. | Command:
```bash
kubectl port-forward service/user-service 8088:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected ... |
Update the 'media-stream' pod by setting the annotation 'custom-label' to 'my-custom-value' | Command:
```bash
kubectl annotate pods media-stream 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 incl... |
Create a new config map named namespace-config using key-value pairs from the specified file. | Command:
```bash
kubectl create configmap namespace-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 base... |
Create an ingress named 'api-gateway-ingress' that maps requests from foo.com/example to svc1:8888 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="foo.com/example=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": "", "... |
Create a job named database-seeding-job using the php image. | Command:
```bash
kubectl create job database-seeding-job --image=php --
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
delete the pods and services named "api" and "email" | Command:
```bash
kubectl delete pod,service api email
```
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 ... |
Create a copy of the media-stream-pod and change all container images to 'postgres | Command:
```bash
kubectl debug media-stream-pod --copy-to=debug-image-web --set-image=*=postgres
```
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 ... |
Add a taint with the key 'special' on nodes having the label 'project=project-alpha' | Command:
```bash
kubectl taint node -l project=project-alpha 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": "", ... |
Forward local port 6379 to port 8000 in the pod "analytics-pod" | Command:
```bash
kubectl port-forward 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 will be selected auto... |
Partially update a node by applying a strategic merge patch using a JSON file | Command:
```bash
kubectl patch node node-2 -p '{"spec":{"rules":[{"http":{"paths":[{"path":"/","backend":{"service": {"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:
`kubectl patch ... |
Port forward from local port 8081 to port 5000 in the pods selected by the deployment "mydeployment" | Command:
```bash
kubectl port-forward deployment/mydeployment 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 selecte... |
Continuously stream the logs of the nano-bot container in the pod named proxy-service-pod | Command:
```bash
kubectl logs -f -c nano-bot proxy-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "s... |
Remove all taints with the key 'dedicated' from node 'node-2' | Command:
```bash
kubectl taint nodes node-2 dedicated-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/database-rc pods/cdn-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 namespace... |
Expose a replica set as a service, serving on port 5432 and connecting to containers on port 8081. | Command:
```bash
kubectl expose rs wordpress --port=5432 --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 specified po... |
Update the pod named 'foo' with the annotation 'deployment-script' and the value 'https://example.com/deploy.sh'. | Command:
```bash
kubectl annotate pods foo deployment-script='https://example.com/deploy.sh'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than lab... |
Create a deployment named "my-dep" using the Redis image and expose port 8084 | Command:
```bash
kubectl create deployment my-dep --image=redis --port=8084
```
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: js... |
Create an autoscaling policy for the "gateway" deployment. Allow the number of pods to range from 4 to 12. | Command:
```bash
kubectl autoscale deployment gateway --min=4 --max=12
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Create an ingress called 'app-gateway-ingress' that directs requests to 'testing.com/bar' to service 'svc1' on port '8089' with a TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="testing.com/bar=svc1:8089,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": "", "... |
List the deployments in the "prod-apps" API group with the version "v2.1.0" in JSON output format. | Command:
```bash
kubectl get deployments.v2.1.0.prod-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 will ... |
Start a golang pod named "hazelcast" with the container image of "golang" and expose port 3306 | Command:
```bash
kubectl run hazelcast --image=golang --port=3306
```
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 LoadBalancer service named proxy-server-lb, mapping port 8181 on the service to port 8010 on the pods. | Command:
```bash
kubectl create service loadbalancer proxy-server-lb --tcp=8181:8010
```
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", "de... |
Embed the certificate authority data for the cluster-gamma cluster entry | Command:
```bash
kubectl config set-cluster cluster-gamma --embed-certs --certificate-authority=~/.kube/star-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 se... |
Switch to raw terminal mode and attach to the 'time-machine' container inside the 'security-service-pod' pod, allowing for interactive command execution | Command:
```bash
kubectl attach security-service-pod -c time-machine -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. ... |
Copy the directory "/tmp/foo_dir" from the remote pod "security-scanner-pod-18" in the "kube-public" namespace to the local directory "/etc/kubernetes". | Command:
```bash
kubectl cp kube-public/security-scanner-pod-18:/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 omit... |
Create a cluster role named "view" with specified resource names | Command:
```bash
kubectl create clusterrole view --verb=delete --resource=configmaps --resource-name=blog-backend --resource-name=keycloak-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... |
Create a service for a replicated centos using replica set named 'centos' | Command:
```bash
kubectl expose rs centos --port=8181 --target-port=330600
```
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.... |
Return the snapshot logs from the container named 'notification-handler-deployment-1' of the deployment named 'mypod' | Command:
```bash
kubectl logs deployment/notification-handler-deployment -c mypod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fla... |
Scale a resource to a specific number of replicas based on the configuration specified in a YAML file. | Command:
```bash
kubectl scale --replicas=3 -f parameters.yaml
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is vali... |
Delete pods and services with the names "foo" and "vpn" | Command:
```bash
kubectl delete pod,service foo vpn
```
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 pod disruption budget named cron-jobs-pdb that will select all pods with the release=1.0.0 label and require minimum one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-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 [-... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-secrets 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 def... |
Get the output of 'dotnet --list-runtimes' command from the web-app-pod pod using the warp-drive container | Command:
```bash
kubectl exec web-app-pod -c warp-drive -- dotnet --list-runtimes
```
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 o... |
Set the nginx container in the deployment 'nginx' to have a CPU limit of "500m" and a memory limit of "128Mi" | Command:
```bash
kubectl set resources deployment nginx -c=nginx --limits=cpu=500m,memory=128Mi
```
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, but may burst up to... |
Update the pod 'gateway' by adding the label 'env' with the value 'development' | Command:
```bash
kubectl label pods gateway env=development
```
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"... |
Create a single ingress called 'app-ingress' that directs requests to foo.com/example to svc1:8080 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-ingress --rule="foo.com/example=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": ... |
Import the redis_host key from the config map "namespace-config" and set its value in the environment variables of the api-server-deployment deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/namespace-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 definit... |
Create a job named log-processing-job with the image confluentinc/cp-kafka, and execute the command "kafka-server-start /etc/kafka/server.properties" | Command:
```bash
kubectl create job log-processing-job --image=confluentinc/cp-kafka -- kafka-server-start /etc/kafka/server.properties
```
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... |
Import the 'redis_host' key from the 'app-settings' config map and set it as an environment variable for the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-settings 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... |
Add a taint with the key 'dedicated' and the value 'app-node-6:PreferNoSchedule' on nodes that have the label 'stack=tech-stack'. | Command:
```bash
kubectl taint node -l stack=tech-stack dedicated=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"... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-settings 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 variabl... |
Set the environment variable "API_KEY" for the "log-aggregator-deployment" deployment by importing the specific key(s) from the "log-config" config map. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/log-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 definitions ... |
Create a ClusterIP service named database-service-clusterip | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=8080:8000
```
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... |
Update the image of all containers in the daemonset 'development' to 'nginx:1.21.3' | Command:
```bash
kubectl set image daemonset development *=nginx:1.21.3
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
... |
Import the SMTP_SERVER key from the ui-config config map and set it as an environment variable in the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/ui-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 definit... |
Create a cluster role named "custom_role" that allows the user to use, get, and patch services | Command:
```bash
kubectl create clusterrole custom_role --verb=use,get,patch --resource=services
```
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", "s... |
Create a deployment named "drupal" using the "hazelcast/hazelcast" image and expose port 8082. | Command:
```bash
kubectl create deployment drupal --image=hazelcast/hazelcast --port=8082
```
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 form... |
Create a copy of the 'monitoring-pod' pod, adding a 'debug' container and changing container images | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-web --image=debian --set-image=worker=my-custom-worker:1.2.3,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identifi... |
Create a deployment named 'loadbalancer' using the 'docker.elastic.co/elasticsearch/elasticsearch' image and expose port 8088. | Command:
```bash
kubectl create deployment loadbalancer --image=docker.elastic.co/elasticsearch/elasticsearch --port=8088
```
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", "def... |
Taint nodes labeled with zone=us-east-1 by adding a taint with key 'workload' and value 'backup-node-14:PreferNoSchedule' | Command:
```bash
kubectl taint node -l zone=us-east-1 workload=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... |
Set the service account of the deployment "user-management-deployment" to "gitlab-runner" | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment gitlab-runner
```
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
Synta... |
Set the custom TLS server name "my-k8s-cluster" for the "kube-cluster-1" cluster | Command:
```bash
kubectl config set-cluster kube-cluster-1 --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] [--certifi... |
Create a deployment named auth using the python image and expose port 8000 | Command:
```bash
kubectl create deployment auth --image=python --port=8000
```
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... |
Create a new ClusterIP service named notification-service-clusterip, exposing port 8888 on the service and forwarding traffic to port 7000 on the pods. | Command:
```bash
kubectl create service clusterip notification-service-clusterip --tcp=8888: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":... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config-dev deployment/mydeployment
```
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... |
Create a service named "node" for a replicated node, which serves on port 8081 and connects to the containers on port 808900 | Command:
```bash
kubectl expose rc node --port=8081 --target-port=808900
```
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... |
create a new service account named kube-proxy | Command:
```bash
kubectl create serviceaccount kube-proxy
```
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... |
Import the "api_key" key from the "ui-config" ConfigMap into the environment variables of the "mydeployment" deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/ui-config deployment/mydeployment
```
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... |
Copy the /tmp/foo_dir directory from the remote pod named 'payment-gateway-pod-19' in the 'kube-proxy' namespace to the /tmp/bar directory locally. | Command:
```bash
kubectl cp kube-proxy/payment-gateway-pod-19:/tmp/foo_dir :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Create a new config map named 'monitoring-config' using the files located at '/path/to/profiles/file1.txt' and '/path/to/options/file2.txt' as the values for the respective keys 'settings' and 'key2'. | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/options/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 creati... |
Create a new ingress called 'ingress1' in the default class with the following rules: | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:8088" \
--rule="input.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "... |
Create a new ExternalName service named external-identity-provider-service with the external name set to placeholder-app.app | Command:
```bash
kubectl create service externalname external-identity-provider-service --external-name placeholder-app.app
```
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 ... |
Copy the file '/tmp/foo' from your local machine to the '/tmp/bar' directory inside the 'metrics-exporter-pod-10' pod, in the 'security-scanner' container. | Command:
```bash
kubectl cp /tmp/foo metrics-exporter-pod-10:/tmp/bar -c security-scanner
```
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... |
Partially update the configuration of a node by applying a strategic merge patch specified as YAML | Command:
```bash
kubectl patch node backup-node-14 -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... |
Scale the replica set named 'web' to 5 replicas | Command:
```bash
kubectl scale --replicas=5 rs/web
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is validated before... |
Partially update the 'gpu-node-12' node by applying a strategic merge patch specified as YAML | Command:
```bash
kubectl patch node gpu-node-12 -p $'spec:\n containers:\n- name: container-name\n resources:\n limits:\n cpu: 200m'
```
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 F... |
Create a service for the replicated wordpress using the replica set | Command:
```bash
kubectl expose rs wordpress --port=3306 --target-port=8000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port... |
Display the specified resources by their types and names. | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/backend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced... |
Create an ingress called 'app-gateway-ingress' with a rule that directs requests from foo.com/module to svc1:9090 using the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="foo.com/module=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Forward local port 8080 to port 5000 in the selected pod of the deployment named "api-server-deployment" | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8080 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 b... |
Remove all taints with the key 'environment' from the node 'app-node-6' | Command:
```bash
kubectl taint nodes app-node-6 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|yam... |
Forward traffic from port 8081 on localhost and IP address 10.19.21.23 to port 3000 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 8081:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cri... |
Create a pod disruption budget named messaging-pdb that selects all pods with the app=rails label and ensures that at least four of them are always available. | Command:
```bash
kubectl create poddisruptionbudget messaging-pdb --selector=app=rails --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 [--dry... |
Create a new secret named password-secret and include each file in the path/to/profiles folder as keys in the secret | Command:
```bash
kubectl create secret generic password-secret --from-file=path/to/profiles
```
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 of ... |
Create a deployment named "my-dep" with the "node" image and 7 replicas | Command:
```bash
kubectl create deployment my-dep --image=node --replicas=7
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: js... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.