prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create an ingress called 'app-proxy-ingress' with the rule "testing.com/module" that directs requests to the service svc1:8181 with the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/module=svc1:8181,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": "", ... |
Switch to raw terminal mode and attach to a specified container in a pod | Command:
```bash
kubectl attach mypod -c cosmic-container -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Update the image of all containers in the daemonset 'app-v2' to 'openjdk:16.0.2' | Command:
```bash
kubectl set image daemonset app-v2 *=openjdk:16.0.2
```
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), replicaset (rs)
Syntax:
`ku... |
Scale the resource specified in the "setup.json" file to 5 replicas | Command:
```bash
kubectl scale --replicas=5 -f setup.json
```
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 validated... |
Create a copy of the "e-commerce-pod" with a debug container and modified container images | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=my-custom-dbg --image=debian --set-image=logger=logging-app:debug,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by r... |
Create an ingress resource called 'ingtls' with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="testing.com/=svc:https,tls" \
--rule="site.com/path/subpath*=othersvc:8888"
```
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": "... |
Listen on your local machine's port 8888 and forward the traffic to port 8000 of the pod named web-app-pod. | Command:
```bash
kubectl port-forward pod/web-app-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 automa... |
Copy the local file /tmp/foo to the remote pod logging/load-balancer-pod-9 in the namespace, and place it in the /tmp/bar_dir directory. | Command:
```bash
kubectl cp :/tmp/foo logging/load-balancer-pod-9:/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 k... |
Copy the directory "/tmp/foo_dir" from the remote pod "logging-agent-pod-7" in the "kube-node-lease" namespace to the local directory "/tmp/bar_dir". | Command:
```bash
kubectl cp kube-node-lease/logging-agent-pod-7:/tmp/foo_dir /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
List deployments in the "v1.1.1" version of the "prod-apps" API group and display the output in YAML format | Command:
```bash
kubectl get deployments.v1.1.1.prod-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 you will ... |
update the 'api-server-deployment' deployment with the environment variable SMTP_HOST set to smtp.example.com | Command:
```bash
kubectl set env deployment/api-server-deployment SMTP_HOST=smtp.example.com
```
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 t... |
Retrieve the output from running the 'bash' command inside the 'warp-drive' container of the 'frontend-pod' pod. | Command:
```bash
kubectl exec frontend-pod -c warp-drive -- bash
```
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 k... |
Set the resource limits for the nginx container in the ubuntu deployment to a CPU limit of "50m" and a memory limit of "4Gi" | Command:
```bash
kubectl set resources deployment ubuntu -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 i... |
Create a job to seed a database using the nginx image and run the command "nginx -g 'daemon off;'" | Command:
```bash
kubectl create job database-seeding-job --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... |
Remove the label named 'bar' from the 'auth' pod | Command:
```bash
kubectl label pods auth role-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true, c... |
Listen on port 3000 on localhost and the IP address 10.19.21.23, forwarding the traffic to port 8088 in the cdn-service-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 3000: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... |
Update the cluster field to "staging-cluster" in the "team-beta-context" context. | Command:
```bash
kubectl config set contexts.team-beta-context.cluster staging-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... |
Create an ingress called 'api-v1-ingress' that directs requests from testing.com/input to svc1:9092 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="testing.com/input=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": "", "usa... |
Import the key "debug_mode" from the "global-config" config map into the environment variables of the "load-balancer-deployment" deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/global-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Print the supported API resources in the "core" APIGroup | Command:
```bash
kubectl api-resources --api-group=core
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Copy the file /tmp/foo from the remote pod task-processor-pod-17 in the ingress-nginx deployment to the local directory /tmp/bar. | Command:
```bash
kubectl cp ingress-nginx/task-processor-pod-17:/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 th... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-name-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in on... |
Import the `smtp_server` key from the `api-config` ConfigMap into the environment of the `email-server-deployment` deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/api-config deployment/email-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 definition... |
Connect to the running pod "vpn-service-pod" and attach to the container "quantum-quark" in raw terminal mode | Command:
```bash
kubectl attach vpn-service-pod -c quantum-quark -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 o... |
Add a taint with key 'app' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 app=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Set the certificate authority data for the galaxy-cluster cluster entry. | Command:
```bash
kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/galaxy-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... |
Check if you have permission to list the job "database-indexing-job" in the "kube-public" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n kube-public
```
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 part... |
Retrieve the logs from the container named email-service-pod in the gateway-deployment deployment. | Command:
```bash
kubectl logs deployment/gateway-deployment -c email-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:
"flag... |
Start port forwarding on all addresses, listening on port 5432 and forwarding traffic to port 5000 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-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 will... |
Create a deployment named "worker" with 4 replicas of the "mcr.microsoft.com/dotnet/core/runtime" image. | Command:
```bash
kubectl create deployment worker --image=mcr.microsoft.com/dotnet/core/runtime --replicas=4
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Create a deployment named 'cache' with 6 replicas, using the 'wordpress' image. | Command:
```bash
kubectl create deployment cache --image=wordpress --replicas=6
```
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 port 8888 to port 8000 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-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... |
Add a taint with the key 'disktype' and the value 'kube-master-9:PreferNoSchedule' on all nodes with the label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster disktype=kube-master-9: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": "", "us... |
Start a pod named 'hazelcast' using the 'docker.elastic.co/elasticsearch/elasticsearch' image, and configure the container to expose port 8181. | Command:
```bash
kubectl run hazelcast --image=docker.elastic.co/elasticsearch/elasticsearch --port=8181
```
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] ... |
Update the 'password' property of the 'node-2' node using a strategic merge patch | Command:
```bash
kubectl patch node node-2 -p '{"stringData":{"password":"new-password"}'
```
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 FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
... |
Open the logging-service service for editing using the vim editor. | Command:
```bash
KUBE_EDITOR="vim" kubectl edit svc/logging-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,... |
Forward connections from port 6379 on all addresses to port 8081 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 6379: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 sel... |
Create an ingress called 'app1-ingress' that directs requests for foo.com/example to svc1:8181 with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app1-ingress --rule="foo.com/example=svc1:8181,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":... |
Copy the local file '/tmp/foo' to '/tmp/bar' inside the 'backend-pod-13' pod's 'admin-dashboard' container. | Command:
```bash
kubectl cp /tmp/foo backend-pod-13:/tmp/bar -c admin-dashboard
```
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 ... |
Open the `backend-service` service for editing using the `code` editor | Command:
```bash
KUBE_EDITOR="code" kubectl edit svc/backend-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... |
Add an annotation to the 'api' pod with the key 'deployment-script' and the value 'https://example.com/deploy.sh' | Command:
```bash
kubectl annotate pods api 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 than lab... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/api-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 variable defini... |
Embed the certificate authority data for the cluster-gamma cluster entry using the command "kubectl config set-cluster cluster-gamma --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster cluster-gamma --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster... |
Set the cpu limits of the nginx container in the alpine deployment to "2" and the memory limits to "1Gi" | Command:
```bash
kubectl set resources deployment alpine -c=nginx --limits=cpu=2,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 up to its... |
Delete the pods and services with the names "auth" and "proxy-server" | Command:
```bash
kubectl delete pod,service auth proxy-server
```
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 selecto... |
Create a job named "backup" with the image "wordpress" and a command to run "mysql --version" | Command:
```bash
kubectl create job backup --image=wordpress -- mysql --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": "Output format... |
Create a Pod Disruption Budget named notification-service-pdb that selects all pods with the label project=my-project and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=project=my-project --min-available=9
```
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 --mi... |
Update the last-deployment annotation of the pod identified by the type and name specified in the "conf.json" file | Command:
```bash
kubectl annotate -f conf.json last-deployment=2023-03-15
```
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 arb... |
Create a deployment named "db" with the image "mcr.microsoft.com/dotnet/core/runtime" and 6 replicas | Command:
```bash
kubectl create deployment db --image=mcr.microsoft.com/dotnet/core/runtime --replicas=6
```
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... |
Start streaming the logs of the "nano-bot" container in the "auth-service-pod" pod. | Command:
```bash
kubectl logs -f -c nano-bot auth-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sh... |
Add a taint to a specific node with a key and no value | Command:
```bash
kubectl taint nodes node-1 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 of: json|... |
Set the CPU limit for the 'python' deployment's 'nginx' container to "500m" and the memory limit to "2Gi" | Command:
```bash
kubectl set resources deployment python -c=nginx --limits=cpu=500m,memory=2Gi
```
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 ... |
Create an ingress called 'website-ingress' that routes requests to 'testing.com/bar' to the service 'svc1:3306' using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/bar=svc1:3306,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... |
Forward local ports to a pod | Command:
```bash
kubectl port-forward pod/proxy-server-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 a... |
Create a LoadBalancer service named security-service-lb forwarding traffic from port 9000 to port 8084. | Command:
```bash
kubectl create service loadbalancer security-service-lb --tcp=9000:8084
```
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",... |
Add a taint with key 'workload' on nodes having label zone=us-east-1 and value 'dev-node-4' with the effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l zone=us-east-1 workload=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Update the annotation of the pod 'backend' with the key 'owner' and the value 'alice-smith', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods backend owner='alice-smith'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and includ... |
Forward local ports 3000 and 6000 to ports 3000 and 6000 in the specified deployment | Command:
```bash
kubectl port-forward deployment/mydeployment 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 selecte... |
Create a service for a replicated ruby using replica set, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rs ruby --port=8000 --target-port=808900
```
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... |
Add a taint to a specific node | Command:
```bash
kubectl taint nodes testing-node-11 environment: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. O... |
Create a Pod Disruption Budget named cache-cluster-pdb that selects all pods with the label component=web and ensures that at least one of them is always available. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=component=web --min-available=1
```
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=... |
Forward local port 8088 to pod port 9090 | Command:
```bash
kubectl port-forward pod/security-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 criteria, a pod will be select... |
Autoscale the deployment "frontend" with a minimum of 1 pod and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment frontend --min=1 --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 use... |
Forward local traffic from port 6379 to port 8000 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward pod/log-aggregator-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 be selected... |
copy the /tmp/foo_dir directory from your local machine to the /tmp/bar_dir directory in the remote pod named load-balancer-pod-9 in the default namespace | Command:
```bash
kubectl cp /tmp/foo_dir load-balancer-pod-9::/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 kubec... |
Set a custom TLS server name for the web-cluster cluster entry | Command:
```bash
kubectl config set-cluster web-cluster --tls-server-name=cloud-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] [--certificate... |
Import the LOG_LEVEL key from the monitoring-config config map into the gateway-deployment deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --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 definition... |
Copy the local directory "/tmp/foo_dir" to the remote pod "message-broker-pod-15" in the "/tmp/bar_dir" directory. | Command:
```bash
kubectl cp :/tmp/foo_dir message-broker-pod-15:/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 kub... |
Create a pod disruption budget named elastic-search-pdb that selects all pods with the owner=team-1 label and ensures that at least one of them is always available. | Command:
```bash
kubectl create poddisruptionbudget elastic-search-pdb --selector=owner=team-1 --min-available=1
```
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=... |
Forward traffic from local port 5432 to port 8000 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 5432: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... |
Create a new secret named aws-credentials-secret with keys for each file in folder bar | Command:
```bash
kubectl create secret generic aws-credentials-secret --from-file=path/to/configs
```
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 basena... |
Create a service for the node deployment that serves on port 80 and connects to the containers on port 543200 | Command:
```bash
kubectl expose deployment node --port=80 --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 p... |
Create a new NodePort service named proxy-server-nodeport with TCP port mapping from port 8010 on the nodes to port 3000 on the pods. | Command:
```bash
kubectl create service nodeport proxy-server-nodeport --tcp=8010:3000
```
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"... |
Restart a daemon set in the provided namespace | Command:
```bash
kubectl rollout restart daemonset/namespace-3
```
What it does:
Restart a resource.
Resource rollout will be restarted.
Syntax:
`kubectl rollout restart RESOURCE`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the resou... |
Auto scale the replication controller "auth" with desired number of pods between 1 and 4, based on target CPU utilization of 40%. | Command:
```bash
kubectl autoscale rc auth --max=4 --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 th... |
Stream the logs of a specific container in a pod | Command:
```bash
kubectl logs -f -c mycontainer media-stream-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", ... |
Check if you have permission to list the job named "virus-scan-job" in the "development" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/virus-scan-job -n development
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL... |
Attach to the code-explorer container in the monitoring-pod to get the output | Command:
```bash
kubectl attach monitoring-pod -c code-explorer
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a Pod Disruption Budget named web-app-pdb that will select all pods with the label role=worker and require at least one of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget web-app-pdb --selector=role=worker --min-available=1
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-settings 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 variable definiti... |
Create an ingress called 'public-service-ingress' that routes requests from website.com/bar to svc1:8000 and uses a TLS secret called "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/bar=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": ""... |
Create a pod disruption budget named 'worker-pdb' that selects all pods with the 'env=production' label and requires a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=env=production --min-available=9
```
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 [--d... |
Update the label of the pod 'media-stream' to include the label 'tier' with the value 'backend' | Command:
```bash
kubectl label pods media-stream tier=backend
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usag... |
Update the 'vpn' pod with the annotation 'env' and set it to 'staging'. | Command:
```bash
kubectl annotate pods vpn 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 value... |
Copy the contents of the '/var/run/secrets/kubernetes.io/serviceaccount/' directory from the 'rook-ceph/cache-pod-5' pod to the local directory '/tmp/bar' | Command:
```bash
kubectl cp rook-ceph/cache-pod-5:/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": "Container ... |
Set the environment variable 'DB_HOST' to 'localhost' for all containers in all replication controllers in the project. | Command:
```bash
kubectl set env rc --all 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 (within replication cont... |
Create a deployment named 'registry' that runs the mysql image and exposes port 7000. | Command:
```bash
kubectl create deployment registry --image=mysql --port=7000
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
Delete the context configuration for the "prod-context" cluster. | Command:
```bash
kubectl config delete-context prod-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
Create a new secret named jwt-secret from an environment file | Command:
```bash
kubectl create secret generic jwt-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 bas... |
Create a debug container with the 'debian' image and change the 'api' container image to 'api:v2' and the 'cache' container image to 'redis:alpine' for a copy of the 'backend-pod' | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-api --image=debian --set-image=api=api:v2,cache=redis: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.... |
Create a job named "batch-processing" with the image "golang" and run the command "go" | Command:
```bash
kubectl create job batch-processing --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. One ... |
Expose a replicated Ruby service on port 8443, connecting to the containers on port 700000 | Command:
```bash
kubectl expose rc ruby --port=8443 --target-port=700000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Forward local port 8888 to port 9090 in the frontend-pod | Command:
```bash
kubectl port-forward pod/frontend-pod 8888:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Copy the local file '/tmp/foo' to the remote pod 'kube-proxy/logging-agent-pod-7' in the '/tmp/bar_dir' directory | Command:
```bash
kubectl cp /tmp/foo kube-proxy/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... |
Create a new ClusterIP service named 'payment-service-clusterip' that maps port 8088 to port 5000 | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=8088:5000
```
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"... |
Display only the most recent 43 lines of output in the chat-app-pod pod | Command:
```bash
kubectl logs --tail=43 chat-app-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": "-c... |
Forward traffic from local port 9090 to the target port of the "https" service in the "database-service" pod | Command:
```bash
kubectl port-forward service/database-service 9090: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 selec... |
Create a secret named git-credentials-secret from an environment file. | Command:
```bash
kubectl create secret generic git-credentials-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 t... |
Execute the 'node --version' command in the code-explorer container of the chat-app-pod pod. | Command:
```bash
kubectl exec chat-app-pod -c code-explorer -- node --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 omitt... |
Get the snapshot logs from the proxy-service-pod, including all containers. | Command:
```bash
kubectl logs proxy-service-pod --all-containers=true
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--contain... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.