prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a Pod Disruption Budget named 'replica-set-pdb' that selects all pods with the label 'release=1.0.0' and requires a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget replica-set-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 ... |
Open a raw terminal to the 'auth-service-pod' pod, in the 'astro-container' container, and start a bash shell. | Command:
```bash
kubectl exec auth-service-pod -c astro-container -i -t -- bash -il
```
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... |
Set the CPU and memory limits and requests for all containers in the 'elasticsearch' deployment to 200m CPU and 512Mi memory for limits, and 200m CPU and 256Mi memory for requests. | Command:
```bash
kubectl set resources deployment elasticsearch --limits=cpu=200m,memory=512Mi --requests=cpu=200m,memory=256Mi
```
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 resourc... |
Begin streaming the logs of the ruby container in the e-commerce-pod pod. | Command:
```bash
kubectl logs -f -c ruby e-commerce-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": ... |
Retrieve information about the replication controller named "web", the service named "payment-gateway", and the pod named "analytics-pod" | Command:
```bash
kubectl get rc/web service/payment-gateway-rc pods/analytics-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is name... |
create a new config map named kube-system-config using specified files as key-value pairs | Command:
```bash
kubectl create configmap kube-system-config --from-file=settings=/path/to/settings/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 c... |
Forward data between local ports 8000 and 6379 to the pod selected by the 'notification-handler-deployment' deployment | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 8000 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 ... |
Forward traffic from port 5432 on all addresses to port 8081 in the 'analytics-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-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 wil... |
Edit the last-applied-configuration annotations for the mongo deployment by type/name in YAML | Command:
```bash
kubectl apply edit-last-applied deployment/mongo
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the edito... |
Get the output from running the command 'apk add curl' in the first container of the first pod of the 'scheduler-service' service. | Command:
```bash
kubectl exec svc/scheduler-service -- apk add curl
```
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 th... |
Forward local ports 8888 and 6000 to ports 9090 and 6000 on the selected pod from the deployment named api-server-deployment | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8888 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 b... |
Embed the certificate authority data for the "app-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster app-cluster --embed-certs --certificate-authority=~/.kube/app-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-c... |
Create a new config map named app-config-dev using the files /path/to/data/file1.txt and /path/to/configurations/file2.txt with keys "settings" and "key2" respectively. | Command:
```bash
kubectl create configmap app-config-dev --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/configurations/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... |
Scale the deployment named 'staging-app-rs' to 7 replicas | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/staging-app-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 new config map named app-config with specified keys and file paths. | Command:
```bash
kubectl create configmap app-config --from-file=properties=/path/to/parameters/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 c... |
Embed the certificate authority data for the 'web-cluster' cluster entry by running the command 'kubectl config set-cluster web-cluster --embed-certs --certificate-authority=~/.kube/staging-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster web-cluster --embed-certs --certificate-authority=~/.kube/staging-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 s... |
Set the custom TLS server name for the cluster-alpha cluster entry in the kubeconfig file. | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=kube-cluster-2
```
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... |
Create an ingress resource with a default backend and routing rules for host "foo.com", redirecting traffic to service "svc" on port 8084, using TLS secret "secret1". | Command:
```bash
kubectl create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="foo.com/*=svc:8084,tls=secret1"
```
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 an ingress called 'external-ingress' that directs requests to website.com/module to svc1:8443 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="website.com/module=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": "", "... |
Create a role named "default_role" with ResourceName specified | Command:
```bash
kubectl create role default_role --verb=list --resource=pods --resource-name=backup-service --resource-name=image-processor
```
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=s... |
Create a deployment named "ingress" using the "hazelcast" image, and expose port 8181. | Command:
```bash
kubectl create deployment ingress --image=hazelcast/hazelcast --port=8181
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output for... |
Autoscale the deployment named "foo" with the minimum number of pods set to 6 and the maximum number of pods set to 9. | Command:
```bash
kubectl autoscale deployment foo --min=6 --max=9
```
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 ... |
Import the 'CONFIG_FILE_PATH' key from the 'app-name-config' config map into the 'authentication-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-name-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... |
Create a copy of media-stream-pod with a debug container and different container images | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-app --image=debian --set-image=web=nginx:latest,proxy=nginx:1.21
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource ... |
create a LoadBalancer service called monitoring-lb, forwarding TCP traffic from port 5001 to port 3306 | Command:
```bash
kubectl create service loadbalancer monitoring-lb --tcp=5001:3306
```
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", "defa... |
Delete the pods and services with the names "media-stream" and "payment" | Command:
```bash
kubectl delete pod,service media-stream payment
```
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 sele... |
Add a taint with key 'cpu-type', value 'x86', and effect 'NoSchedule' to node 'web-node-8' | Command:
```bash
kubectl taint nodes web-node-8 cpu-type=x86: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 o... |
Copy the local file "/tmp/foo" to the remote pod "api-server-pod-3" in the "cert-manager" namespace, placing it in the "/etc/kubernetes" directory. | Command:
```bash
kubectl cp :/tmp/foo cert-manager/api-server-pod-3:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Attach to a pod's container and start an interactive session | Command:
```bash
kubectl attach email-service-pod -c astro-container -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. ... |
Create a service for the replication controller specified in the "centos-controller.yaml" file | Command:
```bash
kubectl expose -f centos-controller.yaml --port=8088 --target-port=808000
```
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... |
Listen on port 8088 on all addresses and forward the traffic to port 5000 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8088: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 ... |
Create a new config map named log-config with the keys 'conf' and 'data', using the files '/path/to/data/file1.txt' and '/path/to/profiles/file2.txt' as the respective values. | Command:
```bash
kubectl create configmap log-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/profiles/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 ma... |
Listen on port 3000 on localhost and IP address 10.19.21.23, and forward the traffic to port 8081 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-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 criter... |
Create a Pod named "hazelcast" using the Ruby image and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container | Command:
```bash
kubectl run hazelcast --image=ruby --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
```
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] -- [COMMA... |
create a service for the 'centos-controller' replication controller specified in the 'centos-controller.yaml' file | Command:
```bash
kubectl expose -f centos-controller.yaml --port=8088 --target-port=801000
```
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... |
create a service for the replication controller specified in "ubuntu-controller.yaml" file | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=8181 --target-port=800000
```
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... |
Forward local port 8080 to port 8081 in the pod named 'proxy-server-pod' | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8080: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... |
Create a job called "monitoring-job" using the "postgres" image and run the "psql" command within the job. | Command:
```bash
kubectl create job monitoring-job --image=postgres -- psql
```
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. On... |
Create a single ingress called 'public-service-ingress' with a rule that directs requests for testing.com/module to the service svc1 on port 9092, using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/module=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default":... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-name-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 def... |
Forward local port 8000 to port 8081 in the pod 'e-commerce-pod' | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
Create a debug pod named 'debug-image-1' using the same configuration as the 'cdn-service-pod', but with all container images changed to 'centos'. | Command:
```bash
kubectl debug cdn-service-pod --copy-to=debug-image-1 --set-image=*=centos
```
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 re... |
Copy the kube config file from your local machine to a specific directory inside a remote pod, targeting a specific container | Command:
```bash
kubectl cp ~/.config/kube front-end-pod-12:/tmp/bar_dir -c ingress-controller
```
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 om... |
Create a service for a replication controller with specific configurations | Command:
```bash
kubectl expose -f php-controller.yaml --port=5432 --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 spec... |
Add a taint with key 'special' on nodes having label version=v1.0.0, specifically on the node 'backup-node-14', and set the taint to 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l version=v1.0.0 special=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Update the pod 'payment' by setting the annotation 'alert-email' to 'alerts@example.com', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite 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 labe... |
create a deployment named auth using the redis image | Command:
```bash
kubectl create deployment auth --image=redis
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|g... |
Copy the file /tmp/foo from the pod security-scanner-pod-18 in the ingress-nginx namespace to the local directory /etc/kubernetes | Command:
```bash
kubectl cp ingress-nginx/security-scanner-pod-18:/tmp/foo /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Create a copy of the payment-gateway-pod and change all container images to redis | Command:
```bash
kubectl debug payment-gateway-pod --copy-to=my-debugger --set-image=*=redis
```
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 r... |
remove the pods and services named "web" and "monitoring" | Command:
```bash
kubectl delete pod,service web monitoring
```
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.
... |
Get the output of the 'dotnet --list-runtimes' command from the pod named 'analytics-pod' by executing the command 'kubectl exec analytics-pod -- dotnet --list-runtimes' | Command:
```bash
kubectl exec analytics-pod -- 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 omitted, use ... |
Import the 'api_key' key from the 'global-config' config map into the 'search-engine-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/global-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Create a service for a replicated ruby resource | Command:
```bash
kubectl expose rc ruby --port=8080 --target-port=801000
```
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... |
Copy the contents of the local directory /var/run/secrets/kubernetes.io/serviceaccount/_dir to the remote pod named web-app-pod-1 in the default namespace, at the directory location /tmp/bar_dir_dir. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/_dir web-app-pod-1:/tmp/bar_dir_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": "Contai... |
Copy the file "/tmp/foo" from your local machine to "/tmp/bar" in the "ingress-controller" container of the "monitoring-agent-pod-6" pod. | Command:
```bash
kubectl cp /tmp/foo monitoring-agent-pod-6::/tmp/bar -c ingress-controller
```
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 omitt... |
Execute the 'node' command on the first pod of the 'user-management-deployment' deployment. | Command:
```bash
kubectl exec deploy/user-management-deployment -- node
```
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, us... |
Create a service for an alpine deployment, which serves on port 80 and connects to the container on port 8000. | Command:
```bash
kubectl expose deployment alpine --port=9000 --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 specifi... |
Update the security-scan-status annotation of the pod specified in the 'parameters.json' file to 'pass' | Command:
```bash
kubectl annotate -f parameters.json security-scan-status=pass
```
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 includ... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/namespace-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Import specific keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/db-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 definitio... |
Create a pod named "hazelcast" using the "ubuntu" image and configure the container to expose port 9090. | Command:
```bash
kubectl run hazelcast --image=ubuntu --port=9090
```
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 pod using a specific image, but customize the spec using JSON overrides | Command:
```bash
kubectl run nginx --image=mcr.microsoft.com/dotnet/core/runtime --overrides='{ "apiVersion": "rc-1.1.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=in... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config-dev 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 defini... |
Delete the pods and services with the names "proxy" and "vpn" | Command:
```bash
kubectl delete pod,service proxy 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 ... |
Create a copy of the chat-app-pod and add a debug container with the Debian image | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=my-custom-dbg --image=debian --set-image=mailer=mailer:latest,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resourc... |
Create a copy of a pod named "database-pod" with all container images changed to "docker.elastic.co/elasticsearch/elasticsearch" | Command:
```bash
kubectl debug database-pod --copy-to=debug-image-api --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 name.... |
View the details of a specific revision of a daemonset. | Command:
```bash
kubectl rollout history daemonset/namespace-3 --revision=7
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or UR... |
Create a cluster role named "custom_role" with the ability to get pods and access the "order-fulfillment" and "dashboard-ui" resources. | Command:
```bash
kubectl create clusterrole custom_role --verb=get --resource=pods --resource-name=order-fulfillment --resource-name=dashboard-ui
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cli... |
Return snapshot logs from container frontend-deployment-1 of a deployment named database-pod | Command:
```bash
kubectl logs deployment/frontend-deployment -c database-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:
"flag": "... |
Add a taint with key 'disktype' on nodes having label component=proxy | Command:
```bash
kubectl taint node -l component=proxy disktype=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Execute the 'jenkins-plugin-cli' command on the first container of the first pod of the 'cache-cluster-deployment' deployment and retrieve the output. | Command:
```bash
kubectl exec deploy/cache-cluster-deployment -- jenkins-plugin-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Import environment from a config map with a prefix | Command:
```bash
kubectl set env --from=configmap/app-config --prefix=MYSQL_ deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one... |
Set the service account for the deployment "load-balancer-deployment" to "kube-controller-manager" | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment kube-controller-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), statefulse... |
Execute the 'apk add curl' command in the lunar-launcher container of the analytics-pod and retrieve the output. | Command:
```bash
kubectl exec analytics-pod -c lunar-launcher -- apk add curl
```
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 omitt... |
Attach to the astro-container in the pod proxy-server-pod to get the output. | Command:
```bash
kubectl attach proxy-server-pod -c astro-container
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omit... |
Get output from running the 'elasticsearch' command in the 'security-service-pod' pod. | Command:
```bash
kubectl exec security-service-pod -- elasticsearch
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use th... |
Forward traffic from port 8081 on all addresses to port 9090 in the pod named chat-app-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 8081: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... |
Start a pod named 'hazelcast' using the python image and expose port 8084 | Command:
```bash
kubectl run hazelcast --image=python --port=8084
```
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... |
Delete the pods and services named "foo" and "api" | Command:
```bash
kubectl delete pod,service foo 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.
Some re... |
Create a deployment named "logging" using the nginx image | Command:
```bash
kubectl create deployment logging --image=nginx -- nginx
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json... |
Apply a taint with the key 'zone' and value 'dev-node-4:PreferNoSchedule' on nodes labeled with 'owner=john-doe' | Command:
```bash
kubectl taint node -l owner=john-doe zone=dev-node-4: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": "Outp... |
Update the label of the pod 'monitoring' to have the key 'component' with the value 'api' | Command:
```bash
kubectl label pods monitoring 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... |
Create a secret named 'database-secret' with keys for each file in the 'path/to/data' folder | Command:
```bash
kubectl create secret generic database-secret --from-file=path/to/data
```
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 the ... |
Check if you have permission to list the job named "virus-scan-job" in the "cert-manager" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/virus-scan-job -n cert-manager
```
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... |
Embed the certificate authority data for the "staging-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/e2e/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-clust... |
Create a new config map named ui-config from the key=value pairs in the given file. | Command:
```bash
kubectl create configmap ui-config --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 basename of... |
create a job named "log-collection" using the image "docker.elastic.co/elasticsearch/elasticsearch" and run the command "elasticsearch" | Command:
```bash
kubectl create job log-collection --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch
```
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": "-... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ local file to :/tmp/bar in the remote pod named task-processor-pod-17 in the logging namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ logging/task-processor-pod-17::/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": "C... |
Add a taint with the key 'dedicated' and value 'backup-node-14:PreferNoSchedule' on nodes having the label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel dedicated=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": "Ou... |
Update the role binding "admin" to include the users "app-operator" and "sysadmin", as well as the group "security-auditors" | Command:
```bash
kubectl set subject rolebinding admin --user=app-operator --user=sysadmin --group=security-auditors
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--s... |
Create a new config map named log-config with the specified keys derived from files on disk | Command:
```bash
kubectl create configmap log-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/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 ... |
Set a taint on node 'storage-node-13' with key 'environment' and value 'production' and effect 'NoSchedule', or update the value if the taint already exists. | Command:
```bash
kubectl taint nodes storage-node-13 environment=production: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... |
Create an ingress named 'external-ingress' with a rule that directs requests from foo.com/bar to svc1:8888 | Command:
```bash
kubectl create ingress external-ingress --rule="foo.com/bar=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": "", "usage":... |
Forward connections from all addresses on port 8081 to port 6379 in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8081: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 po... |
Forward local port 5432 to port 5432 on the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5432 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... |
Add a taint with the key 'cpu-type' and the value 'PreferNoSchedule' on nodes that have the label 'owner=john-doe' | Command:
```bash
kubectl taint node -l owner=john-doe cpu-type=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": "", "usage"... |
Add the label 'release' with the value 'v2.0' to the pod named 'gateway' | Command:
```bash
kubectl label pods gateway release=v2.0
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "... |
Create a debug container from the frontend-pod and change all container images to mysql. | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-1 --set-image=*=mysql
```
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 resour... |
Create a cluster role named "view" with API Group specified | Command:
```bash
kubectl create clusterrole view --verb=list,create,connect --resource=statefulsets.apps
```
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": "--out... |
Deny a Certificate Signing Request (CSR) with the name 'csr-def456' | Command:
```bash
kubectl certificate deny csr-def456
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kubectl ce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.