prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
forward the traffic from port 5432 on localhost and IP 10.19.21.23 to port 5432 in the pod named 'mypod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 p... |
Add a taint to node 'db-node-7' with key 'app', value 'backend', and effect 'PreferNoSchedule' | Command:
```bash
kubectl taint nodes db-node-7 app=backend:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. O... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/ui-config deployment/user-management-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 new ClusterIP service with the name "inventory-service-clusterip" | Command:
```bash
kubectl create service clusterip inventory-service-clusterip --tcp=8089: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": "-... |
Auto scale the deployment "api" with a minimum of 6 pods and a maximum of 11 pods. | Command:
```bash
kubectl autoscale deployment api --min=6 --max=11
```
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... |
View the most recent 43 lines of logs for the pod "cdn-service-pod" | Command:
```bash
kubectl logs --tail=43 cdn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": ... |
Delete pods and services with the names "vpn" and "frontend" | Command:
```bash
kubectl delete pod,service vpn frontend
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
So... |
Update the nginx container image from a local file without hitting the server and print the result in YAML format | Command:
```bash
kubectl set image -f path/to/file.yaml postgres=postgres:13.4 --local -o yaml
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), re... |
Create a new ExternalName service named external-logging-service and set the external name to tutorial-ai.ai | Command:
```bash
kubectl create service externalname external-logging-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... |
Create a pod disruption budget named 'batch-processing-pdb' that will select all pods with the 'version=v2' label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=version=v2 --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=... |
Create a service for the replication controller specified in "alpine-controller.yaml" with the service port set to 8443 and the target port set to 808100. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=8443 --target-port=808100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Create an ingress called 'public-ingress' that redirects requests to testing.com/module to svc1:7000 with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="testing.com/module=svc1:7000,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 new pod named 'hazelcast' using the 'python' image and expose port 8088 | Command:
```bash
kubectl run hazelcast --image=python --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... |
Update the environment variable 'DB_HOST' for the deployment 'api-server-deployment' | Command:
```bash
kubectl set env deployment/api-server-deployment DB_HOST=localhost
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates ... |
Output the updated YAML configuration of the "email-server-deployment" deployment with a modified environment variable "PORT" set to "8080" | Command:
```bash
kubectl set env deployment/email-server-deployment PORT=8080 -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 pod template... |
Create a NodePort service named database-nodeport, forwarding traffic from port 3000 on the cluster to port 8081 on the service. | Command:
```bash
kubectl create service nodeport database-nodeport --tcp=3000:8081
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ""... |
Forward traffic from port 8080 on all addresses to port 8888 inside the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8080: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 pod will be sel... |
Create a service for a replicated python using replica set, serving on port 5000 and connecting to the containers on port 8000 | Command:
```bash
kubectl expose rs python --port=5000 --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 specified port.... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=log_level --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 definitions... |
Remove the taint on node 'storage-node-13' with key 'workload' and effect 'NoSchedule', if it exists. | Command:
```bash
kubectl taint nodes storage-node-13 workload: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 the 'max_connections' key from the 'app-config' config map into the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-config deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Execute the command 'go run hello.go' inside the first container of the pod of the deployment 'search-engine-deployment'. | Command:
```bash
kubectl exec deploy/search-engine-deployment -- 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 om... |
Create a service for the replication controller specified in the hazelcast-controller.yaml file | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=8010 --target-port=808400
```
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 ... |
Create a copy of the frontend pod with all container images changed to Alpine | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-app --set-image=*=alpine
```
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 res... |
Taint nodes with label tier=frontend with a CPU type preference | Command:
```bash
kubectl taint node -l tier=frontend cpu-type=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Create a job named 'monitoring-job' using the 'redis' image and run the command 'redis-server --version' | Command:
```bash
kubectl create job monitoring-job --image=redis -- redis-server --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
import the specific keys 'API_KEY' from the 'monitoring-config' ConfigMap into the 'gateway-deployment' Deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/monitoring-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions ... |
Set the custom TLS server name to use for validation for the "cloud-cluster" cluster entry as "star-cluster" | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=star-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] [--certificat... |
Set a custom TLS server name for cluster-gamma cluster entry | Command:
```bash
kubectl config set-cluster cluster-gamma --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... |
Apply a taint to the node 'k8s-node-1' with the key 'environment', value 'production', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes k8s-node-1 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": "Output for... |
Update the metadata of a pod specified in the pod.json file by adding an annotation "SLA" with the value "99.9% uptime". | Command:
```bash
kubectl annotate -f pod.json SLA='99.9% uptime'
```
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 st... |
Print the result of updating the nginx container image from a local file in yaml format without hitting the server. | Command:
```bash
kubectl set image -f path/to/file.yaml debian=debian:11.0 --local -o yaml
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replic... |
Start a pod named 'nginx' using the image 'confluentinc/cp-kafka', but modify the pod's spec with a partial set of values parsed from a JSON string | Command:
```bash
kubectl run nginx --image=confluentinc/cp-kafka --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]... |
Create a job named report-generation-job with the centos image and run the command "yum install -y wget". | Command:
```bash
kubectl create job report-generation-job --image=centos -- yum install -y wget
```
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"... |
Copy the file '/tmp/foo' from the remote pod 'cache-pod-5' to the local machine's '/tmp/bar' directory. | Command:
```bash
kubectl cp logging/cache-pod-5::/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 the kubectl.kuber... |
Get the specified resources by their types and names | Command:
```bash
kubectl get rc/web service/proxy-service-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 namesp... |
display only the most recent 20 lines of logs for the api-service-pod pod | Command:
```bash
kubectl logs --tail=20 api-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": ... |
Forward ports 6379 and 6000 from the local machine to ports 6379 and 6000 in the pod. | Command:
```bash
kubectl port-forward pod/mypod 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 selected automaticall... |
Get the output from running the 'composer --version' command from the first pod of the deployment 'email-server-deployment', using the first container. | Command:
```bash
kubectl exec deploy/email-server-deployment -- composer --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 ... |
Create a ClusterIP service named shipping-service-clusterip to expose port 5432 on the service and map it to port 8083 on the target | Command:
```bash
kubectl create service clusterip shipping-service-clusterip --tcp=5432:8083
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o... |
Output the modified deployment in YAML format without making any changes to the deployment object on the server | Command:
```bash
kubectl set env deployment/api-server-deployment S3_BUCKET=my-s3-bucket -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 p... |
Add a taint with the key 'special' on nodes that have the label instance=app-instance-1 | Command:
```bash
kubectl taint node -l instance=app-instance-1 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": ""... |
Create a deployment named "nats" with the image "confluentinc/cp-kafka" and expose port 9092. | Command:
```bash
kubectl create deployment nats --image=confluentinc/cp-kafka --port=9092
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output form... |
Forward local ports 8080 and 6000 to the corresponding ports in the pod | Command:
```bash
kubectl port-forward pod/api-service-pod 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 be selected au... |
Create a pod disruption budget named statefulset-pdb that will select all pods with the project=my-project label and require a minimum of four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=project=my-project --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-availab... |
Get the output from running the 'geth attach' command in the first container of the 'database-pod' pod. | Command:
```bash
kubectl exec database-pod -- geth attach
```
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.... |
Create a deployment named monitoring that runs the wordpress image with 2 replicas | Command:
```bash
kubectl create deployment monitoring --image=wordpress --replicas=2
```
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 "api" with the number of pods ranging from 1 to 6, targeting a CPU utilization of 40%. | Command:
```bash
kubectl autoscale rc api --max=6 --cpu-percent=40
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Forward local port 8888 to port 8000 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8888:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Forward all traffic on port 8088 to port 3000 inside the pod "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 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 w... |
Apply a taint with key 'cpu-type' on nodes labeled with 'zone=us-east-1' specifying the node name as 'db-node-7' and the taint effect as 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l zone=us-east-1 cpu-type=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
List deployments in YAML format for the "custom-deployments" API group, specifically in the "v1.0.0" version. | Command:
```bash
kubectl get deployments.v1.0.0.custom-deployments -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced ... |
Execute the 'ash' command in the 'code-explorer' container of the 'backend-pod' pod and display the output. | Command:
```bash
kubectl exec backend-pod -c code-explorer -- ash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Embed the certificate authority data for the my-k8s-cluster cluster entry with the certificate authority file located at ~/.kube/cluster-alpha/kubernetes.ca.crt | Command:
```bash
kubectl config set-cluster my-k8s-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/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 ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-config-dev 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 ... |
Delete the pods and services with the names "backend" and "log-aggregator" | Command:
```bash
kubectl delete pod,service backend log-aggregator
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label se... |
Add a taint with key 'hardware' on nodes having label environment=production | Command:
```bash
kubectl taint node -l environment=production hardware=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": "", "... |
Add a taint with key 'zone' and no value to the node 'node-2' | Command:
```bash
kubectl taint nodes node-2 zone: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|yaml... |
update deployment environment variable | Command:
```bash
kubectl set env deployment/api-server-deployment SMTP_USERNAME=your-username
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod ... |
Create a new config map named app-secrets with the keys 'conf' and 'data' using the files file1.txt and file2.txt located at /path/to/parameters/ directory. | Command:
```bash
kubectl create configmap app-secrets --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/path/to/parameters/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 ... |
Taint nodes with the label 'team=devops' and add a taint with key 'dedicated' and value 'backup-node-14:PreferNoSchedule'. | Command:
```bash
kubectl taint node -l team=devops 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":... |
Create a copy of the "web-app-pod" pod, adding a debug container and changing the container images to "debian" for the debug container and "nginx:latest" for the "web" container and "logging-app:debug" for the "logger" container. | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-memcached --image=debian --set-image=web=nginx:latest,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by ... |
Listen on port 8080 on localhost and IP address 10.19.21.23, and forward the traffic to port 8081 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-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 criteri... |
Create a copy of the "database-pod" pod, replacing the container image of all containers with the image "mcr.microsoft.com/dotnet/core/runtime" | Command:
```bash
kubectl debug database-pod --copy-to=debug-image-api --set-image=*=mcr.microsoft.com/dotnet/core/runtime
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods wi... |
Create a pod named 'nginx' with the image 'mcr.microsoft.com/dotnet/core/runtime', and override the spec with a partial set of values parsed from the JSON provided. | Command:
```bash
kubectl run nginx --image=mcr.microsoft.com/dotnet/core/runtime --overrides='{ "apiVersion": "v3.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inli... |
Update the pod 'foo' in the default namespace by adding or updating the annotation 'scaling-policy' with the value 'auto-horizontal-scaling' | Command:
```bash
kubectl annotate pods foo scaling-policy=auto-horizontal-scaling
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and inc... |
Create an ingress named 'app2-ingress' that directs requests for 'testing.com/bar' to 'svc1:8088' with a TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/bar=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": "", "usage":... |
Set a custom TLS server name for the "dev-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster dev-cluster --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] [--certificat... |
Create a copy of the payment-gateway-pod and change all container images to docker.elastic.co/elasticsearch/elasticsearch | Command:
```bash
kubectl debug payment-gateway-pod --copy-to=my-debugger --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 na... |
Retrieve the logs from container "e-commerce-pod-1" of the deployment "order-processing-deployment" | Command:
```bash
kubectl logs deployment/order-processing-deployment -c e-commerce-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:... |
Forward local port 9090 to port 9090 in the notification-handler-deployment pod | Command:
```bash
kubectl port-forward deployment/notification-handler-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 ... |
List deployments in JSON output format from the "my-apps" API group, in the version "v2.1.0" | Command:
```bash
kubectl get deployments.v2.1.0.my-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will on... |
Scale the mysql deployment to a size of 7, only if the current size of the app-v2-replicaset deployment is also 7 | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/app-v2-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-v... |
Create a new config map named ui-config with specified keys from the provided files | Command:
```bash
kubectl create configmap ui-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/options/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map ... |
Set the cpu limit of the mysql container in the deployment 'mysql' to 5 and the memory limit to 4Gi | Command:
```bash
kubectl set resources deployment mysql -c=nginx --limits=cpu=5,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 its ... |
Create a service for a replication controller by specifying the file "alpine-controller.yaml", assigning port 80 for the service, and connecting to the containers on port 8000. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=8082 --target-port=808400
```
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... |
Expose the nginx replica set as a service, serving on port 9092 and connecting to containers on port 543200. | Command:
```bash
kubectl expose rs nginx --port=9092 --target-port=543200
```
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. ... |
Wait for the "log-aggregator-pod" pod to be deleted after issuing the delete command | Command:
```bash
kubectl delete pod/log-aggregator-pod
kubectl wait --for=delete pod/busybox1 --timeout=60s
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given res... |
Update the pods with the name 'backend' and set the label 'status' to 'unhealthy', overwriting any existing value | Command:
```bash
kubectl label --overwrite pods backend status=unhealthy
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "fa... |
Set the 'criticality' annotation to 'high' for the pod named 'frontend' | Command:
```bash
kubectl annotate pods frontend criticality=high
```
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 st... |
Copy the local file `/tmp/foo` to the remote pod `logging-agent-pod-7` in the namespace `logging` at the destination path `/tmp/bar_dir`. | Command:
```bash
kubectl cp /tmp/foo logging/logging-agent-pod-7:/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... |
Forward data between local port 8888 and pod port 6379 of the 'web-app-deployment' deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8888 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 s... |
Create a service for the replicated ruby controller, which serves on port 3306 and connects to the containers on port 8888 | Command:
```bash
kubectl expose rc ruby --port=3306 --target-port=888800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Create an ingress named 'api-v1-ingress' with a rule that directs requests to 'site.com/module' to 'svc1' on port 9000 | Command:
```bash
kubectl create ingress api-v1-ingress --rule="site.com/module=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
forward local port 8000 to pod port 8088 | Command:
```bash
kubectl port-forward deployment/database-deployment 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 will be ... |
Set the CPU limit to "3" and memory limit to "64Mi" for the MySQL container in the deployment named "mysql". | Command:
```bash
kubectl set resources deployment mysql -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... |
Get detailed information about the 'worker-pod-4' pod. | Command:
```bash
kubectl describe pods/worker-pod-4
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a... |
Forward traffic from local port 8080 to port 6379 in the 'proxy-server-pod' pod, and also forward traffic from local port 6000 to port 6000 in the same pod. | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8080 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 a... |
Listen on port 5432 on all addresses, forwarding to port 9090 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 5432: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 ... |
Delete the pods and services named "vpn" and "security" | Command:
```bash
kubectl delete pod,service vpn 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.
So... |
Forward traffic from localhost port 8080 to port 6379 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8080: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 a... |
Add a taint with key 'environment' on nodes having label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack environment=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": "", "... |
Create an autoscaler for the replication controller "media-stream" with the following parameters: maximum number of pods is 2 and target CPU utilization is 50%. | Command:
```bash
kubectl autoscale rc media-stream --max=2 --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... |
Update node 'edge-node-10' with a taint of key 'dedicated', value 'special-user', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes edge-node-10 dedicated=special-user: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 f... |
Create a secret named private-key-secret using values from an environment file. | Command:
```bash
kubectl create secret generic private-key-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 b... |
Copy the file named foo from the /tmp directory on the remote pod named admin-dashboard-pod-16 to the /tmp directory on your local machine. | Command:
```bash
kubectl cp velero/admin-dashboard-pod-16:/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 the kube... |
Retrieve the output from running the 'apache2ctl -D FOREGROUND' command inside the 'cyber-sleuth' container of the 'e-commerce-pod' pod. | Command:
```bash
kubectl exec e-commerce-pod -c cyber-sleuth -- apache2ctl -D FOREGROUND
```
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 nam... |
Forward traffic from local and selected IP to pod port | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 6379: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 crit... |
Forward local port 9090 to port 3000 of a pod selected by the deployment "database-deployment". | Command:
```bash
kubectl port-forward deployment/database-deployment 9090 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 ... |
Retrieve the output from running the 'mongo' command inside the 'stardust-shuttle' container of the 'auth-service-pod' pod. | Command:
```bash
kubectl exec auth-service-pod -c stardust-shuttle -- mongo
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.