prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy the file "/tmp/foo" from your local machine to the remote pod "worker-pod-4" in the "kube-flannel" namespace, and save it as "/tmp/bar". | Command:
```bash
kubectl cp :/tmp/foo kube-flannel/worker-pod-4::/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... |
Remove the specified environment variables for the "web-app" entry in the kubectl configuration. | Command:
```bash
kubectl config set-credentials web-app --exec-env=var-to-remove-
```
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-key=keyfile
Bearer token flags:
... |
Forward port 6379 from all addresses to port 8000 in the pod named chat-app-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 6379:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Add a taint to the 'storage-node-13' node with the key 'cpu-type' and no value to prevent new pods from being scheduled on it. | 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 ... |
force replace the resource defined in the './pod.json' file | Command:
```bash
kubectl replace --force -f ./pod.json
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replace -f FIL... |
Listen on port 5432 on all addresses and forward traffic to port 5000 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 5432: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 wi... |
Set up autoscaling for a replication controller named "analytics" with the target CPU utilization set at 50% and the number of pods ranging from 1 to 3. | Command:
```bash
kubectl autoscale rc analytics --max=3 --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 us... |
Import the 'smtp_server' key from the 'env-vars' config map into the 'order-processing-deployment' deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/env-vars 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 definiti... |
Copy the local file "/tmp/foo_dir" to the remote pod "backend-pod-13" in the "kube-system" namespace, and place it in the "/tmp/bar_dir" directory. | Command:
```bash
kubectl cp /tmp/foo_dir kube-system/backend-pod-13:/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... |
Create a new LoadBalancer service named 'auth-service-lb' and forward traffic from port 27017 to port 5001 | Command:
```bash
kubectl create service loadbalancer auth-service-lb --tcp=27017:5001
```
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", "d... |
Copy the local file /tmp/foo_dir to the remote pod kube-flannel/logging-agent-pod-7 in the /tmp/bar_dir directory | Command:
```bash
kubectl cp /tmp/foo_dir kube-flannel/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, u... |
Create a copy of a pod called frontend-pod, but change all container images to use postgres instead. | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-memcached --set-image=*=postgres
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default i... |
Create a new NodePort service named media-stream-nodeport with port mapping 5432:8888 | Command:
```bash
kubectl create service nodeport media-stream-nodeport --tcp=5432:8888
```
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"... |
Listen on port 5000 on your local machine and forward traffic to port 5432 on the web-app-pod pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 5000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Copy the local file /tmp/foo to the remote pod named security-scanner-pod-18 in the monitoring namespace, and place it in the /tmp/bar directory. | Command:
```bash
kubectl cp /tmp/foo monitoring/security-scanner-pod-18:/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... |
Listen on all addresses on port 3000 and forward the traffic to port 8081 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 3000:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wi... |
Set the cluster field in the my-context context to sun-cluster | Command:
```bash
kubectl config set contexts.cluster-2-context.cluster sun-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... |
Create a job named `database-seeding-job` with the image of `redis` and run the command `redis-server` inside the job. | Command:
```bash
kubectl create job database-seeding-job --image=redis -- redis-server
```
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... |
Forward traffic from port 8888 on all addresses to port 8080 in the 'security-service-pod', allowing access to the pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8888: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 ... |
Execute the command 'pg_dump --version' inside the first container of the pod in the deployment named notification-handler-deployment, and display the output. | Command:
```bash
kubectl exec deploy/notification-handler-deployment -- pg_dump --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 na... |
Forward local port 8080 to port 8088 in the 'api-service-pod' pod | Command:
```bash
kubectl port-forward pod/api-service-pod 8080 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 au... |
Create a new deployment named 'loadbalancer' that uses the 'php' image and exposes port 8083. | Command:
```bash
kubectl create deployment loadbalancer --image=php --port=8083
```
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... |
Forward local traffic from port 8000 to port 8080 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8000 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 aut... |
Forward traffic from port 5432 on localhost and IP 10.19.21.23 to port 6379 in the pod named backend-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 5432: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 criteri... |
Forward traffic from local port 6379 to the target port of the "https" service port in a pod selected by the "scheduler-service". | Command:
```bash
kubectl port-forward service/scheduler-service 6379: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 sele... |
Create a service for the replicated 'nginx' using the 'rc' controller, which serves on port '9092' and connects to the containers on port '801000' | Command:
```bash
kubectl expose rc nginx --port=9092 --target-port=801000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. ... |
Get the output of the 'elasticsearch --version' command from the first container of the first pod in the 'order-processing-deployment' deployment. | Command:
```bash
kubectl exec deploy/order-processing-deployment -- elasticsearch --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 ... |
List deployments in YAML output format for the specified API group and version | Command:
```bash
kubectl get deployments.legacy-1.0.0.internal-apps -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... |
Create an ingress named 'api-v2-ingress' that routes requests from testing.com/bar to svc1:8089 with tls secret 'my-cert' | Command:
```bash
kubectl create ingress api-v2-ingress --rule="testing.com/bar=svc1:8089,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Scale the deployment named "web" to have 3 replicas, provided that the current number of replicas is 1. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=3 deployment/web
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/global-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in on... |
Listen on port 8088 on localhost and IP address 10.19.21.23, forwarding the traffic to port 9090 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 8088: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 cri... |
Update the pod named 'proxy' with the annotation 'criticality' and set the value to 'high', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods proxy 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 a... |
Create a service to expose a replicated PHP application using a replica set | Command:
```bash
kubectl expose rs php --port=6379 --target-port=808300
```
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 ... |
Remove the taint with key 'zone' and effect 'PreferNoSchedule' from node 'backup-node-14' | Command:
```bash
kubectl taint nodes backup-node-14 zone: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. On... |
Create a new LoadBalancer service named web-app-lb that forwards traffic from port 8081 to port 3001. | Command:
```bash
kubectl create service loadbalancer web-app-lb --tcp=8081:3001
```
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", "default... |
Auto scale the deployment "security" with a minimum of 2 pods and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment security --min=2 --max=13
```
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 use... |
List the specific resources by their type and names | Command:
```bash
kubectl get rc/web service/database-rc pods/api-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespace... |
Create a new secret named 'cert-manager-secret' from the 'profiles.env' file | Command:
```bash
kubectl create secret generic cert-manager-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 ... |
Get the output from running the 'redis-cli' command in the 'cosmic-container' container from the 'security-service-pod' pod. | Command:
```bash
kubectl exec security-service-pod -c cosmic-container -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Apply a taint on nodes with a specific label | Command:
```bash
kubectl taint node -l customer=acme-corp cpu-type=web-node-8:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Add the annotation 'compliance-level' with the value 'PCI-DSS' to the pod 'auth' | Command:
```bash
kubectl annotate pods auth compliance-level=PCI-DSS
```
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 arbitrar... |
Start a Jenkins pod named "hazelcast" using the Jenkins image, and expose port 5432 | Command:
```bash
kubectl run hazelcast --image=jenkins --port=5432
```
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": "--... |
Get the output from running the 'geth' command in the first container of the first pod of the 'proxy-service-deployment' deployment. | Command:
```bash
kubectl exec deploy/proxy-service-deployment -- geth
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-name-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Add a taint with the key 'cpu-type' on nodes that have the label app=web-app | Command:
```bash
kubectl taint node -l app=web-app cpu-type=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Forward local port 6379 to port 8080 in the frontend-pod. | Command:
```bash
kubectl port-forward pod/frontend-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 criteria, a pod will be selected autom... |
List the container name and image of the pod with the name media-stream-pod. | Command:
```bash
kubectl get pod media-stream-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 ... |
Update the 'monitoring' pod with the annotation 'deployment-script' and the value 'https://example.com/deploy.sh' | Command:
```bash
kubectl annotate pods monitoring deployment-script='https://example.com/deploy.sh'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger t... |
Forward local port 8888 to port 8081 in the pod named "proxy-server-pod". | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8888 8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Forward port 5432 on localhost and IP 10.19.21.23 to port 8088 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-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 cri... |
Set the cluster field in the my-context context to dev-cluster | Command:
```bash
kubectl config set contexts.client-2-context.cluster dev-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 ... |
Set resource limits and requests for the containers in the wordpress deployment | Command:
```bash
kubectl set resources deployment wordpress --limits=cpu=200m,memory=512Mi --requests=cpu=5,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 reque... |
Import the SECRET_KEY key from the app-config-prod ConfigMap and set it as an environment variable for the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config-prod deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Forward local port 5000 to port 3000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 5000: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 auto... |
create a cron job named cleanup-task with the schedule "*/1 * * * *" and the command "irb" using the ruby image. | Command:
```bash
kubectl create cronjob cleanup-task --image=ruby --schedule="*/1 * * * *" -- irb
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default... |
import the LOG_LEVEL key from the app-config config map into the deployment/search-engine-deployment deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Copy the file "foo" from the "/tmp" directory of the remote pod "security-scanner-pod-18" in the "argocd" namespace to the local "/etc/kubernetes" directory. | Command:
```bash
kubectl cp argocd/security-scanner-pod-18::/tmp/foo /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Create a service for the replication controller specified in "hazelcast-controller.yaml" using the kubectl expose command, with the following options: | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=9091 --target-port=808300
```
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 ... |
Copy the `/var/run/secrets/kubernetes.io/serviceaccount/` file from the local machine to the `/tmp/bar` directory in the `rook-ceph/metrics-exporter-pod-10` pod in the specified namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ rook-ceph/metrics-exporter-pod-10:/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":... |
Forward local port 8088 to port 5000 inside the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 8088:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
import the 'REDIS_HOST' key from the 'app-config-prod' config map and set it as an environment variable in the 'notification-handler-deployment' deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-config-prod deployment/notification-handler-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... |
Execute the command 'redis-server --version' on the first pod of the 'database-service' service and retrieve the output. | Command:
```bash
kubectl exec svc/database-service -- redis-server --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 omitte... |
Create a job named "database-seeding-job" using the image "ethereum/client-go" and run the command "geth version" | Command:
```bash
kubectl create job database-seeding-job --image=ethereum/client-go -- geth 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": "", "us... |
Configure the certificate authority data for the "star-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/on-prem-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config ... |
Begin streaming the logs of the quantum-quark container in the proxy-server-pod pod | Command:
```bash
kubectl logs -f -c quantum-quark proxy-server-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"... |
Create a debug copy of the "proxy-service-pod" with the container "nebula-navigator" and start an interactive shell | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-api --container=nebula-navigator -- sh
```
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 us... |
Scale the stateful set named 'web' to 3 replicas | Command:
```bash
kubectl scale --replicas=3 statefulset/web
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is validat... |
Update the pod named 'api' by adding the label 'env' with the value 'production' | Command:
```bash
kubectl label pods api env=production
```
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... |
Retrieve the phase value of the pod named 'proxy-server-pod' | Command:
```bash
kubectl get -o template pod/proxy-server-pod --template={{.status.phase}}
```
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 typ... |
Create a pod running the mysql image and expose port 8082 | Command:
```bash
kubectl run hazelcast --image=mysql --port=8082
```
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... |
Remove all the taints with the key 'hardware' from the node 'backup-node-14' | Command:
```bash
kubectl taint nodes backup-node-14 hardware-
```
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|ya... |
Create a new config map named 'app-name-config' with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/options/file1.txt --from-file=data=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a co... |
Scale the deployment named backend-service-replicaset's to 1 replica if its current size is 1 | Command:
```bash
kubectl scale --current-replicas=1 --replicas=1 deployment/backend-service-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 --r... |
View the last-applied-configuration annotations in YAML for a specific deployment named "golang". | Command:
```bash
kubectl apply view-last-applied deployment/golang
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-applied... |
Add a taint with key 'app' on nodes having label owner=john-doe | Command:
```bash
kubectl taint node -l owner=john-doe app=gpu-node-12:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Remove the label 'unhealthy' from pod 'api' if it exists. | Command:
```bash
kubectl label pods api unhealthy-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If tru... |
Forward traffic from port 8081 on localhost and IP address 10.19.21.23 to port 8080 in the security-service-pod pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-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 th... |
Copy the contents of "/var/run/secrets/kubernetes.io/serviceaccount/" from the pod "message-broker-pod-15" in the "ingress-nginx" namespace to the local directory "/tmp/bar". | Command:
```bash
kubectl cp ingress-nginx/message-broker-pod-15:/var/run/secrets/kubernetes.io/serviceaccount/ /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... |
Setup autoscaling for the deployment "analytics" with a minimum of 3 pods and a maximum of 15 pods | Command:
```bash
kubectl autoscale deployment analytics --min=3 --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 us... |
Execute the command "kubectl exec" with the parameters "mypod" as the pod name and "-c time-machine" to specify the container name | Command:
```bash
kubectl exec mypod -c time-machine -- pip --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 t... |
Create an ingress called 'private-api-ingress' that directs requests to website.com/module to the svc1 service on port 8443, with the TLS secret "my-cert". | Command:
```bash
kubectl create ingress private-api-ingress --rule="website.com/module=svc1:8443,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ""... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ local file to /etc/kubernetes in the remote pod named worker-pod-4, specifically in the container named security-scanner. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ worker-pod-4:/etc/kubernetes -c security-scanner
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "u... |
Create an ingress resource named 'api-gateway-ingress' that routes requests from website.com/module to a service named 'svc1' and port '9091', and use the tls secret named 'my-cert'. | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="website.com/module=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ""... |
List the name and image of the container in a specific pod using custom columns. | Command:
```bash
kubectl get pod payment-gateway-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 t... |
Access the shell of the first pod in the gateway-deployment and run the 'ash' command | Command:
```bash
kubectl exec deploy/gateway-deployment -- 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 kub... |
Forward local port 8888 to the targetPort of the "https" service port in a pod selected by the "logging-service" service. | Command:
```bash
kubectl port-forward service/logging-service 8888: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 select... |
Create an ExternalName service named external-ldap-service that points to the external name test-site.org | Command:
```bash
kubectl create service externalname external-ldap-service --external-name test-site.org
```
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 services ... |
Change the cluster field in the specified context to a new cluster | Command:
```bash
kubectl config set contexts.client-2-context.cluster cluster-gamma
```
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 yo... |
Execute the command 'npm --version' inside the time-machine container of the pod named 'mypod' and retrieve the output. | Command:
```bash
kubectl exec mypod -c time-machine -- npm --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 t... |
Import the DEBUG_MODE key from the env-vars config map and set it as an environment variable in the api-server-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/env-vars 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 ... |
Copy the file /var/run/secrets/kubernetes.io/serviceaccount/ from your local machine to the /tmp/bar_dir directory inside the worker-pod-4 pod in the ingress-nginx namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ ingress-nginx/worker-pod-4:/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": "C... |
Attach to the email-service-pod container in the lunar-launcher deployment and switch to raw terminal mode | Command:
```bash
kubectl attach email-service-pod -c lunar-launcher -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. I... |
Create a new config map named app-config using specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a con... |
Copy the local file /tmp/foo to the /etc/kubernetes directory in the monitoring-agent-pod-6 pod, specifically in the database-container container. | Command:
```bash
kubectl cp /tmp/foo monitoring-agent-pod-6:/etc/kubernetes -c database-container
```
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... |
Set the cpu limits of the nginx container in the amazonlinux deployment to "200m" and memory to "1Gi" | Command:
```bash
kubectl set resources deployment amazonlinux -c=nginx --limits=cpu=200m,memory=1Gi
```
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 u... |
Retrieve snapshot logs from container 'monitoring-pod-1' of the 'gateway-deployment' deployment. | Command:
```bash
kubectl logs deployment/gateway-deployment -c monitoring-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": ... |
Copy the ~/.config/kube file from the remote pod named 'load-balancer-pod-9' in the 'kube-system' namespace to the local directory /tmp/bar. | Command:
```bash
kubectl cp kube-system/load-balancer-pod-9:~/.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 ... |
Get the output from running the 'geth' command in the 'cosmic-container' from the 'vpn-service-pod' pod | Command:
```bash
kubectl exec vpn-service-pod -c cosmic-container -- geth
```
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, ... |
Set the cpu limits of the 'redis' deployment's 'nginx' container to 3 and memory limits to 128Mi. | Command:
```bash
kubectl set resources deployment redis -c=nginx --limits=cpu=3,memory=128Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to it... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.