prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import specific keys from a config map into a deployment. | Command:
```bash
kubectl set env --keys=config_file_path --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... |
Set the CPU limits of the container named "nginx" in the "go" deployment to "1" and the memory limits to "1Gi". | Command:
```bash
kubectl set resources deployment go -c=nginx --limits=cpu=1,memory=1Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its spe... |
Create a new config map named ui-config using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/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 config... |
Create a new config map named log-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap log-config --from-file=properties=/path/to/options/file1.txt --from-file=key1=/path/to/parameters/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 ... |
Import the 'external_api_url' key from the 'namespace-config' config map into the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/namespace-config deployment/payment-processor-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 var... |
Forward port 8088 to port 8081 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-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... |
Start a ruby pod with some specific configuration values specified in a JSON override. | Command:
```bash
kubectl run nginx --image=ruby --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] [--command] -- [CO... |
Copy the local file "/tmp/foo_dir" to the remote pod "kube-public/message-broker-pod-15" in the namespace, and place it in "/tmp/bar". | Command:
```bash
kubectl cp /tmp/foo_dir kube-public/message-broker-pod-15:/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 ... |
Attach to the 'cyber-sleuth' container in the 'gateway-pod' pod, and switch to raw terminal mode | Command:
```bash
kubectl attach gateway-pod -c cyber-sleuth -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Create a service for the 'wordpress' deployment, which serves on port 7000 and connects to the containers on port 500100. | Command:
```bash
kubectl expose deployment wordpress --port=7000 --target-port=500100
```
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... |
Create an ingress named 'public-service-ingress' that directs requests for foo.com/example to the service 'svc1' on port 8010, and use the TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress public-service-ingress --rule="foo.com/example=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": ""... |
Create a service for the replication controller specified in the "nginx-controller.yaml" file, serving on port 8181 and connecting to the containers on port 909100. | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=8181 --target-port=909100
```
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 ... |
Create a copy of the pod named "chat-app-pod" and change the command to "time-machine". | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=dgb-img --container=time-machine -- 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 default if ... |
Start a pod named 'hazelcast' using the 'ruby' image and expose container port '8888' | Command:
```bash
kubectl run hazelcast --image=ruby --port=8888
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fil... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/api-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or mor... |
Set the cluster field in the 'my-context' context to 'web-cluster' | Command:
```bash
kubectl config set contexts.testing-context.cluster web-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 w... |
Delete pods and services with names "backend" and "email" | Command:
```bash
kubectl delete pod,service backend email
```
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.
S... |
Create a new secret named oauth-secret from an env file | Command:
```bash
kubectl create secret generic oauth-secret --from-env-file=path/to/options.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 basename... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/password-secret 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 definitions in one or more... |
Add a taint with key 'dedicated' on nodes having label team=devops, specifically the storage-node-13 node | Command:
```bash
kubectl taint node -l team=devops dedicated=storage-node-13: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"... |
Expose a PHP deployment as a service on port 8088, connecting to containers on port 300000 | Command:
```bash
kubectl expose deployment php --port=8088 --target-port=300000
```
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 ... |
Run the 'go' command in the 'cyber-sleuth' container of the 'api-service-pod' pod and retrieve the output | Command:
```bash
kubectl exec api-service-pod -c cyber-sleuth -- 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 th... |
Create a service for the replication controller specified in the "wordpress-controller.yaml" file, serving on port 5000 and connecting to the containers on port 808800. | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=5000 --target-port=808800
```
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 ... |
Update the pod 'security' by adding or updating the annotation 'scaling-policy' with the value 'auto-horizontal-scaling' | Command:
```bash
kubectl annotate --overwrite pods security 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 larger ... |
Forward port 8088 on localhost and IP address 10.19.21.23 to port 5432 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 8088: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 th... |
Forward the local port 8081 to the pod's port 8081 | Command:
```bash
kubectl port-forward pod/backend-pod 8081: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 automa... |
Forward local port 5000 to port 8080 in the 'frontend-pod' pod | Command:
```bash
kubectl port-forward pod/frontend-pod 5000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Set the custom TLS server name for validation to "app-cluster" for the "edge-cluster" cluster entry | Command:
```bash
kubectl config set-cluster edge-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-... |
Forward local port 9090 to port 8080 in a pod selected by the deployment named web-app-deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 9090 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 s... |
Create a Pod Disruption Budget named "ingress-controller-pdb" that selects all pods with the label "region=us-east" and ensures that a minimum of four of these pods are available at any given time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=region=us-east --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-avai... |
Set the service account of the load-balancer-deployment deployment to kube-dns | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment kube-dns
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kub... |
Set the container image for a deployment's golang and busybox containers | Command:
```bash
kubectl set image deployment/golang busybox=busybox golang=golang:1.17
```
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), replicase... |
Embed the certificate authority data for the 'cluster-alpha' cluster entry using the certificate authority file located at '~/.kube/moon-cluster/kubernetes.ca.crt'. | Command:
```bash
kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/moon-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config se... |
Create a deployment named 'jenkins' using the 'mysql' image and expose port 8081 | Command:
```bash
kubectl create deployment jenkins --image=mysql --port=8081
```
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... |
Execute the 'geth' command in the 'astro-container' from the 'e-commerce-pod' pod, and display its output. | Command:
```bash
kubectl exec e-commerce-pod -c astro-container -- geth
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Simulate a rollback of the deployment 'staging' without actually performing the rollback. | Command:
```bash
kubectl rollout undo --dry-run=server deployment/staging
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying t... |
Scale the baz deployment to 5 replicas, matching the current size of 5. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=5 deployment/baz
```
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 spec... |
Forward local ports 3000 and 6000 to the corresponding ports in a pod named web-app-pod. | Command:
```bash
kubectl port-forward pod/web-app-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 be selected automa... |
Create a new config map named 'db-config' with the keys 'conf' and 'data' using the files '/path/to/profiles/file1.txt' and '/path/to/configs/file2.txt' respectively. | Command:
```bash
kubectl create configmap db-config --from-file=conf=/path/to/profiles/file1.txt --from-file=data=/path/to/configs/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 ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-secrets deployment/notification-handler-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... |
Import the "debug_mode" key from the "env-vars" config map and set it as an environment variable for the "scheduler-app-deployment" deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/env-vars 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 definitions ... |
import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-secrets 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 definitio... |
Forward local port 5432 to port 8080 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-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 will be selected auto... |
Create an ingress with the name 'web-ingress' that directs requests for the 'website.com/input' path to the service named 'svc1' on port '5432' using the TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress web-ingress --rule="website.com/input=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": "", "usage"... |
Forward local port 8000 to port 8080 in the pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8000: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 select... |
Create a pod disruption budget named payment-gateway-pdb that selects pods with the version=v2 label and ensures that at least one of them is available at any point in time | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=version=v2 --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... |
Update the image version (tag) of the 'chat-app-pod' pod to 'v4' | Command:
```bash
kubectl get pod chat-app-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
$ ... |
Add a taint with the key 'cpu-type' and value 'node-1:PreferNoSchedule' on nodes that have the label 'role=database' | Command:
```bash
kubectl taint node -l role=database cpu-type=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... |
Copy the ~/.config/kube file from the openfaas/security-scanner-pod-18 pod to the /tmp/bar_dir directory on your local machine. | Command:
```bash
kubectl cp openfaas/security-scanner-pod-18:~/.config/kube /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,... |
Update the deployment 'scheduler-app-deployment' with a new environment variable named 'API_KEY' | Command:
```bash
kubectl set env deployment/scheduler-app-deployment API_KEY=your-api-key
```
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 temp... |
Get the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/log-aggregator-rc pods/analytics-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is names... |
Partially update the kubelet-config specified in "kubelet-config.yaml" by merging the changes specified in the strategic merge patch '{"spec":{"replicas":3}' | Command:
```bash
kubectl patch -f kubelet-config.yaml -p '{"spec":{"replicas":3}'
```
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 ... |
Remove taints with key 'environment' from node 'edge-node-10' | Command:
```bash
kubectl taint nodes edge-node-10 environment-
```
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|y... |
Create a pod disruption budget named ingress-controller-pdb that will select all pods with the component=web label and require at least 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-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-avail... |
Create a debugging copy of the e-commerce-pod by changing all container images to busybox. | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-1 --set-image=*=busybox
```
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 re... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/global-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 definitio... |
Listen on port 8088 locally and forward traffic to port 8888 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 8088: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 criteria, a pod will be selected au... |
Switch to the raw terminal mode for the 'stardust-shuttle' container in the 'chat-app-pod' pod | Command:
```bash
kubectl attach chat-app-pod -c stardust-shuttle -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Forward traffic from port 5432 on all addresses to port 8081 in the backend-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5432: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 ... |
Create a copy of vpn-service-pod, changing container images to wordpress | Command:
```bash
kubectl debug vpn-service-pod --copy-to=my-debugger --set-image=*=wordpress
```
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 r... |
Return the previous terminated rocket-ranger container logs from the pod named backend-pod | Command:
```bash
kubectl logs -p -c rocket-ranger backend-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sh... |
Import the SMTP_SERVER key from the 'app-name-config' ConfigMap and set it in the 'mydeployment' deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-name-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Display the last 20 lines of logs for the pod named `media-stream-pod` | Command:
```bash
kubectl logs --tail=20 media-stream-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short":... |
Create a new config map named app-config with the following keys and their corresponding file paths: | Command:
```bash
kubectl create configmap app-config --from-file=properties=/path/to/options/file1.txt --from-file=key1=/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 conf... |
Autoscale the deployment "backend" with a range of 6 to 15 pods | Command:
```bash
kubectl autoscale deployment backend --min=6 --max=15
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Create a new config map named env-vars using the configurations from the file located at path/to/configurations.env | Command:
```bash
kubectl create configmap env-vars --from-env-file=path/to/configurations.env
```
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 map based on a file, the key will default to th... |
Copy the directory "/tmp/foo_dir" from the remote pod "kube-flannel/ingress-controller-pod-8" to the local directory "/tmp/bar". | Command:
```bash
kubectl cp kube-flannel/ingress-controller-pod-8:/tmp/foo_dir /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, ... |
Forward traffic from port 8080 on localhost and IP 10.19.21.23 to port 6379 in the pod named 'chat-app-pod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-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 criter... |
Listen on port 8088 on localhost and IP 10.19.21.23, forwarding to port 6379 in the security-service-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 8088:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching th... |
List deployments in JSON output format of the "v1.1.0" version of the "prod-apps" API group | Command:
```bash
kubectl get deployments.v1.1.0.prod-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 ... |
Auto scale the 'gateway' deployment with the number of pods between 3 and 9 | Command:
```bash
kubectl autoscale deployment gateway --min=3 --max=9
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses ... |
Set up a port-forwarding from your local machine's port 5432 to port 5432 in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5432:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Create an ingress called 'private-api-ingress' that directs requests to 'website.com/module' to 'svc1:9092' with a TLS secret called "my-cert" | Command:
```bash
kubectl create ingress private-api-ingress --rule="website.com/module=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ""... |
Add the annotation 'criticality' with the value 'high' to the pod named 'web'. | Command:
```bash
kubectl annotate pods web 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 string ... |
Execute the 'go run hello.go' command inside a pod and get the output | Command:
```bash
kubectl exec mypod -- 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 kubectl.kub... |
Create a service for the replicated php using replica set, which will serve on port 8082 and connect to the containers on port 500000 | Command:
```bash
kubectl expose rs php --port=8082 --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 port. A ... |
Auto scale the "backend" deployment with a minimum of 6 pods and a maximum of 9 pods. | Command:
```bash
kubectl autoscale deployment backend --min=6 --max=9
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses ... |
Use the micro editor to edit the authentication-service service. | Command:
```bash
KUBE_EDITOR="micro" kubectl edit svc/authentication-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 v... |
Copy the local file /tmp/foo_dir to the remote pod named task-processor-pod-17, in the default namespace, and place it in /tmp/bar_dir. | Command:
```bash
kubectl cp /tmp/foo_dir default/task-processor-pod-17:/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 traffic to a local random port, routing it to port 9090 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward pod/frontend-pod :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 automatic... |
Execute the 'python' command in the 'code-explorer' container of the 'monitoring-pod' pod. | Command:
```bash
kubectl exec monitoring-pod -c code-explorer -- python
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Execute the 'redis-cli' command in the 'rocket-ranger' container of the 'e-commerce-pod' pod and display the output. | Command:
```bash
kubectl exec e-commerce-pod -c rocket-ranger -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Run the 'mysql' command in the 'nebula-navigator' container of the 'monitoring-pod' pod and get the output. | Command:
```bash
kubectl exec monitoring-pod -c nebula-navigator -- mysql
```
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, ... |
Create a pod disruption budget named api-service-pdb that will select all pods with the version=v2 label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=version=v2 --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 [--... |
Create a new NodePort service named web-app-nodeport that maps port 6379 on the cluster to port 5432 on the service. | Command:
```bash
kubectl create service nodeport web-app-nodeport --tcp=6379:5432
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Start streaming the logs of the 'cosmic-container' container in the 'vpn-service-pod' pod | Command:
```bash
kubectl logs -f -c cosmic-container vpn-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": "--containe... |
Create a service for the replication controller specified in the "alpine-controller.yaml" file | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=8083 --target-port=844300
```
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... |
Update the image of all containers in the daemonset named 'namespace-3' to 'centos:8.4.2105'. | Command:
```bash
kubectl set image daemonset namespace-3 *=centos:8.4.2105
```
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)
Synta... |
Set the CPU limits to "200m" and memory to "256Mi" for the WordPress container in the deployment. | Command:
```bash
kubectl set resources deployment wordpress -c=nginx --limits=cpu=200m,memory=256Mi
```
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 u... |
Create an ingress called 'app-proxy-ingress' that redirects requests from testing.com/example to svc1:8083 and uses the 'my-cert' TLS secret. | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/example=svc1:8083,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": "",... |
Unset the namespace configuration for the "edge-context" context. | Command:
```bash
kubectl config unset contexts.edge-context.namespace
```
What it does:
Unset 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.
Syntax:
`kubectl config unset PROPERTY_NAME` |
Create a copy of the media-stream-pod resource and change all container images to use python | Command:
```bash
kubectl debug media-stream-pod --copy-to=my-debugger --set-image=*=python
```
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... |
Forward local ports 8000 and 8080 to the pods ports 8080 and 6000 for the deployment "email-server-deployment" | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8000 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... |
Create a copy of the `database-pod` with all container images changed to `postgres` and name the new copy `debug-image-memcached`. | Command:
```bash
kubectl debug database-pod --copy-to=debug-image-memcached --set-image=*=postgres
```
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 i... |
Switch to raw terminal mode and attach to the chat-app-pod container named nebula-navigator | Command:
```bash
kubectl attach chat-app-pod -c nebula-navigator -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Forward traffic from port 8888 on all addresses to port 9090 in the web-app-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8888:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Use specified keys from a config map to set environment variables in a deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config-dev 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 definit... |
Start a ruby pod with custom specifications by parsing a partial set of values from the provided JSON, using the command kubectl run nginx --image=ruby --overrides='{ "apiVersion": "custom-version", "spec": { .. | Command:
```bash
kubectl run nginx --image=ruby --overrides='{ "apiVersion": "custom-version", "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] -- [... |
Create a deployment named 'gitlab' that runs the 'jenkins' image and exposes port 8083. | Command:
```bash
kubectl create deployment gitlab --image=jenkins --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: ... |
Create a service for a replicated centos, which serves on port 8080 and connects to the containers on port 818100 | Command:
```bash
kubectl expose rc centos --port=8080 --target-port=818100
```
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.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.