prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
List the deployments in the JSON output format, by specifying the version "v2.1.0" and the API group "custom-apps" | Command:
```bash
kubectl get deployments.v2.1.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 you wil... |
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 ... |
Copy the local file "/tmp/foo_dir" to the remote pod "logging/ingress-controller-pod-8" in the "/tmp/bar" directory | Command:
```bash
kubectl cp /tmp/foo_dir logging/ingress-controller-pod-8:/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 t... |
Forward local port 8080 to port 8080 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8080: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 aut... |
Remove a label named 'role' from the pod named 'api' | Command:
```bash
kubectl label pods api role-
```
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 true, ch... |
Forward traffic from port 9090 to port 8081 in the pod named "proxy-server-pod" and listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 9090: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 ... |
Create a job to build an image using the specified command | Command:
```bash
kubectl create job image-build-job --image=wordpress -- apache2ctl -D FOREGROUND
```
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": "", "usag... |
Check if you have permission to list the job named "virus-scan-job" in the "production" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/virus-scan-job -n production
```
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 ... |
Get the output from the cosmic-container in the mypod pod | Command:
```bash
kubectl attach mypod -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 omitted, use t... |
Import the `max_connections` key from the `global-config` config map into the `cache-cluster-deployment` deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/global-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 de... |
Forward traffic from local port 8000 to port 6379 in the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward pod/e-commerce-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 criteria, a pod will be selected aut... |
Create a new config map named app-config in the current namespace, with key1=config1 and key2=config2 | Command:
```bash
kubectl create configmap app-config --from-literal=conf=config1 --from-literal=data=config2
```
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 wil... |
Create a cluster role binding named "default_role" that applies the "default_role" cluster role to the users jane.doe and bob.smith, as well as the group developers. | Command:
```bash
kubectl create clusterrolebinding default_role --clusterrole=default_role --user=jane.doe --user=bob.smith --group=developers
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=gr... |
Create a deployment named auth that runs the python image | Command:
```bash
kubectl create deployment auth --image=python
```
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|yaml|name|... |
Get the output from running the command 'elasticsearch --version' in the lunar-launcher container from the mypod pod. | Command:
```bash
kubectl exec mypod -c lunar-launcher -- elasticsearch --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Add a taint with key 'cpu-type' on nodes having label instance=app-instance-1 and value node-2:PreferNoSchedule | Command:
```bash
kubectl taint node -l instance=app-instance-1 cpu-type=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": "", "usag... |
Create a service for a replicated alpine container, which serves on port 8080 and connects to the containers on port 637900. | Command:
```bash
kubectl expose rc alpine --port=8080 --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 specified port.... |
Add a taint with key 'workload' on nodes having label 'myLabel' with the value 'node-2:PreferNoSchedule' | Command:
```bash
kubectl taint node -l myLabel workload=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 form... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/kube-system-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variab... |
Create a role named "default_role" with API Group specified | Command:
```bash
kubectl create role default_role --verb=create,get,proxy --resource=replicasets.apps
```
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|none]`
Helpful flags:
"fl... |
create a service for the 'ruby' replication controller, which serves on port 3000 and connects to the containers on port 9091 | Command:
```bash
kubectl expose rc ruby --port=3000 --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 specified port. A... |
Forward traffic from port 8088 on your local machine to port 6379 in the pod named "web-app-pod". | Command:
```bash
kubectl port-forward pod/web-app-pod 8088:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Update the 'notification-handler-deployment' deployment by adding a new environment variable named LOG_LEVEL with the value 'info'. | Command:
```bash
kubectl set env deployment/notification-handler-deployment LOG_LEVEL=info
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod tem... |
Add a taint with key 'app' on nodes having label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp app=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": "", "usage": "O... |
List the replication controller for web, service, email-service-rc, and pods/database-pod | Command:
```bash
kubectl get rc/web service/email-service-rc pods/database-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... |
Set the cluster field of the dev-context context to cloud-cluster | Command:
```bash
kubectl config set contexts.dev-context.cluster cloud-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 wan... |
Add a taint to a node called 'app-node-6' with the key 'zone' and no value | Command:
```bash
kubectl taint nodes app-node-6 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|... |
Create an ingress object named 'public-service-ingress' with a rule that directs requests for 'website.com/example' to the service 'svc1:6379' | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/example=svc1:6379,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"... |
Update the pod specified in the "setup.json" file and add the annotation "team=frontend team" | Command:
```bash
kubectl annotate -f setup.json 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 include arbitrar... |
Create a secret named my-secret using files from the specified path | Command:
```bash
kubectl create secret generic my-secret --from-file=path/to/data
```
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 of the file, ... |
Forward traffic from localhost and IP address 10.19.21.23 on port 8000 to port 6379 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-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 cri... |
Create a deployment named "web" with the "amazonlinux" image and 6 replicas. | Command:
```bash
kubectl create deployment web --image=amazonlinux --replicas=6
```
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... |
View the last applied configuration for a specified deployment in YAML format | Command:
```bash
kubectl apply view-last-applied deployment/php
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-applied (T... |
Import environment variables from a secret for a specific deployment | Command:
```bash
kubectl set env --from=secret/my-secret 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 definitions in one or more po... |
Set the service account of the deployment "order-processing-deployment" to "kube-proxy". | Command:
```bash
kubectl set serviceaccount deployment order-processing-deployment kube-proxy
```
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:... |
Copy the ~/.config/kube directory from the remote pod named "front-end-pod-12" to the /etc/kubernetes directory on your local machine. | Command:
```bash
kubectl cp kube-node-lease/front-end-pod-12:~/.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 omitt... |
Get output from running 'geth' command on the cache-service pod | Command:
```bash
kubectl exec svc/cache-service -- 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, use the kubectl.ku... |
Create a new LoadBalancer service named email-service-lb with the TCP port mapping of 8080 on the service to port 9000 on the backend | Command:
```bash
kubectl create service loadbalancer email-service-lb --tcp=8080:9000
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/namespace-config 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 va... |
Create a cluster role named "default_role" with the verb "list" and the non-resource URL "/debug/ns/*". | Command:
```bash
kubectl create clusterrole "default_role" --verb=list --non-resource-url=/debug/ns/*
```
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... |
Execute the 'mongod' command inside the web-app-pod and retrieve the output from the first container | Command:
```bash
kubectl exec web-app-pod -- mongod
```
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... |
Forward all traffic coming to port 5000 on all addresses to port 8088 in the frontend-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 5000: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... |
Open a terminal and attach it to a specific pod, allowing you to interact with the pod's shell commands. | Command:
```bash
kubectl attach email-service-pod -c nano-bot -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 omit... |
Create a new config map named global-config using environment variables from a file. | Command:
```bash
kubectl create configmap global-config --from-env-file=path/to/settings.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 the... |
Create a new secret named email-credentials-secret by using the properties from the env file located at 'path/to/properties.env' | Command:
```bash
kubectl create secret generic email-credentials-secret --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 ... |
Update the image of all containers in the daemonset 'namespace-1' to 'amazonlinux:2' | Command:
```bash
kubectl set image daemonset namespace-1 *=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:... |
Create a job named "report-generation-job" using the mysql image, and run the command "mysql --version" within the job | Command:
```bash
kubectl create job report-generation-job --image=mysql -- mysql --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": "Ou... |
Create a new ExternalName service named external-metrics-service that resolves to the external name "blog-test.blog" | Command:
```bash
kubectl create service externalname external-metrics-service --external-name blog-test.blog
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference servi... |
Import the 'smtp_server' key from the 'api-config' ConfigMap and set it as an environment variable for the 'search-engine-deployment' Deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/api-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 definitio... |
Execute the command "python --version" in the first container of the first pod of the monitoring-service service. | Command:
```bash
kubectl exec svc/monitoring-service -- 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, u... |
Forward traffic from a local random port to port 8888 in a pod. | Command:
```bash
kubectl port-forward pod/backend-pod :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 automatica... |
Embed the certificate authority data for the "star-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/cluster-beta/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set... |
Rollback the daemonset named 'development' to revision 1 | Command:
```bash
kubectl rollout undo daemonset/development --to-revision=1
```
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... |
Retrieve the output from running the 'php --version' command in the cyber-sleuth container of the media-stream-pod pod. | Command:
```bash
kubectl exec media-stream-pod -c cyber-sleuth -- 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 omi... |
import the environment variables from the 'database-secret' secret into the 'monitoring-stack-deployment' deployment | Command:
```bash
kubectl set env --from=secret/database-secret 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 definitions in one or m... |
Update the annotation 'app-version' of the pod 'proxy-server' to '2.5.1', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods proxy-server app-version='2.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 pairs that can be larger than labels and i... |
Output the modified deployment in YAML format without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/database-deployment MAX_CONNECTIONS=100 -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 pod te... |
Get the output from running the 'geth version' command in the code-explorer container of the analytics-pod. | Command:
```bash
kubectl exec analytics-pod -c code-explorer -- geth 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 omitte... |
Embed certificate authority data for the "data-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/cluster-beta/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set... |
Describe the details of a specific pod | Command:
```bash
kubectl describe pods/auth-service
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a... |
Add a taint with the key 'app' on nodes having the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice app=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Forward traffic from localhost port 8080 to port 3000 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 8080: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 au... |
Retrieve the output of running the 'node' command in the 'warp-drive' container of the 'security-service-pod' pod | Command:
```bash
kubectl exec security-service-pod -c warp-drive -- node
```
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, u... |
Create a pod disruption budget named 'batch-processing-pdb' that will select all pods with the 'role=worker' label and require at least four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget batch-processing-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... |
Update the label of the 'proxy' pod to set the status as 'unhealthy' only if the resource version is still 1 | Command:
```bash
kubectl label pods proxy status=unhealthy --resource-version=1
```
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", "defaul... |
Forward local port 9090 to port 3000 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 9090:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Listen on the local ports 5432 and 6000, and forward the data to/from ports 8888 and 6000 in a pod selected by the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 5432 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 wi... |
delete the pods and services named "monitoring" and "web" | Command:
```bash
kubectl delete pod,service monitoring web
```
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.
... |
Delete the pods and services with the names "auth" and "monitoring" | Command:
```bash
kubectl delete pod,service auth monitoring
```
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.... |
Execute the command 'yum install -y aws-cli' inside the 'warp-drive' container of the 'database-pod' pod | Command:
```bash
kubectl exec database-pod -c warp-drive -- yum install -y aws-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
Create a single ingress named 'api-v2-ingress' that routes requests to 'site.com/module' to the service 'svc1' on port 8080 | Command:
```bash
kubectl create ingress api-v2-ingress --rule="site.com/module=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Forward traffic between local ports 8888 and 6000 to a pod selected by the deployment named "monitoring-stack-deployment" on ports 8888 | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8888 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 ... |
Forward requests from all addresses on port 8080 to port 8000 in the cdn-service-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-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 w... |
Add a taint with the key 'hardware' and value 'worker-node-3:PreferNoSchedule' on nodes that have the label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops hardware=worker-node-3: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": "... |
Edit the YAML configuration of the 'cache-cluster-deployment' deployment and save the modified configuration in its annotation. | Command:
```bash
kubectl edit deployment/cache-cluster-deployment -o yaml --save-config
```
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 en... |
Fetch the output from running the 'elasticsearch' command in the 'time-machine' container of the 'vpn-service-pod' pod. | Command:
```bash
kubectl exec vpn-service-pod -c time-machine -- elasticsearch
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omit... |
Attach to the 'astro-container' in the 'payment-gateway-pod' and get the output | Command:
```bash
kubectl attach payment-gateway-pod -c astro-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 o... |
List the replication controllers, services, and pods with the specified names. | Command:
```bash
kubectl get rc/web service/web-app-rc pods/database-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced yo... |
Execute the 'mongo' command on the first pod of the 'email-service' service, using the first container, and retrieve the output. | Command:
```bash
kubectl exec svc/email-service -- mongo
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.k... |
Auto scale the replication controller "cdn" to have a minimum of 1 and a maximum of 5 pods, with a target CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc cdn --max=5 --cpu-percent=50
```
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 the... |
Import the specific key "my-example-key" from the "app-config" config map into the environment variables of the "authentication-service-deployment" deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-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 variab... |
Begin streaming logs of the warp-drive container in the vpn-service-pod pod | Command:
```bash
kubectl logs -f -c warp-drive 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": "--container", "s... |
Create a new secret named 'ssl-key-secret' with keys for each file in the 'path/to/preferences' folder. | Command:
```bash
kubectl create secret generic ssl-key-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 basename o... |
Set environment variables using specific keys from a config map. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-config-dev 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 def... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/gcp-service-account-secret deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Update the pod with the name 'frontend' by setting the label 'component' to 'web' | Command:
```bash
kubectl label pods frontend component=web
```
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":... |
Get output from running the 'psql' command in the auth-service-pod | Command:
```bash
kubectl exec auth-service-pod -- psql
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kub... |
Add a taint with key 'zone' and value 'testing-node-11:PreferNoSchedule' on nodes having label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops zone=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Create a pod disruption budget named web-app-pdb | Command:
```bash
kubectl create poddisruptionbudget web-app-pdb --selector=owner=team-1 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dr... |
Create a copy of a pod, changing the command of a container. | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-memcached --container=mycontainer -- 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... |
Set the cluster field in the local-context context to cluster-beta. | Command:
```bash
kubectl config set contexts.local-context.cluster cluster-beta
```
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 wa... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/kube-system-config deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable ... |
update the annotation 'scaling-policy' of the pod 'cdn' with the value 'auto-horizontal-scaling' | Command:
```bash
kubectl annotate pods cdn 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 than labels and inc... |
Forward local port 3000 to port 8080 in the pod "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-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 will be selected auto... |
Create a copy of the "log-aggregator-pod" pod and change the command to "cyber-sleuth" by running the container interactively and copying it to the "debug-image-web" pod. | Command:
```bash
kubectl debug log-aggregator-pod -it --copy-to=debug-image-web --container=cyber-sleuth -- 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 ... |
create a pod named 'nginx' running the 'ubuntu' image, but override the pod's specification with the values provided in the JSON file | Command:
```bash
kubectl run nginx --image=ubuntu --overrides='{ "apiVersion": "v1.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] -- [COMMAN... |
Forward traffic from port 8080 on all addresses to port 5432 in the pod named e-commerce-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8080:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wi... |
Scale the deployment named dev-environment-rs to the same size it is currently, which is 5. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=5 deployment/dev-environment-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-... |
import the DEBUG_MODE key from the config map named app-name-config to the deployment authentication-service-deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-name-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 a service for a replicated ubuntu, serving on port 8082 and connecting to the containers on port 8000 | Command:
```bash
kubectl expose rc ubuntu --port=8082 --target-port=800000
```
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.