prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Auto scale the deployment "payment" with a minimum of 2 pods and a maximum of 14 pods | Command:
```bash
kubectl autoscale deployment payment --min=2 --max=14
```
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... |
Execute the 'jenkins-plugin-cli' command in the 'nano-bot' container of the 'proxy-server-pod' pod and get the output. | Command:
```bash
kubectl exec proxy-server-pod -c nano-bot -- jenkins-plugin-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 om... |
Retrieve the snapshot logs from the container `proxy-service-deployment-1` of the deployment named `backend-pod`. | Command:
```bash
kubectl logs deployment/proxy-service-deployment -c backend-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag... |
Forward local port 5432 to the targetPort of a service named "https" in a selected pod | Command:
```bash
kubectl port-forward service/analytics-service 5432:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sele... |
Remove all taints with key 'datacenter' from node 'storage-node-13' | Command:
```bash
kubectl taint nodes storage-node-13 datacenter-
```
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... |
Use a specific editor other than the default to edit a service resource | Command:
```bash
KUBE_EDITOR="notepad" kubectl edit svc/proxy-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 variable... |
Autoscale the deployment "log-aggregator" with a minimum of 6 pods and a maximum of 13 pods | Command:
```bash
kubectl autoscale deployment log-aggregator --min=6 --max=13
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler th... |
Create a deployment named "app" with the image "mcr.microsoft.com/dotnet/core/runtime" and run the command "dotnet --list-sdks" inside the container. | Command:
```bash
kubectl create deployment app --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-sdks
```
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": ... |
Copy the ~/.config/kube directory from the remote pod named image-resizer-pod-20 in the kube-proxy namespace to the local directory /tmp/bar. | Command:
```bash
kubectl exec -n kube-proxy image-resizer-pod-20 -- tar cf - ~/.config/kube | tar xf - -C :/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": "... |
Partially update the configuration of a specific node by applying a strategic merge patch specified as YAML. | Command:
```bash
kubectl patch node dev-node-4 -p $'spec:\n someField: newValue'
```
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 f... |
Create a deployment named 'worker' with the 'postgres' image and expose port '8010' | Command:
```bash
kubectl create deployment worker --image=postgres --port=8010
```
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 analytics-pod and name it my-debugger, replacing all the container images in the pod with the postgres image. | Command:
```bash
kubectl debug analytics-pod --copy-to=my-debugger --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 if no reso... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=api_key --from=configmap/db-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 variable defin... |
List deployments in JSON output format using the "beta-1.0" version of the "legacy-apps" API group. | Command:
```bash
kubectl get deployments.beta-1.0.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 you w... |
Create a new secret named 'api-key-secret' using the environment variables specified in the 'options.env' file | Command:
```bash
kubectl create secret generic api-key-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 basena... |
Import the value of the `CONFIG_FILE_PATH` key from the `kube-system-config` config map and set it as an environment variable for the `load-balancer-deployment` deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/kube-system-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment varia... |
Scale the resource specified in the "options.yaml" file to 5 replicas. | Command:
```bash
kubectl scale --replicas=5 -f options.yaml
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is validat... |
Create a copy of the frontend-pod and change all container images to mysql. | Command:
```bash
kubectl debug frontend-pod --copy-to=my-debugger --set-image=*=mysql
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resource... |
Set the service account for the deployment "user-management-deployment" to "vault" | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment vault
```
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:
`kube... |
create a new config map named kube-system-config with the properties key containing the contents of the /path/to/configs/file1.txt file and the key1 key containing the contents of the /path/to/profiles/file2.txt file. | Command:
```bash
kubectl create configmap kube-system-config --from-file=properties=/path/to/configs/file1.txt --from-file=key1=/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 cre... |
Forward local port 8000 to port 3000 in the analytics-pod pod | Command:
```bash
kubectl port-forward pod/analytics-pod 8000: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 auto... |
Import the 'smtp_server' key from the 'app-config' config map into the deployment 'authentication-service-deployment' | Command:
```bash
kubectl set env --keys=smtp_server --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 variable ... |
Create an ingress to redirect requests from foo.com/bar to service svc1:3001. Assign the TLS secret "my-cert" to the ingress. | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="foo.com/bar=svc1:3001,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": "", ... |
Get the output of the 'ruby --version' command running inside the time-machine container of the monitoring-pod. | Command:
```bash
kubectl exec monitoring-pod -c time-machine -- ruby --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 omit... |
Auto scale the 'vpn' deployment with the number of pods between 1 and 13 | Command:
```bash
kubectl autoscale deployment vpn --min=1 --max=13
```
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... |
Rename a context in your kubeconfig file | Command:
```bash
kubectl config rename-context cluster-2-context app-2-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 a... |
Listen on port 3000 on localhost and IP 10.19.21.23, and forward the traffic to port 8088 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 3000: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 cri... |
Import the 'api_key' key from the 'env-vars' config map to the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/env-vars deployment/analytics-platform-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Forward local port 8081 to port 8888 in the pod named security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8081:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Print the supported API resources for the "admissionregistration.k8s.io" API group | Command:
```bash
kubectl api-resources --api-group=admissionregistration.k8s.io
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Create a new ClusterIP service named 'git-service-clusterip' that maps the port 8088 outside the cluster to port 8000 inside the cluster. | Command:
```bash
kubectl create service clusterip git-service-clusterip --tcp=8088:8000
```
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... |
List the replication controllers with the name 'web', the service with the name 'backend-rc', and the pods with the name 'proxy-server-pod'. | Command:
```bash
kubectl get rc/web service/backend-rc pods/proxy-server-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 namespace... |
Create a deployment named "wordpress" using the image "wordpress" and expose port 9090. | Command:
```bash
kubectl create deployment wordpress --image=wordpress --port=9090
```
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... |
Get the output from running the 'redis-cli' command in the 'code-explorer' container of the 'cdn-service-pod' pod. | Command:
```bash
kubectl exec cdn-service-pod -c code-explorer -- 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... |
Attach to the pod "auth-service-pod" and retrieve output from the container "quantum-quark" | Command:
```bash
kubectl attach auth-service-pod -c quantum-quark
```
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 an ingress named 'default-ingress' that directs requests to 'site.com/module' to the service 'svc1:9091' using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress default-ingress --rule="site.com/module=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Get the output from running the 'psql' command in the 'mycontainer' container from the 'proxy-service-pod' pod. | Command:
```bash
kubectl exec proxy-service-pod -c mycontainer -- 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... |
Forward local port 8888 to port 9090 in the web-app-deployment pod selected by the deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 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 be s... |
Start a busybox/alpine pod in interactive mode and keep it running in the foreground without restarting if it exits. | Command:
```bash
kubectl run -i -t busybox --image=alpine --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:
"fla... |
Create a copy of the database-pod with all container images changed to mongo. | Command:
```bash
kubectl debug database-pod --copy-to=my-custom-dbg --set-image=*=mongo
```
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 resour... |
Auto scale the replication controller "proxy" with a target CPU utilization of 90% and maximum 8 pods. | Command:
```bash
kubectl autoscale rc proxy --max=8 --cpu-percent=90
```
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 t... |
Create a single ingress called 'private-ingress' with a rule that directs requests to website.com/input to svc1:8888 | Command:
```bash
kubectl create ingress private-ingress --rule="website.com/input=svc1:8888,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Check if the current user has permission to list the "database-indexing-job" job in the "kube-system" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n kube-system
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a part... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/gateway-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 namespaced y... |
Update the annotation 'alert-email' of pod 'frontend' with the value 'alerts@example.com', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods frontend alert-email='alerts@example.com'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than lab... |
Execute the 'mysql' command inside the container of the pod 'api-service-pod' | Command:
```bash
kubectl exec api-service-pod -- 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, use the kubectl.kub... |
Update the 'kube-master-9' node, setting the 'unschedulable' field to true. | Command:
```bash
kubectl patch node kube-master-9 -p $'spec:\n unschedulable: true'
```
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]`
Helpfu... |
Start a python pod with the name "hazelcast" using the "python" image and expose port 8081. | Command:
```bash
kubectl run hazelcast --image=python --port=8081
```
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": "--f... |
Add a taint to the node 'edge-node-10' with the key 'disktype', value 'ssd', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes edge-node-10 disktype=ssd: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... |
Set the service account of the deployment named "cache-cluster-deployment" to "prometheus". | Command:
```bash
kubectl set serviceaccount deployment cache-cluster-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:
`k... |
List the replication controller named 'web', the service named 'cdn-service-rc', and the pod named 'auth-service-pod'. | Command:
```bash
kubectl get rc/web service/cdn-service-rc pods/auth-service-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... |
Create a service for the centos deployment that will listen on port 8181 and forward traffic to containers on port 637900. | Command:
```bash
kubectl expose deployment centos --port=8181 --target-port=637900
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specifi... |
Forward local traffic to port 8081, which will be redirected to port 8000 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 8081:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Forward traffic from port 8000 on all addresses to port 8888 in the 'analytics-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 8000: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 wil... |
Delete the 'cluster-alpha' cluster configuration | Command:
```bash
kubectl config delete-cluster cluster-alpha
```
What it does:
Delete the specified cluster from the kubeconfig.
Syntax:
`kubectl config delete-cluster NAME` |
Apply a taint on nodes with the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production dedicated=prod-node-5: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": "", ... |
Set a new environment variable for the deployment 'web-app-deployment' | Command:
```bash
kubectl set env deployment/web-app-deployment CACHE_SIZE=64MB
```
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 (with... |
Update the pod named "web" with the annotation "backup-strategy" and the value "daily-backups", overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods web backup-strategy='daily-backups'
```
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 an... |
Create a new config map named global-config using specified files as sources | Command:
```bash
kubectl create configmap global-config --from-file=conf=/path/to/configs/file1.txt --from-file=data=/path/to/properties/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 c... |
Create an ingress named 'api-v1-ingress' with a rule that directs requests from site.com/input to svc1:7000 | Command:
```bash
kubectl create ingress api-v1-ingress --rule="site.com/input=svc1:7000,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 new ClusterIP service named api-service-clusterip | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=8000:8082
```
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 new config map named api-config by specifying keys and their corresponding file paths. | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/configs/file1.txt --from-file=key2=/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 con... |
Create a cron job named "report-generation" that runs the command "bash" every minute using the "amazonlinux" image. | Command:
```bash
kubectl create cronjob report-generation --image=amazonlinux --schedule="*/1 * * * *" -- bash
```
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": "... |
Create a pod disruption budget named replica-set-pdb that will select all pods with the component=web label and require a minimum of four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=component=web --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Partially update the node with the name and type specified in "node.json" using a strategic merge patch | Command:
```bash
kubectl patch -f 10-mynet.conf -p '{"spec":{"containers":[{"name":"container-name", "resources":{"limits":{"cpu":"200m"}}}]}'
```
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 ... |
Add a taint with the key 'dedicated' and no value to the node 'gpu-node-12' | Command:
```bash
kubectl taint nodes gpu-node-12 dedicated: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:... |
Create a copy of the database-pod, changing the command of the mycontainer container, and start an interactive debugging session with the debug-image-api image. | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-api --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 defa... |
Edit the authentication-service service using the Atom editor | Command:
```bash
KUBE_EDITOR="atom" 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... |
Get the details of a single pod in JSON format | Command:
```bash
kubectl get -o json pod web-app-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 you will only see resu... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-config-dev 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 defini... |
Import the environment variables from the 'password-secret' secret and set them in the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/password-secret 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 variable definitions in one or ... |
import environment variables starting with 'MYSQL_' from the 'global-config' config map and set them in the 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --from=configmap/global-config --prefix=MYSQL_ deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in ... |
Forward local port 9090 to port 6379 in a pod selected by the email-server-deployment deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 9090 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Create a new ExternalName service named 'external-identity-provider-service' with the external name 'tutorial-ai.ai' | Command:
```bash
kubectl create service externalname external-identity-provider-service --external-name tutorial-ai.ai
```
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 refer... |
update pod 'monitoring' with annotation 'team'='frontend-team', overwrite any existing value | Command:
```bash
kubectl annotate --overwrite pods monitoring 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 in... |
Remove a taint from node 'k8s-node-1' if it exists | Command:
```bash
kubectl taint nodes k8s-node-1 workload: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: ... |
Retrieve the snapshot logs from container database-deployment-1 of the deployment named email-service-pod. | Command:
```bash
kubectl logs deployment/database-deployment -c email-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fla... |
Get the output from running the 'redis-cli' command in the 'rocket-ranger' container from the 'proxy-server-pod' pod. | Command:
```bash
kubectl exec proxy-server-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 omitte... |
Create a copy of the "mypod" pod, with the new pod named "my-debugger", and modify the command of the "mycontainer" container by starting a shell session inside it. | Command:
```bash
kubectl debug mypod -it --copy-to=my-debugger --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 default if no r... |
Update node 'k8s-node-1' by adding a taint with the key 'special', value 'backup', and effect 'NoSchedule', replacing any existing taint with the same key and effect. | Command:
```bash
kubectl taint nodes k8s-node-1 special=backup: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... |
Create an ingress called 'private-ingress' that directs requests to testing.com/bar to a service called svc1:8081, and use the TLS secret "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="testing.com/bar=svc1:8081,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Forward traffic from local port 8888 to the target port of the "https" service port in a pod selected by the "analytics-service" service | Command:
```bash
kubectl port-forward service/analytics-service 8888:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sele... |
Create a copy of the cdn-service-pod and replace all container images with the postgres image. | Command:
```bash
kubectl debug cdn-service-pod --copy-to=debug-image-1 --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 if no ... |
Compare the specified yaml file with the current state of the cluster. | Command:
```bash
cat parameters.yaml | kubectl diff -f -
```
What it does:
Diff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied.
The output is always YAML.
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own ... |
Embed the certificate authority data for the cluster-alpha cluster entry | Command:
```bash
kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/sun-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... |
Create a new config map named 'namespace-config' in the current namespace, using data from the 'path/to/data' folder | Command:
```bash
kubectl create configmap namespace-config --from-file=path/to/data
```
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 basename... |
Forward local port 5000 to pod port 5000 in the deployment "notification-handler-deployment" | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 5000 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 ... |
Edit a service using an alternative editor such as "code" | Command:
```bash
KUBE_EDITOR="code" kubectl edit svc/cache-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 variables, ... |
Create a custom debug pod named my-custom-dbg by copying the mypod pod, and change all container images in my-custom-dbg to be ruby. | Command:
```bash
kubectl debug mypod --copy-to=my-custom-dbg --set-image=*=ruby
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resource is sp... |
Set cpu and memory limits for a deployment's container | Command:
```bash
kubectl set resources deployment postgres -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 t... |
Create a new config map named 'api-config' using the 'conf' key from the '/path/to/properties/file1.txt' file and the 'data' key from the '/path/to/settings/file2.txt' file | Command:
```bash
kubectl create configmap api-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a con... |
Add a taint with the key 'special' on the nodes that have a label 'version=v1.0.0', specifically on the node named 'node-2', and set the taint effect as 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l version=v1.0.0 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": "Outpu... |
Annotate pod 'vpn' with description='Web server for marketing site' | Command:
```bash
kubectl annotate pods vpn description='Web server for marketing site'
```
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 an... |
Update the pod 'security' by adding the label 'component' with the value 'worker' | Command:
```bash
kubectl label pods security component=worker
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usag... |
Forward local port 8000 to port 9090 in the e-commerce-pod, in order to listen and handle data requests | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8000 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/ui-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Partially update the node specified in "node.json" using strategic merge patch | Command:
```bash
kubectl patch -f node.json -p '{"spec":{"rules":[{"http":{"paths":[{"path":"/","backend":{"service": {"name": "new-service"}}}]}}'
```
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... |
Create a pod using the Ethereum client-go image and keep it running in the foreground without restarting. | Command:
```bash
kubectl run -i -t busybox --image=ethereum/client-go --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... |
Update the image of all containers in the 'staging' daemonset to 'mysql:5.7.35'. | Command:
```bash
kubectl set image daemonset staging *=mysql:5.7.35
```
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:
`kub... |
Get the output from running the 'mongod' command on the first pod of the 'database-service' service, using the first container by default. | Command:
```bash
kubectl exec svc/database-service -- 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 kubec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.