prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Execute the 'psql' command inside the first container of the 'email-server-deployment' deployment and get the output. | Command:
```bash
kubectl exec deploy/email-server-deployment -- psql
```
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 a new ExternalName service named external-security-service with the external name tutorial-ai.ai. | Command:
```bash
kubectl create service externalname external-security-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 serv... |
Copy the local file "~/.config/kube" to the directory "/tmp/bar_dir" inside a remote pod named "api-server-pod-3" | Command:
```bash
kubectl cp ~/.config/kube api-server-pod-3:/tmp/bar_dir -c metrics-exporter
```
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 omit... |
Create a debug container in a copy of the 'email-service-pod' pod, using the 'debian' image | Command:
```bash
kubectl debug email-service-pod -it --copy-to=my-debugger --image=debian --set-image=api=api:v2,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Start an Alpine pod, but customize the specifications using a JSON file | Command:
```bash
kubectl run nginx --image=alpine --overrides='{ "apiVersion": "v2.1.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAN... |
Copy the directory "/tmp/foo_dir" from the remote pod "argocd/monitoring-agent-pod-6" to the local directory "/etc/kubernetes". | Command:
```bash
kubectl cp argocd/monitoring-agent-pod-6:/tmp/foo_dir /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, u... |
Execute the 'python' command inside the container of the 'auth-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec auth-service-pod -- python
```
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.k... |
Add a taint to the 'kube-master-9' node with key 'hardware', value 'gpu', and effect 'NoExecute' | Command:
```bash
kubectl taint nodes kube-master-9 hardware=gpu:NoExecute
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One... |
Copy the local file "/tmp/foo" to the "/etc/kubernetes" directory of the remote pod "admin-dashboard-pod-16" in the "logging" namespace. | Command:
```bash
kubectl cp :/tmp/foo logging/admin-dashboard-pod-16:/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... |
List deployments in JSON output format, for the "dev-2.2.0" version of the "third-party-apps" API group. | Command:
```bash
kubectl get deployments.dev-2.2.0.third-party-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... |
Create secret named payment-gateway-secret from env file | Command:
```bash
kubectl create secret generic payment-gateway-secret --from-env-file=path/to/data.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... |
Start a amazonlinux pod with the name hazelcast, using the amazonlinux image, and expose port 8080 on the container. | Command:
```bash
kubectl run hazelcast --image=amazonlinux --port=8080
```
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":... |
Access the 'cyber-sleuth' container in the 'proxy-service-pod' pod and switch to a raw terminal mode to interact with the 'bash' shell. | Command:
```bash
kubectl attach proxy-service-pod -c cyber-sleuth -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 ... |
Forward local traffic from port 5432 to port 5000 in the selected pod by the deployment `log-aggregator-deployment`. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 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... |
Create a deployment named 'api' using the 'amazonlinux' image and expose port '8181' | Command:
```bash
kubectl create deployment api --image=amazonlinux --port=8181
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Create a job named "cleanup" with the image "python" and run the command "python" | Command:
```bash
kubectl create job cleanup --image=python -- python
```
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 of: j... |
Import environment variables from the "email-credentials-secret" secret and set them in the "load-balancer-deployment" deployment. | Command:
```bash
kubectl set env --from=secret/email-credentials-secret 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 definitions in on... |
Add a taint with the key 'disktype' and value 'web-node-8:PreferNoSchedule' on nodes that have the label 'stack=tech-stack'. | Command:
```bash
kubectl taint node -l stack=tech-stack disktype=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":... |
Create an ingress resource called 'api-v2-ingress' that directs requests from foo.com/example to the service 'svc1' on port 27017 | Command:
```bash
kubectl create ingress api-v2-ingress --rule="foo.com/example=svc1:27017,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... |
Apply a taint with the key 'special' and the value 'gpu-node-12:PreferNoSchedule' on nodes that have the label 'version=v1.0.0' | Command:
```bash
kubectl taint node -l version=v1.0.0 special=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": "... |
Start the wordpress pod using the default command, but use custom arguments arg1, arg2, ..., argN for that command. | Command:
```bash
kubectl run nginx --image=wordpress -- <arg1> <arg2> ... <argN>
```
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 flag... |
Start a Jenkins pod named 'nginx' using the 'jenkins' image, and override the default specifications by passing a partial set of values parsed from a JSON file. | Command:
```bash
kubectl run nginx --image=jenkins --overrides='{ "apiVersion": "rc-1.1.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COM... |
Copy the local file "~/.config/kube" to the remote pod "backend-pod-13" in the "prometheus" namespace, and place it in the "/tmp/bar_dir" directory. | Command:
```bash
kubectl cp ~/.config/kube prometheus/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 th... |
Add a taint to nodes with a specific label | Command:
```bash
kubectl taint node -l instance=app-instance-1 environment=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": ... |
Create a new secret named oauth-secret using the preferences.env file located at path/to/preferences.env | Command:
```bash
kubectl create secret generic oauth-secret --from-env-file=path/to/preferences.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 base... |
Create a single ingress called 'website-ingress' with a rule that directs requests for 'testing.com/example' to the service 'svc1' on port '8089', and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/example=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": "", "... |
Create a new ClusterIP service named payment-service-clusterip that maps the port 8089 of the service to port 7000 of the pods. | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=8089:7000
```
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"... |
Delete pods and services with the names "proxy-server" and "frontend" | Command:
```bash
kubectl delete pod,service proxy-server 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 sel... |
Get output from running a specific command in a container inside a pod | Command:
```bash
kubectl exec media-stream-pod -c mycontainer -- mysqld
```
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, us... |
Create an ingress called 'api-gateway-ingress' with a rule that directs requests from foo.com/example to svc1:3306 | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="foo.com/example=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": "", "... |
Get the output of the 'jenkins --version' command from the container 'mycontainer' in the pod 'analytics-pod' | Command:
```bash
kubectl exec analytics-pod -c mycontainer -- jenkins --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Set the service account of the deployment named "order-processing-deployment" to "vault" | Command:
```bash
kubectl set serviceaccount deployment order-processing-deployment vault
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kub... |
Retrieve the information about the 'proxy-server-pod' pod and display it in YAML format | Command:
```bash
kubectl get -o yaml pod proxy-server-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 namespaced you will only see... |
Create a new ExternalName service named external-monitoring-service that points to the external domain education-edu.edu. | Command:
```bash
kubectl create service externalname external-monitoring-service --external-name education-edu.edu
```
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... |
List the replica controller 'web', service 'api-service-rc', and pod 'analytics-pod' | Command:
```bash
kubectl get rc/web service/api-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 namespac... |
Forward traffic from port 5432 on localhost and IP 10.19.21.23 to port 5432 in the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 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 ... |
Create a new ClusterIP service named billing-service-clusterip that maps port 7000 on the service to port 8888 on the target pods. | Command:
```bash
kubectl create service clusterip billing-service-clusterip --tcp=7000:8888
```
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"... |
Create a deployment named "auth" using the "golang" image and exposing port 3000. | Command:
```bash
kubectl create deployment auth --image=golang --port=3000
```
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: jso... |
Forward traffic from port 8888 on all addresses to port 8000 in the e-commerce-pod, listening on all interfaces. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-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 wi... |
Forward the local port 8088 to port 6379 in the pod "analytics-pod", listening on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 8088:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Embed certificate authority data for the dev-cluster cluster entry | Command:
```bash
kubectl config set-cluster dev-cluster --embed-certs --certificate-authority=~/.kube/edge-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 set-... |
Create a new config map named app-secrets with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-secrets --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/profiles/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 conf... |
Create an ingress named 'api-ingress' with a rule that directs requests from 'foo.com/input' to 'svc1:8000' | Command:
```bash
kubectl create ingress api-ingress --rule="foo.com/input=svc1:8000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/proxy-service-rc pods/payment-gateway-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 ... |
Get the output from running the 'jenkins-plugin-cli' command in the first container of the first pod of the 'mydeployment' deployment. | Command:
```bash
kubectl exec deploy/mydeployment -- jenkins-plugin-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 omitted, us... |
Import the environment variables from the "email-credentials-secret" secret into the "authentication-service-deployment" deployment. | Command:
```bash
kubectl set env --from=secret/email-credentials-secret deployment/authentication-service-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 file /tmp/foo from the remote pod with the name 'worker-pod-4' in the 'kube-node-lease' namespace to the local path /tmp/bar. | Command:
```bash
kubectl cp kube-node-lease/worker-pod-4::/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 kub... |
Forward local ports 5432 and 6000 to ports 9090 and 6000 respectively in a pod selected by the deployment named "api-server-deployment". | Command:
```bash
kubectl port-forward deployment/api-server-deployment 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 pod will b... |
Get the output from running the 'go version' command in the cyber-sleuth container of the analytics-pod. | Command:
```bash
kubectl exec analytics-pod -c cyber-sleuth -- go 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, ... |
Update the annotation of the 'backend' pod with the key 'SLA' and the value '99.9% uptime', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods backend 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... |
Forward local port 8888 to port 9090 in the pod "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... |
Open a raw terminal connection to a specific container in a pod | Command:
```bash
kubectl attach chat-app-pod -c mycontainer -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 omitte... |
create a php pod named "hazelcast" and expose port 3001 | Command:
```bash
kubectl run hazelcast --image=php --port=3001
```
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": "--file... |
Get the logs from the container "payment-gateway-pod" in the deployment "api-server-deployment". | Command:
```bash
kubectl logs deployment/api-server-deployment -c payment-gateway-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
... |
Forward local port 5432 to port 9090 of a pod selected by the deployment named "mydeployment" | Command:
```bash
kubectl port-forward deployment/mydeployment 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 pod will be selecte... |
Add a taint with key 'workload' on nodes having label release=beta, specifically on the k8s-node-1 node | Command:
```bash
kubectl taint node -l release=beta workload=k8s-node-1: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 resource request and limits for all containers in the "runtime" deployment to a CPU limit of 200 milliCPU and a memory limit of 512 megabytes, and a CPU request of 200 milliCPU and a memory request of 1 gigabyte. | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=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 reques... |
Listen on port 8000 on your local machine and forward the traffic to port 9090 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 8000: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 au... |
Create a new ExternalName service named external-database-service | Command:
```bash
kubectl create service externalname external-database-service --external-name bar.com
```
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 th... |
Delete the pods and services with the names "cdn" and "log-aggregator" | Command:
```bash
kubectl delete pod,service cdn 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 select... |
Retrieve the logs of the previous terminated container "warp-drive" from the pod "database-pod" | Command:
```bash
kubectl logs -p -c warp-drive database-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", "shor... |
Forward local port 9090 to port 3000 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod 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 selected automa... |
Forward traffic from port 8081 on all addresses to port 8080 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-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 the criteria, a pod w... |
Update the pod 'gateway' in the current namespace with the label 'role' and the value 'frontend' | Command:
```bash
kubectl label pods gateway role=frontend
```
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": ... |
Forward all incoming traffic on port 8088 to port 8000 in the "mypod" pod, and listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8088: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 sel... |
update the environment variables of a deployment by importing specific keys from a config map. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-config-prod 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 defi... |
Create a new secret named ssl-key-secret using an env file | Command:
```bash
kubectl create secret generic ssl-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 basen... |
import the 'log_level' key from the 'api-config' config map and set it as an environment variable for 'mydeployment' deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/api-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 one or m... |
Embed the certificate authority data for the data-cluster cluster entry by running the command "kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/kube-cluster-1/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/kube-cluster-1/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 s... |
Copy the local file /tmp/foo to the remote pod payment-gateway-pod-19 in the kube-node-lease namespace, and place it at /tmp/bar directory. | Command:
```bash
kubectl cp /tmp/foo kube-node-lease/payment-gateway-pod-19::/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, us... |
Import the `api_key` key from the `app-secrets` config map into the `user-management-deployment` deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-secrets 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 definition... |
Execute the command "elasticsearch --version" in the "rocket-ranger" container of the "auth-service-pod" pod. | Command:
```bash
kubectl exec auth-service-pod -c rocket-ranger -- 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 n... |
Display the modified email-server-deployment deployment in YAML format, including the updated SMTP_HOST environment variable, without making any changes to the object on the server. | Command:
```bash
kubectl set env deployment/email-server-deployment SMTP_HOST=smtp.example.com -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 ... |
Set the custom TLS server name to use for validation for the 'sun-cluster' cluster entry | Command:
```bash
kubectl config set-cluster sun-cluster --tls-server-name=moon-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-... |
Copy the service account directory from a remote pod to a local directory | Command:
```bash
kubectl cp metallb-system/security-scanner-pod-18:/var/run/secrets/kubernetes.io/serviceaccount/ /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "",... |
Create a deployment named 'my-dep' with the image 'mcr.microsoft.com/dotnet/core/runtime' and expose port 8888 | Command:
```bash
kubectl create deployment my-dep --image=mcr.microsoft.com/dotnet/core/runtime --port=8888
```
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": "", "us... |
Import the 'database_url' key from the 'namespace-config' ConfigMap into the 'user-management-deployment' deployment's environment variables. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/namespace-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 ... |
Update node 'node-1' with a taint that has the key 'workload', value 'high-priority', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes node-1 workload=high-priority: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.... |
Create a new config map named "log-config" and include the specified keys and values from the provided files. | Command:
```bash
kubectl create configmap log-config --from-file=properties=/path/to/data/file1.txt --from-file=key1=/path/to/profiles/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... |
Run the command 'python --version' inside the container 'time-machine' that belongs to the pod 'chat-app-pod' and display the output | Command:
```bash
kubectl exec chat-app-pod -c time-machine -- python --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 omit... |
Scale a resource to a specific number of replicas using a configuration file | Command:
```bash
kubectl scale --replicas=7 -f params.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 validate... |
List all deployments in the "v2.1.0" version of the "third-party-apps" API group in YAML output format. | Command:
```bash
kubectl get deployments.v2.1.0.third-party-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 yo... |
Create a NodePort service named "proxy-service-nodeport" by mapping port 8080 on the host to port 27017 on the service. | Command:
```bash
kubectl create service nodeport proxy-service-nodeport --tcp=8080:27017
```
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", "defaul... |
Copy a directory from a remote pod to a local directory. | Command:
```bash
kubectl cp openfaas/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, use t... |
Attach to the 'web-app-pod' pod and retrieve the output from the 'quantum-quark' container | Command:
```bash
kubectl attach web-app-pod -c quantum-quark
```
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, us... |
Create a new config map named app-secrets with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-secrets --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/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.
Wh... |
Import specific keys from a config map to a deployment’s environment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/kube-system-config deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Create a new LoadBalancer service named 'monitoring-lb' that exposes port 8084 and forwards traffic to port 8082. | Command:
```bash
kubectl create service loadbalancer monitoring-lb --tcp=8084:8082
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "defa... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ file from the local machine to the /tmp/bar directory in the backend-pod-13 pod in the velero namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ velero/backend-pod-13::/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... |
Remove the resource requests for resources on containers in the "ubuntu" deployment | Command:
```bash
kubectl set resources deployment ubuntu --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
```
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 ... |
Set environment variables from a config map for a deployment. | Command:
```bash
kubectl set env --keys=my-example-key --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 defini... |
Auto scale the deployment "auth" with a minimum of 1 pod and a maximum of 12 pods, using the default autoscaling policy | Command:
```bash
kubectl autoscale deployment auth --min=1 --max=12
```
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... |
Use the vim editor to edit the docker-registry service configuration. | Command:
```bash
KUBE_EDITOR="vim" kubectl edit svc/docker-registry
```
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 port 8080 on your local machine to port 5432 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 8080: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 auto... |
Forward the local port 8080 to port 6379 in the pod "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-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 auto... |
Create a cluster role named "view" with permissions to create resources and access the /version non-resource URL. | Command:
```bash
kubectl create clusterrole "view" --verb=create --non-resource-url=/version
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short... |
List deployments in YAML format for the "v1.0.0" version of the "backup-apps" API group. | Command:
```bash
kubectl get deployments.v1.0.0.backup-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 wil... |
Execute the 'yum install -y wget' command in the 'nano-bot' container of the 'email-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec email-service-pod -c nano-bot -- yum install -y wget
```
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 an ingress resource called 'myapp-ingress' with a rule that directs requests to 'website.com/bar' to the service 'svc1' on port '9092', with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress myapp-ingress --rule="website.com/bar=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Add a taint with key 'dedicated' on nodes having label app=web-app as follows: `kubectl taint node -l app=web-app dedicated=node-2:PreferNoSchedule` | Command:
```bash
kubectl taint node -l app=web-app dedicated=node-2: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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.