prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a Pod Disruption Budget named 'batch-processing-pdb' that will select all pods with the 'tier=frontend' label and require a minimum of 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-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-availab... |
Create a copy of the 'analytics-pod' pod in interactive mode, adding a debug container with the debian image, and changing the app container image to 'app:debug' and the scheduler container image to 'my-scheduler:1.0' in the 'debug-image-web' pod. | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-web --image=debian --set-image=app=app:debug,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Create a copy of a pod called chat-app-pod, but with all the container images changed to nginx. | Command:
```bash
kubectl debug chat-app-pod --copy-to=dgb-img --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 resource is ... |
Create a new LoadBalancer service named 'auth-service-lb' that maps port 27017 on the cluster to port 3001 on the service. | Command:
```bash
kubectl create service loadbalancer auth-service-lb --tcp=27017:3001
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Taint nodes with the label 'service=auth' by adding a taint with key 'special' and value 'web-node-8:PreferNoSchedule' | Command:
```bash
kubectl taint node -l service=auth special=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... |
Check if you have permission to list the job named "database-indexing-job" in the namespace "namespace-1" | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n namespace-1
```
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... |
Create a job named "cleanup" using the "mysql" image, and run the command "mysql" within the job. | Command:
```bash
kubectl create job cleanup --image=mysql -- mysql
```
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: jso... |
Create a service for the 'wordpress' deployment, which serves on port 9092 and connects to the containers on port 8081 | Command:
```bash
kubectl expose deployment wordpress --port=9092 --target-port=808100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Check if the current user has permission to list the "backup-job" job in the "kube-public" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/backup-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 partial URL tha... |
Create a service for the php deployment, which serves on port 5432 and connects to the containers on port 500000 | Command:
```bash
kubectl expose deployment php --port=5432 --target-port=500000
```
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 ... |
Create a pod disruption budget named api-service-pdb that will select all pods with the role=worker label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=role=worker --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [-... |
import the specific key "debug_mode" from the config map "env-vars" and set it as an environment variable in the "load-balancer-deployment" deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/env-vars 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 ... |
Get the output from running 'php --version' command in the astro-container of the monitoring-pod. | Command:
```bash
kubectl exec monitoring-pod -c astro-container -- php --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 om... |
Display only the most recent 12 lines of output for the auth-service-pod pod | Command:
```bash
kubectl logs --tail=12 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", "short":... |
Apply a taint with the key 'hardware' on nodes that have the label team=devops | Command:
```bash
kubectl taint node -l team=devops hardware=monitoring-node-15: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": "", "usag... |
Set the environment variables for the deployment/api-server-deployment using the values from the LOG_LEVEL key in the configmap/global-config. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/global-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Add a taint with the key 'app' on nodes that have the label 'component=proxy' | Command:
```bash
kubectl taint node -l component=proxy app=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": "O... |
Return snapshot logs from container database-pod-1 in deployment load-balancer-deployment | Command:
```bash
kubectl logs deployment/load-balancer-deployment -c database-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:
"fla... |
Set the certificate-authority-data field on the galaxy-cluster cluster by encoding the provided certificate data using base64 and updating the kubernetes configuration. | Command:
```bash
kubectl config set clusters.galaxy-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
```
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 contai... |
Delete pods and services with names "analytics" and "payment" | Command:
```bash
kubectl delete pod,service analytics payment
```
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... |
Retrieve the logs of the previously terminated 'nebula-navigator' container from the 'auth-service-pod' pod. | Command:
```bash
kubectl logs -p -c nebula-navigator 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": "--contain... |
Scale the deployment named "api-service-rs" to 7 replicas if the current size is 1. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=7 deployment/api-service-rs
```
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-vers... |
Forward traffic from port 8080 on any address to port 6379 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-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 ... |
Set the custom TLS server name for the web-cluster cluster entry. | Command:
```bash
kubectl config set-cluster web-cluster --tls-server-name=cluster-gamma
```
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... |
Create a new namespace named kube-public | Command:
```bash
kubectl create namespace kube-public
```
What it does:
Create a namespace with the specified name.
Syntax:
`kubectl create namespace NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-template|go-te... |
Expose a replica set 'alpine' as a service, serving on port 80 and connecting to containers on port 8000. | Command:
```bash
kubectl expose rs alpine --port=80 --target-port=888800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Forward traffic from port 8000 on localhost and IP 10.19.21.23 to port 9090 in the 'frontend-pod' pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-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 criter... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=database_url --from=configmap/namespace-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 de... |
Create an ingress called 'public-api-ingress' that routes requests from site.com/bar to svc1:9000 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress public-api-ingress --rule="site.com/bar=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Copy the ~/.config/kube file from the remote pod named file-server-pod-14 to the local directory /tmp/bar. | Command:
```bash
kubectl cp prometheus/file-server-pod-14:~/.config/kube /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use th... |
Import the keys "redis_host" from the "app-config-prod" config map to the "database-deployment" deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config-prod deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Copy the kube config file from a remote pod to the local /etc/kubernetes directory. | Command:
```bash
kubectl cp argocd/backend-pod-13:~/.config/kube /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 the... |
Edit the last-applied-configuration annotations of the alpine deployment in YAML format | Command:
```bash
kubectl apply edit-last-applied deployment/alpine
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the edit... |
Scale up the "log-aggregator" replication controller to a maximum of 4 pods, with a target CPU utilization of 20%. | Command:
```bash
kubectl autoscale rc log-aggregator --max=4 --cpu-percent=20
```
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 th... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-settings deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Update the label of the pod named 'media-stream' to have the key 'role' and the value 'cache'. | Command:
```bash
kubectl label pods media-stream role=cache
```
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 traffic from port 3000 on localhost and IP address 10.19.21.23 to port 8888 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 3000:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cr... |
Forward local traffic from port 8080 to port 8088 in the log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8080 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
set environment variables for a deployment using specific keys from a config map | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config-dev 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 defini... |
Create a new config map named app-config-dev with the specified keys and file paths | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/path/to/options/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creat... |
Forward traffic from a random local port to port 8081 in the chat-app-pod | Command:
```bash
kubectl port-forward pod/chat-app-pod :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 automatic... |
Execute the command 'go run hello.go' inside the first container of the first pod of the deployment 'cache-cluster-deployment' | Command:
```bash
kubectl exec deploy/cache-cluster-deployment -- go run hello.go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Copy the local file `/tmp/foo` to the remote pod `kubeapps/cache-pod-5` in the `/etc/kubernetes` directory. | Command:
```bash
kubectl cp /tmp/foo kubeapps/cache-pod-5:/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 the kubect... |
Add a taint with key 'datacenter' on nodes having label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel datacenter=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 fo... |
List deployments in YAML output format for the "v3.0.0" version of the "mobile-apps" API group. | Command:
```bash
kubectl get deployments.v3.0.0.mobile-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... |
Copy a local file to a remote pod in a specific namespace | Command:
```bash
kubectl cp /tmp/foo_dir ingress-nginx/backend-pod-13:/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, us... |
Start a hazelcast pod with custom specifications provided in JSON format | Command:
```bash
kubectl run nginx --image=hazelcast/hazelcast --overrides='{ "apiVersion": "v1.1.1", "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] [--comman... |
Forward traffic from a local port to a specific port in a pod. | Command:
```bash
kubectl port-forward pod/frontend-pod :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 automatic... |
Connect to the 'media-stream-pod' pod and attach to the 'quantum-quark' container in interactive mode | Command:
```bash
kubectl attach media-stream-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 ... |
Copy the directory /tmp/foo_dir from a remote pod to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp default/admin-dashboard-pod-16:/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... |
Forward local port 8000 to port 6379 in the pod "backend-pod" on both localhost and IP "10.19.21.23" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 8000:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Add a taint with the key 'app' and value 'dev-node-4:PreferNoSchedule' on nodes that have the label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack app=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": "Out... |
Create a deployment named 'db' running the 'hazelcast/hazelcast' image | Command:
```bash
kubectl create deployment db --image=hazelcast/hazelcast
```
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: json... |
Apply a taint with the key 'app' to nodes with the label 'component=proxy' with the value 'node-2:PreferNoSchedule' | Command:
```bash
kubectl taint node -l component=proxy app=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 f... |
Forward port 5432 on localhost and IP 10.19.21.23 to port 8088 in the pod named chat-app-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 5432:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Check if the current user has the permission to list the job named "content-import-job" in the "logging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/content-import-job -n logging
```
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... |
Forward traffic from all addresses on port 9090 to port 3000 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-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 ... |
Create a job named "log-collection" using the image "mcr.microsoft.com/dotnet/core/runtime" and run the command "dotnet --list-runtimes" | Command:
```bash
kubectl create job log-collection --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-runtimes
```
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": "... |
Delete pods and services named "payment" and "database" | Command:
```bash
kubectl delete pod,service payment database
```
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... |
Set the cluster field in the staging-context context to my-k8s-cluster | Command:
```bash
kubectl config set contexts.staging-context.cluster my-k8s-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 yo... |
Listen on port 3000 on all addresses and forward the traffic to port 8080 in the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 3000: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... |
Get the output of the "go version" command from the rocket-ranger container in the analytics-pod pod. | Command:
```bash
kubectl exec analytics-pod -c rocket-ranger -- 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,... |
Forward traffic from port 9090 on both localhost and IP 10.19.21.23 to port 5432 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 9090: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... |
Copy the file ~/.config/kube from your local machine to the /tmp/bar directory inside the monitoring-agent-pod-6 pod, specifically in the database-container container. | Command:
```bash
kubectl cp ~/.config/kube monitoring-agent-pod-6::/tmp/bar -c database-container
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Create a new secret named azure-storage-secret from an environment file | Command:
```bash
kubectl create secret generic azure-storage-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 ... |
Set the resource limits for the nginx container in the deployment named "nginx" | Command:
```bash
kubectl set resources deployment nginx -c=nginx --limits=cpu=1,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its ... |
Forward data between local port 8081 and the pod selected by the monitoring-stack-deployment deployment's port 5000. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8081 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 ... |
Create a job named "batch-processing" using the ethereum/client-go image, and run the "geth" command within the job. | Command:
```bash
kubectl create job batch-processing --image=ethereum/client-go -- geth
```
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": "Outpu... |
create a cron job named "monthly-audit" that runs the command "mysqld" every minute. The cron job should use the "mysql" image. | Command:
```bash
kubectl create cronjob monthly-audit --image=mysql --schedule="*/1 * * * *" -- mysqld
```
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", "de... |
Update the deployment 'analytics-platform-deployment' by importing the keys 'redis_host' from the config map 'app-config-prod' | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config-prod deployment/analytics-platform-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 new config map named kube-system-config with the specified keys and their corresponding files | Command:
```bash
kubectl create configmap kube-system-config --from-file=conf=/path/to/configs/file1.txt --from-file=data=/path/to/preferences/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 creati... |
Remove the environment variable "var-to-remove" for the "operator" entry in the exec auth plugin configuration. | Command:
```bash
kubectl config set-credentials operator --exec-env=var-to-remove-
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token flags:
... |
Retrieve the logs from the previously terminated ruby container of the web-app-pod pod | Command:
```bash
kubectl logs -p -c ruby web-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... |
Create a copy of the 'frontend-pod' pod, changing all container images to 'golang'. Name the new pod 'debug-image-api'. | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-api --set-image=*=golang
```
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... |
Execute the 'python --version' command inside the monitoring-pod and display the output | Command:
```bash
kubectl exec monitoring-pod -- 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 omitted, use the k... |
Retrieve the logs from container 'payment-gateway-pod-1' of the 'order-processing-deployment' deployment | Command:
```bash
kubectl logs deployment/order-processing-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 f... |
Execute the 'go run hello.go' command inside the 'monitoring-pod' pod and retrieve the output | Command:
```bash
kubectl exec monitoring-pod -- go run hello.go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ku... |
Forward traffic from port 8888 on localhost and IP 10.19.21.23 to port 8081 in the backend-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 8888:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Create an ingress named 'service-ingress' with a rule that directs requests from testing.com/bar to svc1:5432, using the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress service-ingress --rule="testing.com/bar=svc1:5432,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... |
Delete a cluster named "moon-cluster". | Command:
```bash
kubectl config delete-cluster moon-cluster
```
What it does:
Delete the specified cluster from the kubeconfig.
Syntax:
`kubectl config delete-cluster NAME` |
Display details about the replica controller named "web", the service named "proxy-server-rc", and the pod named "media-stream-pod" | Command:
```bash
kubectl get rc/web service/proxy-server-rc pods/media-stream-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 name... |
Update the nginx container image from the local file specified in path/to/file.yaml to node:14.17.3 without hitting the server, and print the result in yaml format. | Command:
```bash
kubectl set image -f path/to/file.yaml node=node:14.17.3 --local -o yaml
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replica... |
forward all traffic on port 8888 to port 3000 inside the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8888: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... |
Update the annotation 'SLA' of pod 'web' with the value '99.9% uptime'. | Command:
```bash
kubectl annotate pods web SLA='99.9% uptime'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary strin... |
Update the cluster role binding for a service account to have admin privileges. | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:tekton
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespa... |
Update the 'log-aggregator' pod by adding or updating the annotation 'release-notes' with the value 'https://example.com/release-notes/v2.5.1'. | Command:
```bash
kubectl annotate --overwrite pods log-aggregator release-notes='https://example.com/release-notes/v2.5.1'
```
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 pai... |
Add a taint with key 'cpu-type' on nodes having label app-type=microservice | Command:
```bash
kubectl taint node -l app-type=microservice cpu-type=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": "", ... |
Forward port 8080 on all addresses to port 8088 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8080:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
List the deployments in the "dev-2.2.0" version of the "apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.dev-2.2.0.apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will on... |
Create a new secret named email-credentials-secret using files from the folder "path/to/properties" | Command:
```bash
kubectl create secret generic email-credentials-secret --from-file=path/to/properties
```
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... |
Configure labels and selectors for a deployment/service pair before creating them. | Command:
```bash
kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
kubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -
```
... |
Access the shell of the first pod in the email-server-deployment and run a bash command | Command:
```bash
kubectl exec deploy/email-server-deployment -- 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 t... |
Create a pod disruption budget with a specified selector and minimum availability | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=project=my-project --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 --mi... |
Update the annotation 'team' of the pod 'security' to 'frontend-team', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods security team='frontend-team'
```
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 incl... |
Run the 'redis-server' command in the 'nebula-navigator' container of the 'security-service-pod' and display the output | Command:
```bash
kubectl exec security-service-pod -c nebula-navigator -- redis-server
```
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.... |
Update the pod 'cdn' by adding the annotation 'alert-email' with the value 'alerts@example.com' | Command:
```bash
kubectl annotate pods cdn 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 and include arb... |
Create a new secret named ldap-credentials-secret with keys for each file in the path/to/preferences folder | Command:
```bash
kubectl create secret generic ldap-credentials-secret --from-file=path/to/preferences
```
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... |
create a job named "cleanup" using the ethereum/client-go image, and run the command "geth version" | Command:
```bash
kubectl create job cleanup --image=ethereum/client-go -- geth version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output... |
Copy the local file /tmp/foo to the remote pod logging-agent-pod-7 in the /tmp/bar_dir directory of the api-server-container container. | Command:
```bash
kubectl cp /tmp/foo logging-agent-pod-7:/tmp/bar_dir -c api-server-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 omi... |
Create a copy of the "gateway-pod" with a debug container, and change the container images to "debian" for the debug container and "nginx:1.21" for the "proxy" container and "nginx:latest" for the "web" container. | Command:
```bash
kubectl debug gateway-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and nam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.