prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy a file or directory from a pod to your local machine | Command:
```bash
kubectl cp argocd/logging-agent-pod-7:/var/run/secrets/kubernetes.io/serviceaccount/ :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Cont... |
Get output from running the 'bash' command in the analytics-pod container. | Command:
```bash
kubectl exec analytics-pod -- bash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kubern... |
Import the environment variables from the config map 'app-config' with the prefix 'MYSQL_' into the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --from=configmap/app-config --prefix=MYSQL_ 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 in on... |
Listen on port 3000 on all addresses, forwarding to port 3000 in the frontend-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 3000:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Wait for the pod "proxy-service-pod" to be ready | Command:
```bash
kubectl wait --for=condition=Ready pod/proxy-service-pod
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.
Alternatively, the command ... |
Set up auto scaling for the deployment "monitoring" with a minimum of 1 pod and a maximum of 10 pods | Command:
```bash
kubectl autoscale deployment monitoring --min=1 --max=10
```
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 u... |
Set a custom TLS server name for a specific cluster | Command:
```bash
kubectl config set-cluster moon-cluster --tls-server-name=app-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-... |
Get the list of Kafka topics from a pod named database-pod | Command:
```bash
kubectl exec database-pod -- kafka-topics --list
```
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 ... |
Update the annotation 'contact-email' of the 'proxy-server' pod to 'support@example.com', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods proxy-server contact-email='support@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 t... |
Create a service for the 'alpine' replication controller that serves on port 9092 and connects to the containers on port 700000. | Command:
```bash
kubectl expose rc alpine --port=9092 --target-port=700000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Embed certificate authority data for the moon-cluster cluster entry. | Command:
```bash
kubectl config set-cluster moon-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... |
Add a label 'component=worker' to the pod 'foo' | Command:
```bash
kubectl label pods foo component=worker
```
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": "... |
Add a taint to nodes with a specific label | Command:
```bash
kubectl taint node -l tier=frontend hardware=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": "Outpu... |
Forward traffic locally on a random port to port 3000 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod :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 automatica... |
Update the annotation of the pod named 'proxy' with the key 'owner' and the value 'alice-smith', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods proxy owner='alice-smith'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ... |
Add a taint with key 'hardware=app-node-6:PreferNoSchedule' on nodes having label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace hardware=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/password-secret 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 more pod templat... |
Create an ingress resource named ingtls with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="testing.com/=svc:https,tls" \
--rule="foo.com/path/subpath*=othersvc:7000"
```
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": "-... |
update the image of all containers in the daemonset 'namespace-3' to 'amazonlinux:2' | Command:
```bash
kubectl set image daemonset namespace-3 *=amazonlinux:2
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:... |
Retrieve a list of deployments in the "rc-1.1.0" version of the "api-v1" API group, and display the output in YAML format. | Command:
```bash
kubectl get deployments.rc-1.1.0.api-v1 -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will o... |
Create a new ClusterIP service named api-service-clusterip with the TCP port mapping 9091:8888 | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=9091: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", "d... |
Delete the pods and services with the names "vpn" and "proxy" | Command:
```bash
kubectl delete pod,service vpn proxy
```
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.
Some ... |
Apply the configuration in manifest.yaml and delete all resources not in the file and not matching the label app=nginx | Command:
```bash
kubectl apply --prune -f manifest.yaml -l service=auth
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'c... |
Create a deployment named "prometheus" using the "php" image and exposing port 8181. | Command:
```bash
kubectl create deployment prometheus --image=php --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: ... |
Forward all network traffic from port 3000 on your local machine to port 6379 on the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 3000 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 select... |
Attach to the cosmic-container in the vpn-service-pod pod to get output | Command:
```bash
kubectl attach vpn-service-pod -c cosmic-container
```
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 omit... |
Listen on your local machine's port 8888 and forward the traffic to the "https" port of the "payment-service" service. | Command:
```bash
kubectl port-forward service/payment-service 8888:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Listen on port 8081 on all addresses and forward to port 3000 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8081: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 new config map named api-config with the specified keys, "conf" and "data", using the files "/path/to/configurations/file1.txt" and "/path/to/settings/file2.txt" respectively. | Command:
```bash
kubectl create configmap api-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/settings/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... |
Forward traffic from local port 8888 to the pod selected by the service "scheduler-service" on the targetPort of the service's port named "https" | Command:
```bash
kubectl port-forward service/scheduler-service 8888:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sele... |
Update the environment variable of all containers in all replication controllers in the project to have the value "DEBUG=true" | Command:
```bash
kubectl set env rc --all DEBUG=true
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replication controllers... |
Import the specified keys (CONFIG_FILE_PATH) from the config map (app-name-config) into the environment variables of the user-management-deployment deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-name-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 variab... |
create a cluster role named "custom_role" with the specified resources and verbs | Command:
```bash
kubectl create clusterrole custom_role --verb=exec --resource=services --resource-name=file-processing --resource-name=load-balancer
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server... |
Add or update the annotation 'criticality' with the value 'high' for the pod 'payment' | Command:
```bash
kubectl annotate pods payment criticality=high
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary str... |
Set the subject of the cluster role binding for the "admin" role to the service account "spinnaker" in the specified namespace. | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:spinnaker
```
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=name... |
Update the pod 'email' with the annotation 'contact-email' and the value 'support@example.com' | Command:
```bash
kubectl annotate pods email contact-email=support@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 includ... |
Remove a taint from a specific node | Command:
```bash
kubectl taint nodes dev-node-4 app:PreferNoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Forward port 8081 on localhost and IP 10.19.21.23 to port 8888 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 8081: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 crite... |
Import the 'LOG_LEVEL' key from the 'namespace-config' ConfigMap and set it as an environment variable for the 'cache-cluster-deployment' deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/namespace-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 an ingress called 'internal-ingress' that directs requests from 'site.com/example' to 'svc1:8084' | Command:
```bash
kubectl create ingress internal-ingress --rule="site.com/example=svc1:8084,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": "", "us... |
Forward local port 5432 to port 3000 in a pod selected by the search-engine-deployment deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 5432 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 wil... |
Add a taint with the key 'disktype' on nodes that have the label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster disktype=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": "", "usag... |
Forward local port 3000 to port 5432 in the pod "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 3000: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 autom... |
List deployments in the "beta-1.0" version of the "custom-deployments" API group in JSON output format. | Command:
```bash
kubectl get deployments.beta-1.0.custom-deployments -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 namespace... |
Forward data between local port 8000 and port 5432 of the frontend-pod pod | Command:
```bash
kubectl port-forward pod/frontend-pod 8000 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 autom... |
Set environment variables from specific keys in a config map for a deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/ui-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in... |
Create an ingress with multiple hosts and pathType set as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:27017" \
--rule="bar.com/admin*=svc2:http"
```
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"... |
Set the service account for the deployment named "database-deployment" to "fluentd" | Command:
```bash
kubectl set serviceaccount deployment database-deployment fluentd
```
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:
`kubectl s... |
Set resource limits for the go container in the deployment named "go" to have a CPU limit of 10 and a memory limit of 128Mi. | Command:
```bash
kubectl set resources deployment go -c=nginx --limits=cpu=10,memory=128Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its ... |
Start a Jenkins pod named nginx, using the Jenkins image | Command:
```bash
kubectl run nginx --image=jenkins --overrides='{ "apiVersion": "dev-2.2.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] -- [CO... |
Create a role named "bar" with the following specifications: | Command:
```bash
kubectl create role bar --verb=watch --resource=pods --resource-name=app-worker-2 --resource-name=file-storage
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|... |
Create an ingress with multiple hosts and set the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:9092" \
--rule="bar.com/admin*=svc2:http"
```
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",... |
Forward local port 8000 to port 9090 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/global-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 ... |
Import the LOG_LEVEL key from the monitoring-config config map and set it as an environment variable in the api-server-deployment deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/monitoring-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 definit... |
Get the replication controller named 'web', the service named 'vpn-service-rc', and the pod named 'e-commerce-pod' | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/e-commerce-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 namespa... |
Create a new secret named api-secret-key using the properties.env file located at path/to/properties.env. | Command:
```bash
kubectl create secret generic api-secret-key --from-env-file=path/to/properties.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the bas... |
Forward local traffic on port 8088 to port 5000 in the 'mypod' pod | Command:
```bash
kubectl port-forward pod/mypod 8088:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Forward traffic from the local machine's port 8080 to port 8000 in the "frontend-pod" pod, listening on all IP addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8080: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... |
Import the DATABASE_URL key from the global-config configmap into the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/global-config 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 varia... |
Create an ingress called 'public-api-ingress' with a rule that directs requests for foo.com/module to svc1:27017, and use the tls secret "my-cert" for secure communication. | Command:
```bash
kubectl create ingress public-api-ingress --rule="foo.com/module=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": "", "u... |
Create a copy of the 'chat-app-pod' pod, changing all container images to 'golang', and name it 'debug-image-api'. | Command:
```bash
kubectl debug chat-app-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... |
Create a new ClusterIP service named database-service-clusterip with a TCP port forwarding from port 5001 to port 9000. | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=5001:9000
```
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... |
Add a taint with key "zone" and no value to the node "dev-node-4" | Command:
```bash
kubectl taint nodes dev-node-4 zone:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|... |
import the specific keys "config_file_path" from the "configmap/app-config-prod" config map into the "scheduler-app-deployment" deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-config-prod deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Create a ClusterIP service named "analytics-service-clusterip" in headless mode | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --clusterip="None"
```
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":... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/git-credentials-secret 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 in one or mor... |
Create a debug copy of the 'media-stream-pod' pod with all container images changed to 'confluentinc/cp-kafka' and name it 'debug-image-web' | Command:
```bash
kubectl debug media-stream-pod --copy-to=debug-image-web --set-image=*=confluentinc/cp-kafka
```
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 b... |
Copy the `~/.config/kube` file from a remote pod to the local `/tmp/bar` directory. | Command:
```bash
kubectl cp prometheus/cache-pod-5:~/.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 the kube... |
Import environment variables from the 'azure-storage-secret' secret and apply them to the 'mydeployment' deployment. | Command:
```bash
kubectl set env --from=secret/azure-storage-secret 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 more pod te... |
Create a new config map named ui-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/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... |
Get output from running a Docker command in a specific container within a pod | Command:
```bash
kubectl exec database-pod -c time-machine -- docker run -d ubuntu 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": "Containe... |
Create a pod disruption budget named "cron-jobs-pdb" that will select all pods with the "component=web" label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=component=web --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 [-... |
Create a copy of the 'proxy-service-pod' pod, copying it to 'debug-image-1' and launch an interactive shell in the 'warp-drive' container. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-1 --container=warp-drive -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by de... |
Set the environment variable DEBUG_MODE to the value from the specific keys in the global-config ConfigMap for the web-app-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/global-config 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 i... |
Create a service for the replication controller specified in "wordpress-controller.yaml" | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=9090 --target-port=808300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on ... |
import the environment variables from the config map 'api-config' with the prefix 'MYSQL_' into the 'database-deployment' deployment | Command:
```bash
kubectl set env --from=configmap/api-config --prefix=MYSQL_ 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 definitions in on... |
View the detailed configuration of a specific context in your kubeconfig file | Command:
```bash
kubectl config get-contexts user-a-context
```
What it does:
Display one or many contexts from the kubeconfig file.
Syntax:
`kubectl config get-contexts [(-o|--output=)name)]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: name " |
Create a cluster role named "view" with a NonResourceURL specified | Command:
```bash
kubectl create clusterrole "view" --verb=proxy --non-resource-url=/proxy/*
```
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"... |
Create an ingress resource called 'external-ingress' with a rule that directs requests to site.com/input to svc1:8084 port | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/input=svc1:8084,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... |
Add the label 'tier=backend' to the pod named 'vpn' | Command:
```bash
kubectl label pods vpn tier=backend
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If t... |
Scale the resource specified in the "config.json" file to 1 replica | Command:
```bash
kubectl scale --replicas=1 -f config.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... |
Output the modified YAML for a deployment without making changes to the actual object on the server | Command:
```bash
kubectl set env deployment/web-app-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 in one or more... |
Create a pod disruption budget named 'statefulset-pdb' that will select all pods with the 'owner=team-1' label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget statefulset-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-available=N [... |
List deployments in JSON output format, specifically in the "stable-2.0.0" version of the "custom-apps" API group. | Command:
```bash
kubectl get deployments.stable-2.0.0.custom-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 y... |
Create a service for a Python deployment with port 80 and container port 8000 | Command:
```bash
kubectl expose deployment python --port=5001 --target-port=637900
```
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 specifi... |
Forward port 8888 on your local machine to port 6379 in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8888: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... |
Scale the replica set named 'webapp-replicaset' to 5 replicas. | Command:
```bash
kubectl scale --replicas=5 rs/webapp-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is va... |
Forward traffic from port 8000 on all addresses to port 8081 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8000: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 ... |
Forward local port 8888 to port 8088 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 8888: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... |
Create a copy of the chat-app-pod with a debug container and change the container images. | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=debug-image-1 --image=debian --set-image=mailer=mailer:latest,api=api:v2
```
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... |
Forward data between local port 9090 and the pod's port 6379 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 9090 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... |
Forward local port 3000 to port 6379 in the backend pod | Command:
```bash
kubectl port-forward pod/backend-pod 3000: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 automa... |
import specific keys from a config map to an environment variable in a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-secrets 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 i... |
Set the cluster field in the specified context to the given cluster name. | Command:
```bash
kubectl config set contexts.team-beta-context.cluster testing-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... |
Scale the resource identified by the type and name specified in the "setup.json" file to 7 replicas | Command:
```bash
kubectl scale --replicas=7 -f setup.json
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is validated... |
Import specific keys from a config map to an environment variable in a deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Create a pod disruption budget named batch-processing-pdb that selects all pods with the app=nginx label and requires at least half of the selected pods to be available at any time | Command:
```bash
kubectl create pdb batch-processing-pdb --selector=app=nginx --min-available=50%
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=se... |
Delete the resources specified in the kustomization.yaml file located in the params directory. | Command:
```bash
kubectl delete -k params/
```
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.
Some resources, ... |
Return the snapshot of the previous terminated logs for the "mycontainer" container in the "monitoring-pod" pod. | Command:
```bash
kubectl logs -p -c mycontainer monitoring-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", "s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.