prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Add the 'special' taint on the nodes labeled with 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace special=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":... |
Execute the command "nginx -g 'daemon off;'" in the cosmic-container of the pod named proxy-server-pod and retrieve the output. | Command:
```bash
kubectl exec proxy-server-pod -c cosmic-container -- nginx -g "daemon off;"
```
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... |
Create an ingress that directs requests to a specific URL path to a service. | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="website.com/example=svc1:8082,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": "",... |
Embed the certificate authority data for the 'cluster-gamma' cluster entry by running the command: kubectl config set-cluster cluster-gamma --embed-certs --certificate-authority=~/.kube/app-cluster/kubernetes.ca.crt | Command:
```bash
kubectl config set-cluster cluster-gamma --embed-certs --certificate-authority=~/.kube/app-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 set... |
Import the 'my-example-key' from the 'app-config-prod' config map into the environment variables of the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-config-prod 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 defi... |
Start a pod with the name 'busybox' using the 'postgres' image, and keep it running in the foreground | Command:
```bash
kubectl run -i -t busybox --image=postgres --restart=Never
```
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:
"f... |
List all deployments in the "feature-branch-2.3.0" version of the "testing-apps" API group in YAML output format | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.testing-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is nam... |
Set the service account of the deployment named "log-aggregator-deployment" to "prometheus" | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-deployment prometheus
```
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:
`... |
Start a mysql pod and configure it to expose port 3306 for communication | Command:
```bash
kubectl run hazelcast --image=mysql --port=3306
```
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": "--fi... |
Create a new ClusterIP service named database-service-clusterip that maps port 8181 on the service to port 8083 on the pods. | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=8181:8083
```
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... |
List the name and image of the containers in the "monitoring-pod" | Command:
```bash
kubectl get pod monitoring-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 --... |
Create a job with a command to run a "postgres" image and execute the "pg_dump" command with "--version" option. | Command:
```bash
kubectl create job certificate-renewal --image=postgres -- pg_dump --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": ... |
Copy the local file '/tmp/foo' to the remote pod 'security-scanner-pod-18' in the 'rook-ceph' namespace, and place it at '/tmp/bar' inside the pod. | Command:
```bash
kubectl cp /tmp/foo rook-ceph/security-scanner-pod-18::/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... |
Update the environment variable 'REDIS_HOST' of the deployment 'proxy-service-deployment' | Command:
```bash
kubectl set env deployment/proxy-service-deployment REDIS_HOST=redis-server
```
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 t... |
Create a new config map named "env-vars" with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap env-vars --from-file=conf=/path/to/configs/file1.txt --from-file=data=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config m... |
Execute the command 'apk add curl' in the 'astro-container' of the 'analytics-pod' and get the output. | Command:
```bash
kubectl exec analytics-pod -c astro-container -- apk add curl
```
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... |
Import the `CONFIG_FILE_PATH` key from the `db-config` ConfigMap into the `frontend-deployment` deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/db-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 definition... |
Start a pod named 'hazelcast' using the 'php' image, and expose port 8000. | Command:
```bash
kubectl run hazelcast --image=php --port=8000
```
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": "--file... |
Add label 'release' with the value 'v2.0' to the pod 'proxy-server' | Command:
```bash
kubectl label pods proxy-server release=v2.0
```
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", "usag... |
Listen on port 9090 locally, forwarding to port 5000 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward pod/backend-pod 9090:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Delete the pods and services named "foo" and "proxy" | Command:
```bash
kubectl delete pod,service foo 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 ... |
Embed the certificate authority data for a cluster entry | Command:
```bash
kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/e2e/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-cluster ... |
Get the specified resources by their types and names | Command:
```bash
kubectl get rc/web service/log-aggregator-rc pods/payment-gateway-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... |
Import the log_level key from the kube-system-config config map and set it as an environment variable for the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/kube-system-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 var... |
Retrieve the previous logs of the terminated ruby container from the pod named "proxy-service-pod" | Command:
```bash
kubectl logs -p -c ruby proxy-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short... |
Set the service account of the deployment "authentication-service-deployment" to "prometheus" | Command:
```bash
kubectl set serviceaccount deployment authentication-service-deployment prometheus
```
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
S... |
Forward port 8888 on all addresses to port 3000 in the backend-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8888:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Import all environment variables from the config map 'app-name-config' into the deployment 'scheduler-app-deployment', prefixing each variable with 'MYSQL_' | Command:
```bash
kubectl set env --from=configmap/app-name-config --prefix=MYSQL_ 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... |
Forward a local port to a pod port | Command:
```bash
kubectl port-forward pod/api-service-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 automa... |
Start a pod named 'nginx' with the postgres image, but override the spec with a partial set of values parsed from the provided JSON. | Command:
```bash
kubectl run nginx --image=postgres --overrides='{ "apiVersion": "feature-branch-2.3.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] [--com... |
Set the user field of the 'app-2-context' context entry to 'cluster-admin' without changing any other values | Command:
```bash
kubectl config set-context app-2-context --user=cluster-admin
```
What it does:
Set a context 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-context [NAME | --current] [--cluster=cluster_nickname... |
Execute the 'elasticsearch' command in the 'code-explorer' container of the 'monitoring-pod' pod and display the output. | Command:
```bash
kubectl exec monitoring-pod -c code-explorer -- 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... |
List all deployments in the "legacy-1.0.0" version of the "sandbox-apps" API group in YAML format | Command:
```bash
kubectl get deployments.legacy-1.0.0.sandbox-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced ... |
Create an ingress named 'web-ingress' that routes requests from foo.com/example to svc1:9000 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress web-ingress --rule="foo.com/example=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Set the service account of the deployment "notification-handler-deployment" to "elasticsearch" | Command:
```bash
kubectl set serviceaccount deployment notification-handler-deployment elasticsearch
```
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
... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/namespace-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... |
Embed certificate authority data for cluster entry | Command:
```bash
kubectl config set-cluster on-prem-cluster --embed-certs --certificate-authority=~/.kube/cluster-gamma/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 the environment variable SMTP_HOST to smtp.example.com for the deployment named 'mydeployment' | Command:
```bash
kubectl set env deployment/mydeployment SMTP_HOST=smtp.example.com
```
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 ... |
Set the resource request and limits for all containers in the postgres deployment | Command:
```bash
kubectl set resources deployment postgres --limits=cpu=200m,memory=512Mi --requests=cpu=5,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requeste... |
Listen on port 8088 on your local machine and forward the traffic to port 6379 in the 'frontend-pod' pod | Command:
```bash
kubectl port-forward pod/frontend-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 autom... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/env-vars deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Create an ingress with TLS enabled using the default ingress certificate and different path types | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="website.com/=svc:https,tls" \
--rule="website.com/path/subpath*=othersvc:3001"
```
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"... |
Execute the 'geth version' command in the time-machine container of the payment-gateway-pod and retrieve the output. | Command:
```bash
kubectl exec payment-gateway-pod -c time-machine -- 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 o... |
Execute 'geth attach' command in rocket-ranger container of media-stream-pod and get the output. | Command:
```bash
kubectl exec media-stream-pod -c rocket-ranger -- geth attach
```
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... |
Forward local port 6379 to port 6379 in the 'mypod' pod | Command:
```bash
kubectl port-forward pod/mypod 6379: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 automaticall... |
List all deployments in the "v2.1.0" version of the "testing-apps" API group in YAML output format. | Command:
```bash
kubectl get deployments.v2.1.0.testing-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you wi... |
Forward local ports to a pod | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 3000 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
Return the logs of the previous terminated "stardust-shuttle" container from the "proxy-server-pod" pod. | Command:
```bash
kubectl logs -p -c stardust-shuttle proxy-server-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--contain... |
Get the output of the 'python --version' command from the analytics-pod | Command:
```bash
kubectl exec analytics-pod -- python --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ku... |
Rename the context 'prod-context' to 'edge-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context prod-context edge-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will also be... |
Embed certificate authority data for the cluster-gamma cluster entry. | Command:
```bash
kubectl config set-cluster cluster-gamma --embed-certs --certificate-authority=~/.kube/kube-cluster-2/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config ... |
Import the 'DATABASE_URL' key from the 'kube-system-config' ConfigMap into the 'payment-processor-deployment' deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/kube-system-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 varia... |
Create a debug copy of the analytics pod with updated container images | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-web --image=debian --set-image=scheduler=my-scheduler:1.0,cache=redis:alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by ... |
Open the "docker-registry" service for editing using the "atom" editor. | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/docker-registry
```
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 variables... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/namespace-config 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 def... |
Edit the 'load-balancer-deployment' deployment by opening its configuration file in YAML format | Command:
```bash
kubectl edit deployment/load-balancer-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... |
Update the cluster role binding for prometheus by specifying the service account "prometheus" in the namespace "namespace" as the subject for the "admin" cluster role. | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:prometheus
```
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=nam... |
Create a pod disruption budget named 'notification-service-pdb' that selects all pods with the 'region=us-east' label and requires at least four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget notification-service-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-av... |
Forward the local ports 8000 to the pod's port 9090 in the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 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 po... |
Import specific keys from a config map to environment variables for a deployment named order-processing-deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Create a new config map named global-config with the specified key-value pairs: settings=file1.txt and key2=file2.txt from the given paths | Command:
```bash
kubectl create configmap global-config --from-file=settings=/path/to/settings/file1.txt --from-file=key2=/path/to/options/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a... |
Delete the pods and services with the names "monitoring" and "proxy-server" | Command:
```bash
kubectl delete pod,service monitoring proxy-server
```
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 s... |
Execute the 'redis-cli' command from the 'cyber-sleuth' container in the 'backend-pod' pod | Command:
```bash
kubectl exec backend-pod -c cyber-sleuth -- 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, use... |
Create a deployment named loadbalancer with 2 replicas, using the mongo image. | Command:
```bash
kubectl create deployment loadbalancer --image=mongo --replicas=2
```
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... |
Configure auto scaling for the deployment named "auth" with a minimum of 3 pods and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment auth --min=3 --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 uses th... |
Create a new config map named 'namespace-config' using the key=value pairs provided in the 'path/to/options' file. | Command:
```bash
kubectl create configmap namespace-config --from-file=path/to/options
```
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 basen... |
Create a new ingress called 'external-ingress' that routes requests from foo.com/input to the service named svc1 running on port 9090 | Command:
```bash
kubectl create ingress external-ingress --rule="foo.com/input=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Create a cron job named 'log-rotation' using the 'wordpress' image, with a schedule of running every minute, and executing the command 'mysql --version' | Command:
```bash
kubectl create cronjob log-rotation --image=wordpress --schedule="*/1 * * * *" -- mysql --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short... |
Forward traffic from port 5432 on all addresses to port 8088 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 5432:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Forward port 8081 on localhost and IP 10.19.21.23 to port 5432 in the pod named 'cdn-service-pod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 8081: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 cri... |
Forward traffic from local port 5000 to pod port 3000 | Command:
```bash
kubectl port-forward pod/frontend-pod 5000 3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Set the cluster field in the user-a-context context to cluster-beta | Command:
```bash
kubectl config set contexts.user-a-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 w... |
Return the logs from the container "mypod-1" of the deployment "monitoring-stack-deployment". | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c mypod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": ... |
delete the pods and services with the names "log-aggregator" and "auth" | Command:
```bash
kubectl delete pod,service log-aggregator auth
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selec... |
Create a deployment named grafana running the postgres image and expose port 8083 | Command:
```bash
kubectl create deployment grafana --image=postgres --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 copy of the web-app-pod and launch it in a debug image named debug-image-web | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-web --container=stardust-shuttle -- 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 ... |
create an ingress named 'internal-ingress' with a rule that directs requests from 'foo.com/example' to 'svc1:9000' using the tls secret 'my-cert' | Command:
```bash
kubectl create ingress internal-ingress --rule="foo.com/example=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Roll back the daemonset named 'development' to revision 7. | Command:
```bash
kubectl rollout undo daemonset/development --to-revision=7
```
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... |
Create a new ClusterIP service named database-service-clusterip that maps port 9091 on the cluster to port 8081 on the service. | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=9091:8081
```
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... |
Configure the service account of the 'api-server-deployment' deployment to 'spinnaker' | Command:
```bash
kubectl set serviceaccount deployment api-server-deployment spinnaker
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kubec... |
Create a new LoadBalancer service named 'auth-service-lb' that maps TCP port 9000 to port 7000 | Command:
```bash
kubectl create service loadbalancer auth-service-lb --tcp=9000:7000
```
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", "de... |
Update the annotation 'git-repo' of the pod 'backend' with the value 'https://github.com/example/my-app' | Command:
```bash
kubectl annotate pods backend git-repo='https://github.com/example/my-app'
```
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 labe... |
Execute the 'dotnet' command on the first pod of the 'monitoring-service' service. | Command:
```bash
kubectl exec svc/monitoring-service -- dotnet
```
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 kub... |
Set the CPU and memory limits for the php container in the nginx deployment. | Command:
```bash
kubectl set resources deployment php -c=nginx --limits=cpu=50m,memory=64Mi
```
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... |
Create an ingress named 'private-ingress' with a rule that directs requests for 'site.com/example' to 'svc1:8082' with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress private-ingress --rule="site.com/example=svc1:8082,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": "", "usa... |
Get the output from running the 'nginx' command in the 'code-explorer' container of the 'security-service-pod' pod. | Command:
```bash
kubectl exec security-service-pod -c code-explorer -- nginx
```
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... |
Listen on local ports 8000 and 6000, and forward data between those ports and ports 9090 and 6000 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward pod/backend-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 automa... |
Set the annotation 'criticality' to 'high' for the pod 'log-aggregator' | Command:
```bash
kubectl annotate pods log-aggregator 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 arbitr... |
Start streaming the logs of the "stardust-shuttle" container in the "monitoring-pod" pod. | Command:
```bash
kubectl logs -f -c stardust-shuttle 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... |
Get the output from running the 'elasticsearch' command in 'warp-drive' from the 'cdn-service-pod' | Command:
```bash
kubectl exec cdn-service-pod -c warp-drive -- 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 omitte... |
Use the nvim editor to edit the configuration of the authentication-service service | Command:
```bash
KUBE_EDITOR="nvim" 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 va... |
Create a pod disruption budget with the name api-service-pdb and the following conditions: select all pods with the app=rails label and ensure that at least one of them is always available. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=app=rails --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--d... |
Execute the 'kafka-server-start /etc/kafka/server.properties' command in the 'nano-bot' container within the 'web-app-pod' pod. | Command:
```bash
kubectl exec web-app-pod -c nano-bot -- kafka-server-start /etc/kafka/server.properties
```
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"... |
Create a cron job that runs a command on a specified schedule | Command:
```bash
kubectl create cronjob report-generation --image=centos --schedule="*/1 * * * *" -- yum install -y wget
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", ... |
Create a deployment named jenkins-x with 6 replicas, using the php image. | Command:
```bash
kubectl create deployment jenkins-x --image=php --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: ... |
Set the custom TLS server name "staging-cluster" to use for validation for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --tls-server-name=staging-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-autho... |
Create a new ClusterIP service named api-service-clusterip | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=5432: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... |
Create a Pod Disruption Budget named 'frontend-pdb' that will select all pods with the 'env=production' label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget frontend-pdb --selector=env=production --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 the "custom-version" version of the "legacy-apps" API group, and display the output in JSON format. | Command:
```bash
kubectl get deployments.custom-version.legacy-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... |
Create a job for batch processing with the Python image and the command "pip --version" | Command:
```bash
kubectl create job batch-processing --image=python -- pip --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.