prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy the local file /tmp/foo to /tmp/bar inside the remote pod named auth-service-pod-11 | Command:
```bash
kubectl cp /tmp/foo auth-service-pod-11:/tmp/bar -c logging-agent
```
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... |
Add a taint with the key 'dedicated' on the nodes that have the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace dedicated=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": "", ... |
Import specific keys from a config map by setting environment variables for a deployment. | Command:
```bash
kubectl set env --keys=smtp_server --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 definit... |
Add a taint with the key 'special' on nodes having the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app special=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outpu... |
Stream the logs of a specific container in a pod | Command:
```bash
kubectl logs -f -c mycontainer gateway-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... |
Create a new ExternalName service named 'external-analytics-service' with the external name 'test-site.org' | Command:
```bash
kubectl create service externalname external-analytics-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 serv... |
Copy the local file '/tmp/foo' to '/tmp/bar_dir' in the remote pod 'web-app-pod-1' using the container 'task-processor' | Command:
```bash
kubectl cp :/tmp/foo web-app-pod-1:/tmp/bar_dir -c task-processor
```
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... |
Enable new exec auth plugin for the "app-service" entry | Command:
```bash
kubectl config set-credentials app-service --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1
```
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:
... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/kube-system-config 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... |
Create a cluster role named "reader" with the verbs "proxy" and the resources "pods" and specific resource names "message-queue" and "image-processor" | Command:
```bash
kubectl create clusterrole reader --verb=proxy --resource=pods --resource-name=message-queue --resource-name=image-processor
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|... |
Create a single ingress called 'public-api-ingress' that directs requests to website.com/input to svc1:27017 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress public-api-ingress --rule="website.com/input=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": "",... |
Create a new config map named monitoring-config with the specified keys and files | Command:
```bash
kubectl create configmap monitoring-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 creatin... |
Create a service for a replication controller specified in the "centos-controller.yaml" file, which serves on port 9000 and connects to the containers on port 888800 | Command:
```bash
kubectl expose -f centos-controller.yaml --port=9000 --target-port=888800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Set the cluster field in the client-1-context context to data-cluster | Command:
```bash
kubectl config set contexts.client-1-context.cluster data-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... |
Update the pod 'security' by setting the annotation 'env' to the value 'staging'. | Command:
```bash
kubectl annotate pods security 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 ... |
Set the cluster field in the staging-context context to "edge-cluster". | Command:
```bash
kubectl config set contexts.staging-context.cluster edge-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 ... |
import specific keys from a config map | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-secrets 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 definition... |
Add a taint with key 'zone' and value 'dev-node-4:PreferNoSchedule' on nodes having label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops zone=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": "Output ... |
Execute the command 'jenkins --version' in the 'astro-container' of the 'frontend-pod' and retrieve the output. | Command:
```bash
kubectl exec frontend-pod -c astro-container -- 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 ... |
Create a new ExternalName service named 'external-security-service' with --external-name set to 'placeholder-app.app' | Command:
```bash
kubectl create service externalname external-security-service --external-name placeholder-app.app
```
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... |
Create a single ingress called 'app-gateway-ingress' that directs requests to foo.com/bar to svc1:8080 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="foo.com/bar=svc1:8080,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... |
Remove the "client-secret" config value for the OpenID Connect auth provider for the "web-app" entry | Command:
```bash
kubectl config set-credentials web-app --auth-provider=oidc --auth-provider-arg=client-secret-
```
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... |
Return snapshot logs from the backend-pod pod including all containers | Command:
```bash
kubectl logs backend-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": "--container", "... |
Get the logs from the previous terminated ruby container in the pod named log-aggregator-pod | Command:
```bash
kubectl logs -p -c ruby log-aggregator-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... |
Update the image version of a single-container pod to v4 | Command:
```bash
kubectl get pod analytics-pod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
```
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
$... |
Retrieve the snapshot logs from the pod named api-service-pod, including all containers. | Command:
```bash
kubectl logs api-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": "--container... |
Create a pod disruption budget named cron-jobs-pdb which will select all pods with the tier=frontend label and require a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=tier=frontend --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 [-... |
Import the debug_mode key from the config map named app-settings into the web-app-deployment deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/app-settings deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in... |
Import specific keys from a config map in a deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/kube-system-config deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Import the DEBUG_MODE key from the monitoring-config config map into the backend-microservice-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/monitoring-config deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment varia... |
Create a deployment named scheduler using the php image and expose port 8083 | Command:
```bash
kubectl create deployment scheduler --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: j... |
Copy the ~/.config/kube local file to the /tmp/bar directory in the 'monitoring-agent-pod-6' pod, specifically in the 'cache-container' container. | Command:
```bash
kubectl cp ~/.config/kube monitoring-agent-pod-6::/tmp/bar -c cache-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 om... |
partially update the 'db-node-7' node by modifying the 'key' value to 'new-value' | Command:
```bash
kubectl patch node db-node-7 -p $'data:\n key: new-value'
```
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]`
Helpful flags:
... |
Run the 'postgres' command in lunar-launcher from pod vpn-service-pod | Command:
```bash
kubectl exec vpn-service-pod -c lunar-launcher -- postgres
```
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... |
Import the EXTERNAL_API_URL key from the config map named db-config into the cache-cluster-deployment deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/db-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... |
Forward local port 8088 to pod port 8081 | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8088 8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Edit the backend-service service using the Sublime text editor. | Command:
```bash
KUBE_EDITOR="sublime" 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 variab... |
Create a pod disruption budget named cron-jobs-pdb that selects all pods with the component=web label and requires a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=component=web --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 [-... |
Forward requests from port 5000 on all addresses to port 3000 inside the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-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 wi... |
Forward traffic from port 9090 on all addresses to port 8000 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 9090: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 po... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/global-config deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Forward local port 8000 to port 8088 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 8000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
import the DATABASE_URL key from the api-config config map and set it as an environment variable in the frontend-deployment deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/api-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Partially update a node by specifying a strategic merge patch in JSON format | Command:
```bash
kubectl patch node edge-node-10 -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 FI... |
Create a new config map named "app-name-config" by using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config m... |
Create a new config map named app-secrets and populate it with the contents of file1.txt as the value for the key "settings" and the contents of file2.txt as the value for the key "key2" | Command:
```bash
kubectl create configmap app-secrets --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a co... |
Delete the pods and services named "gateway" and "auth" | Command:
```bash
kubectl delete pod,service gateway auth
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
So... |
Forward local port 3000 to port 5000 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 3000: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 automa... |
Check if the user has permission to list the "backup-job" in the "kube-ingress" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/backup-job -n kube-ingress
```
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 th... |
Listen on port 5000 on all addresses, forwarding to port 8081 in the pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 5000: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 w... |
Create a pod disruption budget named critical-services-pdb that will select all pods with the release=1.0.0 label and require a minimum of four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=release=1.0.0 --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-availa... |
Update pod 'chat-app' with the annotation 'security-scan-status' and the value 'pass' | Command:
```bash
kubectl annotate pods chat-app security-scan-status=pass
```
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 Pod Disruption Budget named ingress-controller-pdb that selects pods with the label owner=team-1 and specifies a minimum of four pods to be available at any time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=owner=team-1 --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-availa... |
List the supported API resources under the 'networking.k8s.io' API group | Command:
```bash
kubectl api-resources --api-group=networking.k8s.io
```
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. " |
Create a copy of the "analytics-pod" pod with all container images changed to nginx, and name the copy "debug-image-app". | Command:
```bash
kubectl debug analytics-pod --copy-to=debug-image-app --set-image=*=nginx
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no res... |
Create a new ClusterIP service named backend-service-clusterip with port mapping from local port 7000 to target port 6379. | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=7000:6379
```
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 pod disruption budget named cron-jobs-pdb that selects all pods with the role=worker label and requires at least one of them to be available at any given time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-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 [--d... |
Return the snapshot logs from the 'chat-app-pod' pod with only one container. | Command:
```bash
kubectl logs 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", "defaul... |
Execute the 'wp' command in the 'time-machine' container of the 'email-service-pod' pod | Command:
```bash
kubectl exec email-service-pod -c time-machine -- wp
```
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 ... |
Modify the environment variable SMTP_PASSWORD of the deployment/authentication-service-deployment and output the modified deployment in YAML format. | Command:
```bash
kubectl set env deployment/authentication-service-deployment SMTP_PASSWORD=your-password -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... |
Create a monthly audit cron job using the 'node' image, that runs every minute, executing the 'node' command | Command:
```bash
kubectl create cronjob monthly-audit --image=node --schedule="*/1 * * * *" -- node
```
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", "defau... |
Forward local ports 6379 and 6000 to ports 8080 and 6000 respectively in a pod selected by the 'database-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/database-deployment 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 ... |
Retrieve the output of the 'sleep 3600' command running in the 'warp-drive' container of the 'cdn-service-pod' pod | Command:
```bash
kubectl exec cdn-service-pod -c warp-drive -- sleep 3600
```
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, ... |
Listen on all network interfaces on port 8081 and forward the traffic to port 8000 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8081: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 ... |
Update the environment variable LOG_LEVEL to "info" in the deployment named "mydeployment" | Command:
```bash
kubectl set env deployment/mydeployment LOG_LEVEL=info
```
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 repl... |
Update the label of pod 'monitoring' with the label 'role' and the value 'frontend' | Command:
```bash
kubectl label pods monitoring 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 port 6379 from your localhost and IP 10.19.21.23 to port 5432 in the pod named frontend-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 6379: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 criter... |
Forward port 5432 on all addresses to port 8080 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 5432: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 wi... |
Add a taint with key 'datacenter' and no value to the node 'worker-node-3'. | Command:
```bash
kubectl taint nodes worker-node-3 datacenter:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Create a new config map named kube-system-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap kube-system-config --from-file=properties=/path/to/properties/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.... |
Set the service account of the deployment named "payment-processor-deployment" to "spinnaker" | Command:
```bash
kubectl set serviceaccount deployment payment-processor-deployment spinnaker
```
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:... |
Create an ingress called 'app2-ingress' that directs requests to website.com/input and points them to the service 'svc1:8010' | Command:
```bash
kubectl create ingress app2-ingress --rule="website.com/input=svc1:8010,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Create a pod disruption budget named elastic-search-pdb which selects all pods with the label project=my-project | Command:
```bash
kubectl create poddisruptionbudget elastic-search-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 --min-avai... |
Update the pod 'log-aggregator' by setting the annotation 'backup-strategy' to 'daily backups'. | Command:
```bash
kubectl annotate pods log-aggregator backup-strategy='daily backups'
```
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... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/monitoring-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions ... |
Add a taint with key 'zone' on nodes having label 'component=proxy' | Command:
```bash
kubectl taint node -l component=proxy zone=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": "Out... |
Start a pod using the "confluentinc/cp-kafka" image, but customize the pod specifications by providing a partial set of values in JSON format. | Command:
```bash
kubectl run nginx --image=confluentinc/cp-kafka --overrides='{ "apiVersion": "legacy-1.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [... |
Attach to the nano-bot container in the web-app-pod and get the output | Command:
```bash
kubectl attach web-app-pod -c nano-bot
```
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, use the... |
Update the annotation 'alert-email' of pod 'web' with the value 'alerts@example.com', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods web alert-email='alerts@example.com'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels a... |
List resources by their type and names | Command:
```bash
kubectl get rc/web service/database-rc pods/vpn-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... |
Install the AWS command line interface (AWS CLI) in the analytics-pod container named code-explorer by running the 'yum install -y aws-cli' command. | Command:
```bash
kubectl exec analytics-pod -c code-explorer -- yum install -y aws-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.... |
Create a cluster role named "bar" with the ability to watch services and specific resource names. | Command:
```bash
kubectl create clusterrole bar --verb=watch --resource=services --resource-name=staging-app-server --resource-name=prod-api-gateway
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Forward local port 8888 to pod port 8081 for a specific deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 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 s... |
Return the snapshot of the previous terminated nebula-navigator container logs from the security-service-pod pod. | Command:
```bash
kubectl logs -p -c nebula-navigator security-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": "--con... |
Add a taint with key 'workload' on nodes having label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel workload=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": "", "usage": "Outp... |
Get output from the stardust-shuttle container in the pod named proxy-server-pod. | Command:
```bash
kubectl attach proxy-server-pod -c stardust-shuttle
```
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 omi... |
Start an nginx pod with specific configurations parsed from JSON as overrides | Command:
```bash
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1.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] -- [COMMAND... |
Update the 'log-aggregator' pod by setting the annotation 'scaling-policy' to 'auto-horizontal-scaling', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods log-aggregator scaling-policy='auto-horizontal-scaling'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be l... |
Start a pod with Elasticsearch container and expose port 9091 | Command:
```bash
kubectl run hazelcast --image=docker.elastic.co/elasticsearch/elasticsearch --port=9091
```
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] ... |
Forward local requests received on a random port to port 5432 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-pod :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 a... |
Remove all taints with key 'datacenter' from node 'db-node-7' | Command:
```bash
kubectl taint nodes db-node-7 datacenter-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|... |
Update the 'analytics-platform-deployment' deployment with a new environment variable 'MONGO_URI' and its value 'mongodb://localhost:27017/mydb' | Command:
```bash
kubectl set env deployment/analytics-platform-deployment MONGO_URI=mongodb://localhost:27017/mydb
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Run the 'yum install -y wget' command inside the email-service-pod pod. | Command:
```bash
kubectl exec email-service-pod -- 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 omitted, use... |
Update the annotation 'compliance-level' of the 'gateway' pod to 'PCI-DSS', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods gateway 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... |
Create a cron job named "monthly-audit" that runs the command "go" every minute using the "golang" image | Command:
```bash
kubectl create cronjob monthly-audit --image=golang --schedule="*/1 * * * *" -- go
```
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", "defau... |
Add a taint with key 'hardware' on nodes having label team=devops | Command:
```bash
kubectl taint node -l team=devops hardware=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": "Out... |
Embed the certificate authority data for the prod-cluster cluster entry using the command "kubectl config set-cluster prod-cluster --embed-certs --certificate-authority=~/.kube/kube-cluster-2/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster prod-cluster --embed-certs --certificate-authority=~/.kube/kube-cluster-2/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... |
Create an autoscaling policy for the 'chat-app' deployment with a minimum of 7 pods and a maximum of 12 pods. | Command:
```bash
kubectl autoscale deployment chat-app --min=7 --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 use... |
Start a pod named hazelcast with the amazonlinux image and set the environment variables DNS_DOMAIN=cluster and POD_NAMESPACE=default in the container. | Command:
```bash
kubectl run hazelcast --image=amazonlinux --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
```
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] --... |
Create a new service account named 'gitlab-runner' | Command:
```bash
kubectl create serviceaccount gitlab-runner
```
What it does:
Create a service account with the specified name.
Syntax:
`kubectl create serviceaccount NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.