prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a debug copy of the analytics pod by adding a debugger container and changing container images | Command:
```bash
kubectl debug analytics-pod -it --copy-to=my-debugger --image=debian --set-image=scheduler=my-scheduler:1.0,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by reso... |
Create an ingress called 'app1-ingress' that directs requests to a specific service using a TLS certificate | Command:
```bash
kubectl create ingress app1-ingress --rule="testing.com/example=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": "", "usa... |
Copy credentials from a remote pod to a local directory | Command:
```bash
kubectl cp istio-system/security-scanner-pod-18:/var/run/secrets/kubernetes.io/serviceaccount/ /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": "", "... |
Forward local traffic on port 9090 to a pod selected by the deployment api-server-deployment on port 8080 | Command:
```bash
kubectl port-forward deployment/api-server-deployment 9090 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 b... |
Forward port 3000 on localhost and IP 10.19.21.23 to port 9090 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 3000: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 criter... |
Create a new LoadBalancer service named e-commerce-lb that maps port 8089 on the service to port 8888 on the backend pods. | Command:
```bash
kubectl create service loadbalancer e-commerce-lb --tcp=8089:8888
```
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... |
Forward traffic from local ports 8088 and 6000 to the frontend-pod's ports 8080 and 6000 respectively | Command:
```bash
kubectl port-forward pod/frontend-pod 8088 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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --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 def... |
Copy the local file '/tmp/foo' to the '/tmp/bar_dir' directory inside the 'kube-public/cache-pod-5' pod in the default namespace. | Command:
```bash
kubectl cp /tmp/foo kube-public/cache-pod-5:/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 kubect... |
Copy the local file "/tmp/foo" to the remote pod named "istio-system/auth-service-pod-11" in the namespace, and place it in the remote directory "/tmp/bar_dir". | Command:
```bash
kubectl cp /tmp/foo istio-system/auth-service-pod-11:/tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Create a pod disruption budget named cron-jobs-pdb that will select all pods with the app=nginx label and require at least 20% of the pods selected to be available at any point in time | Command:
```bash
kubectl create pdb cron-jobs-pdb --selector=app=nginx --min-available=20%
```
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-run=server|cl... |
Set the CPU limits of the Kafka container in the deployment to "50m" and the memory limits to "4Gi" | Command:
```bash
kubectl set resources deployment kafka -c=nginx --limits=cpu=50m,memory=4Gi
```
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 it... |
Create a secret named `oauth-secret` from an environment file | Command:
```bash
kubectl create secret generic oauth-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 the b... |
Scale the 'prod-app-rs' replica set to 5 replicas | Command:
```bash
kubectl scale --replicas=5 rs/prod-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-version is specified, it is validate... |
Update the environment variable MONGO_URI of the deployment 'mydeployment' to mongodb://localhost:27017/mydb | Command:
```bash
kubectl set env deployment/mydeployment MONGO_URI=mongodb://localhost:27017/mydb
```
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 ... |
Remove the taint with key 'disktype' and effect 'NoSchedule' from node 'gpu-node-12' if it exists. | Command:
```bash
kubectl taint nodes gpu-node-12 disktype:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Create a job with a specific command to run in the container | Command:
```bash
kubectl create job testing --image=nginx -- nginx -g "daemon off;"
```
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 fo... |
Copy the file '/tmp/foo' from the pod 'kube-node-lease/load-balancer-pod-9' to the local directory '/tmp/bar' | Command:
```bash
kubectl cp kube-node-lease/load-balancer-pod-9::/tmp/foo /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 t... |
Forward local traffic on port 3000 to port 3000 of the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward pod/proxy-server-pod 3000: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 a... |
Create a new config map named app-settings using specified keys and files | Command:
```bash
kubectl create configmap app-settings --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... |
Add a taint to a node called 'node-1' with the key 'special' and no value | Command:
```bash
kubectl taint nodes node-1 special:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|y... |
Update the annotation 'contact-email' of the pod 'backend' to 'support@example.com' | Command:
```bash
kubectl annotate pods backend contact-email=support@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 incl... |
Start port forwarding on local port 9090, forwarding traffic to and from the pod selected by the database-deployment deployment on port 9090. | Command:
```bash
kubectl port-forward deployment/database-deployment 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 ... |
Create an ingress named 'app-proxy-ingress' with a rule that directs requests to 'testing.com/bar' to 'svc1:9092' | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/bar=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": "", "us... |
Execute the "go run hello.go" command in the "astro-container" container of the "analytics-pod" pod and display the output. | Command:
```bash
kubectl exec analytics-pod -c astro-container -- go run hello.go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Listen on ports 8088 and 6000 locally, forwarding data to/from ports 8088 and 6000 in a pod selected by the authentication-service-deployment deployment | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 8088 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, ... |
Output the modified frontend-deployment deployment in YAML format, without making changes to the deployment on the server | Command:
```bash
kubectl set env deployment/frontend-deployment SECRET_KEY=your-secret-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... |
Update the resource limits for the 'mongo' deployment's 'nginx' container | Command:
```bash
kubectl set resources deployment mongo -c=nginx --limits=cpu=3,memory=64Mi
```
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 its... |
Create a single ingress called 'service-ingress' that directs requests to foo.com/input to the svc1 service on port 8443 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="foo.com/input=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": "", "usage"... |
Attach to a pod named chat-app-pod using the rocket-ranger container and switch to raw terminal mode | Command:
```bash
kubectl attach chat-app-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... |
Create a role binding for multiple users and a group using a specific cluster role | Command:
```bash
kubectl create rolebinding bar --clusterrole=bar --user=user1 --user=user2 --group=group1
```
What it does:
Create a role binding for a particular role or cluster role.
Syntax:
`kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=name... |
Create a deployment named "gateway" with the image "ubuntu" and expose port 8081. | Command:
```bash
kubectl create deployment gateway --image=ubuntu --port=8081
```
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: ... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-config-prod deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Listen on port 9090 on localhost and IP 10.19.21.23, and forward the traffic to port 9090 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-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 criter... |
Update the annotation of the pod 'proxy' with the value 'staging' for the annotation 'env' | Command:
```bash
kubectl annotate pods proxy env=staging
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string val... |
Copy a file from a local directory to a remote pod in a given namespace | Command:
```bash
kubectl cp :/tmp/foo kubeapps/api-server-pod-3::/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 kubect... |
Create an ingress rule named 'app1-ingress' that directs requests from 'site.com/input' to 'svc1:8000' with the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/input=svc1:8000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Forward traffic from your local port 8088 to port 3000 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 8088: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 automaticall... |
Create a service for a deployment, serving on port 8082 and connecting to containers on port 330600 | Command:
```bash
kubectl expose deployment node --port=8082 --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... |
Create a new LoadBalancer service named payment-gateway-lb with the mapping of TCP port 8089 to container port 8000 | Command:
```bash
kubectl create service loadbalancer payment-gateway-lb --tcp=8089:8000
```
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", ... |
Remove the taint with key 'cpu-type' and effect 'NoSchedule' from the 'storage-node-13' node | Command:
```bash
kubectl taint nodes storage-node-13 cpu-type: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... |
Create a new ClusterIP service named notification-service-clusterip listening on port 6379 and forwarding traffic to port 8181 | Command:
```bash
kubectl create service clusterip notification-service-clusterip --tcp=6379:8181
```
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":... |
Create a service for the alpine deployment with port 8081, which connects to the containers on port 808200. | Command:
```bash
kubectl expose deployment alpine --port=8081 --target-port=808200
```
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... |
Create a deployment named 'gateway' that runs the 'node' image | Command:
```bash
kubectl create deployment gateway --image=node
```
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... |
Create a new nginx pod using the node image, but override some of the spec values by providing a JSON object with the desired changes. | Command:
```bash
kubectl run nginx --image=node --overrides='{ "apiVersion": "custom-version", "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] -- [... |
change the service account of the deployment named 'authentication-service-deployment' to 'kube-controller-manager' | Command:
```bash
kubectl set serviceaccount deployment authentication-service-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), s... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/monitoring-config deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variab... |
Create a secret named "my-secret" with two keys, "key1" and "key2", and their respective values as "supersecret" and "topsecret". | Command:
```bash
kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
```
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 ... |
Create a new config map named monitoring-config using the configurations from the 'configs.env' file | Command:
```bash
kubectl create configmap monitoring-config --from-env-file=path/to/configs.env
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to ... |
Explain the specific field "serviceName" in the "status" section of a service resource | Command:
```bash
kubectl explain resource=services.status.serviceName
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive fl... |
Import the "secret_key" from the "configmap/app-settings" into the environment variables of the "backend-microservice-deployment" deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-settings deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Forward data between local port 6379 and the pod selected by the "mydeployment" deployment. | Command:
```bash
kubectl port-forward deployment/mydeployment 6379 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selecte... |
Create a job named "database-seeding-job" using the "golang" image with the command "go". | Command:
```bash
kubectl create job database-seeding-job --image=golang -- go
```
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. ... |
Apply a taint with the key 'cpu-type' to nodes that have the label 'environment=production'. | Command:
```bash
kubectl taint node -l environment=production cpu-type=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": "", "... |
Import the "log_level" key from the "app-settings" config map into the environment variables of the "order-processing-deployment" deployment. | Command:
```bash
kubectl set env --keys=log_level --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 defini... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ local file to the /etc/kubernetes directory in the remote pod named load-balancer-pod-9 in the kube-node-lease namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kube-node-lease/load-balancer-pod-9:/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": "",... |
Start a php pod with the name busybox and keep it in the foreground. Do not restart the pod if it exits. | Command:
```bash
kubectl run -i -t busybox --image=php --restart=Never
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag":... |
Create an ingress named 'app-ingress' that routes requests to 'website.com/module' to 'svc1:5432' using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app-ingress --rule="website.com/module=svc1:5432,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Create a service for the replication controller specified in the "alpine-controller.yaml" file, serving on port 8084 and connecting to the containers on port 801000. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=8084 --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... |
Forward local ports 8088 and 6000 to ports 6379 and 6000 in a pod selected by the deployment "search-engine-deployment" | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8088 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Create an ingress named 'api-v1-ingress' with a rule that directs requests for 'website.com/bar' to the service 'svc1' on port '9092' | Command:
```bash
kubectl create ingress api-v1-ingress --rule="website.com/bar=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": "", "usage... |
Forward local port 8000 to port 6379 on the api-service-pod pod | Command:
```bash
kubectl port-forward pod/api-service-pod 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 pod will be selected au... |
Create an ingress named 'api-v1-ingress' that routes requests to foo.com/example to svc1:9090 using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.com/example=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": "", "usage... |
Create a service for a replicated application, serving on port 5432 and connecting to the containers on port 8080 | Command:
```bash
kubectl expose rc python --port=5432 --target-port=808800
```
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.... |
Execute the `gem --version` command inside the `chat-app-pod` pod and display the output. | Command:
```bash
kubectl exec chat-app-pod -- gem --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubect... |
Set the cluster field of the service-account-context context to web-cluster. | Command:
```bash
kubectl config set contexts.service-account-context.cluster web-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 val... |
Create a job named 'data-migration-job' using the 'alpine' image, and execute the command 'apk add curl' within the job. | Command:
```bash
kubectl create job data-migration-job --image=alpine -- apk add curl
```
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 ... |
Execute the command 'docker run ubuntu echo "Hello, World"' in the proxy-server-pod pod, and get the output from the first container. | Command:
```bash
kubectl exec proxy-server-pod -- docker run ubuntu echo "Hello, World"
```
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... |
Create a single ingress called 'service-ingress' that directs requests to website.com/bar to svc1:3001 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/bar=svc1:3001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Create a service for the replication controller specified in "nginx-controller.yaml", serving on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=5000 --target-port=909100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the ... |
Update the pod 'email' by removing the annotation named 'description' if it exists | Command:
```bash
kubectl annotate pods email description-
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string va... |
Partially update a node by applying a strategic merge patch as specified in the provided YAML configuration | Command:
```bash
kubectl patch node db-node-7 -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 FIL... |
Create a new config map named global-config based on the preferences folder | Command:
```bash
kubectl create configmap global-config --from-file=path/to/preferences
```
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 a deployment named "registry" using the "php" image and expose port 9090 | Command:
```bash
kubectl create deployment registry --image=php --port=9090
```
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 ingress called 'website-ingress' that directs requests to testing.com/input to svc1:3000 using the secret "my-cert" for TLS encryption. | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/input=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": "", "us... |
Create a debug copy of payment-gateway-pod with all container images changed to node | Command:
```bash
kubectl debug payment-gateway-pod --copy-to=debug-image-api --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 n... |
Forward local port 5000 to the targetPort of the "https" port in the web-service service. | Command:
```bash
kubectl port-forward service/web-service 5000: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 a... |
Return the snapshot logs from the container 'api-service-pod-1' of the 'email-server-deployment' deployment | Command:
```bash
kubectl logs deployment/email-server-deployment -c api-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 flags:
"f... |
Import environment variables from a secret to a deployment. | Command:
```bash
kubectl set env --from=secret/gcp-service-account-secret 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 definitions in one o... |
Check if you have permission to list the job named "notification-sender-job" in the "testing" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/notification-sender-job -n testing
```
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 partia... |
Create a single ingress called 'api-v1-ingress' that directs requests to website.com/input to svc1:8088 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="website.com/input=svc1:8088,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... |
Delete both the "log-aggregator" pod and service, as well as the "web" pod and service | Command:
```bash
kubectl delete pod,service log-aggregator web
```
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 select... |
Set the resource request and limits for all containers in the runtime deployment | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=cpu=1,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 request... |
create an ingress called 'app1-ingress' that directs requests to foo.com/module to svc1:5000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app1-ingress --rule="foo.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": "", "usage": ... |
Edit the 'order-service' service using the 'atom' editor. | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/order-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 variables, ... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/monitoring-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variab... |
Forward traffic from port 8088 on localhost and IP address 10.19.21.23 to port 8081 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 8088: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 th... |
Remove the taint with key 'dedicated' and effect 'NoSchedule' from the node 'backup-node-14', if one exists. | Command:
```bash
kubectl taint nodes backup-node-14 dedicated: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... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/env-vars 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... |
Copy the local file "/tmp/foo" to the remote pod "auth-service-pod-11" in the "kube-public" namespace, and place it at "/tmp/bar". | Command:
```bash
kubectl cp :/tmp/foo kube-public/auth-service-pod-11:/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 k... |
Forward local port 3000 to port 8080 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 3000: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 automa... |
Start streaming the logs of the nebula-navigator container in the email-service-pod pod | Command:
```bash
kubectl logs -f -c nebula-navigator email-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": "--contai... |
Launch a python pod named 'nginx' and use the 'python' image, but override the specifications with the partial set of values provided in the given JSON object | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "hotfix-1.1.2", "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] -- [... |
Forward traffic from port 8000 on all addresses to port 8088 in the api-service-pod pod. Listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8000: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 w... |
Copy the local file /tmp/foo_dir to the /tmp/bar directory in the auth-service-pod-11 pod in the kube-system namespace | Command:
```bash
kubectl cp /tmp/foo_dir kube-system/auth-service-pod-11::/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 t... |
Import the CONFIG_FILE_PATH key from the ui-config ConfigMap into the backend-microservice-deployment deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/ui-config deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Create a new config map named kube-system-config using the files in the folder path/to/configs. | Command:
```bash
kubectl create configmap kube-system-config --from-file=path/to/configs
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the bas... |
Set the service account of the deployment named "log-aggregator-deployment" to "dashboard". | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-deployment dashboard
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`k... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-secrets 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 new ExternalName service named external-metrics-service with the external name "mockup-cloud.cloud" | Command:
```bash
kubectl create service externalname external-metrics-service --external-name mockup-cloud.cloud
```
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 s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.