prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a copy of monitoring-pod with all container images changed to node | Command:
```bash
kubectl debug monitoring-pod --copy-to=my-custom-dbg --set-image=*=node
```
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... |
Copy the kube config file from a remote pod to a local directory | Command:
```bash
kubectl cp logging/logging-agent-pod-7:~/.config/kube /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Delete the pods and services with the names "gateway" and "security" | Command:
```bash
kubectl delete pod,service gateway security
```
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... |
Create a golang pod named "nginx" | Command:
```bash
kubectl run nginx --image=golang
```
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... |
Copy the ~/.config/kube directory from the 'backend-pod-13' pod in the 'rook-ceph' namespace to the local '/tmp/bar_dir' directory. | Command:
```bash
kubectl cp rook-ceph/backend-pod-13:~/.config/kube /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Execute the 'irb' command inside the web-app-pod and display the output. | Command:
```bash
kubectl exec web-app-pod -- irb
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kubernete... |
Start a python pod named 'nginx' with the image 'python', but override the spec with a partial set of values parsed from a JSON file | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "alpha-2.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] -- [COM... |
Attach to the "mycontainer" container running in the "media-stream-pod" pod and get its output. | Command:
```bash
kubectl attach media-stream-pod -c mycontainer
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a new config map named 'api-config' using the files '/path/to/configs/file1.txt' and '/path/to/options/file2.txt' as values for the keys 'settings' and 'key2' respectively. | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/configs/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 creating a con... |
Add the label 'role=backend' to the pod 'database' | Command:
```bash
kubectl label pods database role=backend
```
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": ... |
Listen on port 8088 on localhost and IP 10.19.21.23, and forward the traffic to port 5000 inside the frontend-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-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 criter... |
Create a deployment named 'registry' using the wordpress image and expose port 5001 | Command:
```bash
kubectl create deployment registry --image=wordpress --port=5001
```
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 ... |
Auto scale the log-aggregator deployment with a minimum of 5 pods and a maximum of 14 pods. Use the default autoscaling policy. | Command:
```bash
kubectl autoscale deployment log-aggregator --min=5 --max=14
```
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 th... |
Set the custom TLS server name 'galaxy-cluster' for the 'cluster-alpha' cluster entry. | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=galaxy-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] [--certific... |
Create a job named security-scan-job with the centos image, and execute the "sleep 3600" command. | Command:
```bash
kubectl create job security-scan-job --image=centos -- 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 for... |
Expose the replica controller ruby on port 8088, connecting to the containers on port 818100. | Command:
```bash
kubectl expose rc ruby --port=8088 --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. A... |
Start a pod named 'hazelcast' using the 'alpine' image and configure the container to expose port 27017. | Command:
```bash
kubectl run hazelcast --image=alpine --port=27017
```
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": "--... |
Import the keys "external_api_url" from the config map "app-config-prod" into the deployment "database-deployment" | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-config-prod deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Forward traffic from local port 5000 to port 8088 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 5000: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 criteria, a pod will be selected aut... |
Create an ingress with a default backend for the specified host and port | Command:
```bash
kubectl create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="site.com/*=svc:8181,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": "--o... |
Set the service account of the 'proxy-service-deployment' deployment to 'elasticsearch' | Command:
```bash
kubectl set serviceaccount deployment proxy-service-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:... |
Create a debug copy of a pod called mypod, changing all container images to ethereum/client-go | Command:
```bash
kubectl debug mypod --copy-to=dgb-img --set-image=*=ethereum/client-go
```
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 new service of type ExternalName named "external-caching-service" with the external name "tutorial-ai.ai" | Command:
```bash
kubectl create service externalname external-caching-service --external-name tutorial-ai.ai
```
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... |
Set the resource request and limits for all containers in the amazonlinux deployment | Command:
```bash
kubectl set resources deployment amazonlinux --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 resource ... |
Configure auto scaling for a replication controller named "email" with the target CPU utilization set to 60% | Command:
```bash
kubectl autoscale rc email --max=4 --cpu-percent=60
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses t... |
Start a pod with the name 'hazelcast' using the Ubuntu image and expose port 8088 | Command:
```bash
kubectl run hazelcast --image=ubuntu --port=8088
```
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... |
Import the DEBUG_MODE key from the config map 'app-settings' and set it as an environment variable for the 'load-balancer-deployment' deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-settings deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Create a deployment named "mattermost" that uses the "php" image. | Command:
```bash
kubectl create deployment mattermost --image=php
```
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|na... |
Create an ingress called 'private-service-ingress' that directs requests to website.com/input to the service 'svc1' on port 9090, with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="website.com/input=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":... |
Stream the logs of the 'cosmic-container' container in the 'auth-service-pod' pod | Command:
```bash
kubectl logs -f -c cosmic-container 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": "--contain... |
Execute the 'node' command in the pod media-stream-pod and get the output | Command:
```bash
kubectl exec media-stream-pod -- 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, use the kubectl.kub... |
Forward traffic from local port 6379 to port 5000 in the pod selected by the 'authentication-service-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 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, ... |
Listen on port 8081 locally, and forward traffic to port 8080 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward pod/frontend-pod 8081:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create an ingress called 'api-gateway-ingress' that directs requests from site.com/example to svc1:3000, using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/example=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Set a custom TLS server name for the "cloud-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=e2e
```
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-authori... |
Create a cluster role named "foo" with the verb "create" and the NonResourceURL "/metrics" specified. | Command:
```bash
kubectl create clusterrole "foo" --verb=create --non-resource-url=/metrics
```
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", "short"... |
Create a deployment named loadbalancer with the postgres image and expose port 7000 | Command:
```bash
kubectl create deployment loadbalancer --image=postgres --port=7000
```
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. O... |
Auto scale the replication controller "media-stream" to have a minimum of 1 pod and a maximum of 5 pods, with a target CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc media-stream --max=5 --cpu-percent=50
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that... |
Create a new config map named namespace-config by reading key=value pairs from the file at the specified path | Command:
```bash
kubectl create configmap namespace-config --from-file=path/to/parameters
```
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 ba... |
Retrieve snapshot logs from all containers in pods identified by the label "role=database". | Command:
```bash
kubectl logs -l role=database --all-containers=true
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--containe... |
Retrieve the logs from the container "database-deployment-1" of the deployment named "payment-gateway-pod" | Command:
```bash
kubectl logs deployment/database-deployment -c payment-gateway-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:
"f... |
Create a pod running the `mongo` image and expose port `6379` | Command:
```bash
kubectl run hazelcast --image=mongo --port=6379
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Execute the command 'jenkins --version' in the 'code-explorer' container of the 'analytics-pod' pod and display the output. | Command:
```bash
kubectl exec analytics-pod -c code-explorer -- jenkins --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Set the cluster field in a context to connect to a cloud cluster | Command:
```bash
kubectl config set contexts.user-a-context.cluster cloud-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 ... |
Remove the label 'bar' from the pod 'cdn' | Command:
```bash
kubectl label pods cdn tier-
```
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, ch... |
Scale the 'api-service-rs' replica set to 1 replica | Command:
```bash
kubectl scale --replicas=1 rs/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-version is specified, it is valid... |
Add a taint with key 'disktype' on nodes having label namespace=mynamespace, and the taint should be 'PreferNoSchedule' for the node 'edge-node-10' | Command:
```bash
kubectl taint node -l namespace=mynamespace 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": "", "... |
Listen on local port 8080 and forward data to/from port 8080 in the email-server deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8080 8080
```
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 copy of a pod called web-app-pod, but change all container images to wordpress. | Command:
```bash
kubectl debug web-app-pod --copy-to=dgb-img --set-image=*=wordpress
```
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 resource ... |
Forward local port 3000 to port 5000 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 3000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Create a service for an ubuntu deployment, exposing port 6379 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose deployment ubuntu --port=6379 --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... |
Get a list of deployments using the "alpha-2.0" version of the "api-v2" API group in JSON format. | Command:
```bash
kubectl get deployments.alpha-2.0.api-v2 -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 ... |
Add a taint with key 'datacenter' on nodes having label environment=production | Command:
```bash
kubectl taint node -l environment=production datacenter=storage-node-13: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":... |
Delete the pods and services named "vpn" and "auth" | Command:
```bash
kubectl delete pod,service vpn auth
```
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 r... |
Retrieve the logs of the previous terminated "rocket-ranger" container from the pod "gateway-pod". | Command:
```bash
kubectl logs -p -c rocket-ranger gateway-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sh... |
Attach to the rocket-ranger container in the database-pod and enter raw terminal mode to interact with the container's bash shell | Command:
```bash
kubectl attach database-pod -c rocket-ranger -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omit... |
Start a proxy to the Kubernetes API server on port 8083 and serve static content from ./local/www/ | Command:
```bash
kubectl proxy --port=8083 --www=./local/www/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote... |
Update the annotation of pod 'frontend' with the value 'https://github.com/example/my-app' | Command:
```bash
kubectl annotate pods frontend git-repo='https://github.com/example/my-app'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than lab... |
Listen on port 8081 on all addresses and forward the traffic to port 3000 in the cdn-service-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 criteria, a pod w... |
Listen on port 8081 locally and forward data to/from port 3000 in the 'chat-app-pod' pod | Command:
```bash
kubectl port-forward pod/chat-app-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 criteria, a pod will be selected autom... |
Create a deployment named logging using the hazelcast image and expose port 5432. | Command:
```bash
kubectl create deployment logging --image=hazelcast/hazelcast --port=5432
```
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... |
Create an ingress called 'web-ingress' that directs requests to website.com/module to the service 'svc1' on port 3000, with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress web-ingress --rule="website.com/module=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Create a debug container in gateway-pod by using the kubectl debugger plugin | Command:
```bash
kubectl debug gateway-pod -it --copy-to=my-custom-dbg --image=debian --set-image=logger=logging-app:debug,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 deployment named "gitlab" using the "postgres" image and expose port 8181. | Command:
```bash
kubectl create deployment gitlab --image=postgres --port=8181
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Create a deployment named registry that runs the php image and exposes port 8000 | Command:
```bash
kubectl create deployment registry --image=php --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: js... |
Create a new secret named private-key-secret from an environment file | Command:
```bash
kubectl create secret generic private-key-secret --from-env-file=path/to/configurations.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to... |
Create an ingress called 'default-ingress' that directs requests to website.com/module to a specific service with a TLS secret. | Command:
```bash
kubectl create ingress default-ingress --rule="website.com/module=svc1:5000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Autoscale the deployment "gateway" with a minimum of 7 pods and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment gateway --min=7 --max=15
```
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 annotation 'backup-strategy' to 'daily-backups' for pod 'log-aggregator', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods log-aggregator backup-strategy='daily-backups'
```
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 tha... |
Forward local ports 8081 to 8000 and 6000 to 6000 for the deployment called "email-server-deployment" | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8081 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... |
Create a single ingress called 'internal-ingress' that directs requests to website.com/bar to svc1:8082 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress internal-ingress --rule="website.com/bar=svc1:8082,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Import the private key secret into the 'web-app-deployment' deployment as environment variables | Command:
```bash
kubectl set env --from=secret/private-key-secret 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 one or more po... |
Create a cluster role named "view" with the specific permissions to delete pods and access resource names "message-queue" and "identity-provider" | Command:
```bash
kubectl create clusterrole view --verb=delete --resource=pods --resource-name=message-queue --resource-name=identity-provider
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client... |
Auto scale the "security" deployment with a minimum of 3 pods and a maximum of 8 pods. | Command:
```bash
kubectl autoscale deployment security --min=3 --max=8
```
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... |
Listen on port 5432 on your local machine and forward it to port 8088 inside the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward pod/frontend-pod 5432: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 criteria, a pod will be selected autom... |
Copy the /tmp/foo_dir directory from the remote pod kubeapps/database-pod-2 to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp kubeapps/database-pod-2:/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 the ku... |
Create a deployment named "db" with the redis image and 4 replicas. | Command:
```bash
kubectl create deployment db --image=redis --replicas=4
```
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|... |
View the revision history of a daemonset by specifying the revision number | Command:
```bash
kubectl rollout history daemonset/test --revision=3
```
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 URL to fi... |
Forward traffic from port 6379 on all addresses to port 8888 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 6379:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
Edit the frontend-service service using the Emacs editor. | Command:
```bash
KUBE_EDITOR="emacs" kubectl edit svc/frontend-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variabl... |
Add a taint with key 'dedicated' on nodes having label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp 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": "", "usag... |
create a secret named app-config-secret from an env file | Command:
```bash
kubectl create secret generic app-config-secret --from-env-file=path/to/profiles.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the ba... |
Create an ExternalName service with the name "external-cloud-storage-service" and the external name "museum-example.museum" | Command:
```bash
kubectl create service externalname external-cloud-storage-service --external-name museum-example.museum
```
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 re... |
List deployments in JSON output format for the "v1.0.0" version of the "extensions" API group | Command:
```bash
kubectl get deployments.v1.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... |
Create an ingress called 'website-ingress' that directs requests from testing.com/input to svc1:8083, using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/input=svc1:8083,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Retrieve the snapshot logs from the container "mypod-1" in the "search-engine-deployment" deployment. | Command:
```bash
kubectl logs deployment/search-engine-deployment -c mypod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--... |
Create a service called "ruby" for the replicated ruby using a replica set | Command:
```bash
kubectl expose rs ruby --port=8000 --target-port=637900
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
List the resource(s) by their type and name | Command:
```bash
kubectl get rc/web service/e-commerce-rc pods/email-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 names... |
Create a job with a specific command | Command:
```bash
kubectl create job cleanup --image=jenkins -- jenkins-plugin-cli
```
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 form... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/log-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 definitions in... |
Forward traffic from local port 8000 to port 5000 in a pod selected by the monitoring-stack-deployment deployment | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8000 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 ... |
Apply a taint with key 'datacenter' and value 'prod-node-5:PreferNoSchedule' on all nodes that have the label 'component=proxy' | Command:
```bash
kubectl taint node -l component=proxy datacenter=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... |
Get output from the first pod of replica set named golang | Command:
```bash
kubectl attach rs/golang
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kuber... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-name-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 ... |
Create a service for a replicated ruby using a replica set, serving on port 8010 and connecting to the containers on port 700000. | Command:
```bash
kubectl expose rs ruby --port=8010 --target-port=700000
```
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... |
Import the REDIS_HOST key from the config map named "namespace-config" and set it as environment variable for the "log-aggregator-deployment" deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/namespace-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 def... |
Add a taint with the key 'app=prod-node-5' on nodes that have the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace app=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"... |
Embed the client certificate data found in the ~/.kube/admin.crt file into the "dev-user" entry for kubectl configuration. | Command:
```bash
kubectl config set-credentials dev-user --client-certificate=~/.kube/admin.crt --embed-certs=true
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-... |
Apply a taint to the node 'worker-node-3' with the key 'datacenter' and value 'dc-1' and effect 'NoExecute' | Command:
```bash
kubectl taint nodes worker-node-3 datacenter=dc-1:NoExecute
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. ... |
Create a pod named nginx using the centos image, but customize the pod specification using a JSON override. | Command:
```bash
kubectl run nginx --image=centos --overrides='{ "apiVersion": "dev-2.2.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] -- [COM... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.