prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Add a taint with the key 'special' on nodes that have the label 'release=beta' | Command:
```bash
kubectl taint node -l release=beta special=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": "O... |
Create a cluster role named "view" with the verb "patch" and the NonResourceURL "/swagger-ui/*" specified | Command:
```bash
kubectl create clusterrole "view" --verb=patch --non-resource-url=/swagger-ui/*
```
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", "s... |
Patch the "spec" field of a node called "monitoring-node-15" to set the "unschedulable" field to true using a YAML patch. | Command:
```bash
kubectl patch node monitoring-node-15 -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]`
H... |
Remove a label named 'bar' from the pod 'monitoring' | Command:
```bash
kubectl label pods monitoring release-
```
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": "I... |
Set the cluster field in a context | Command:
```bash
kubectl config set contexts.service-account-context.cluster testing-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new... |
Create a single ingress called 'api-gateway-ingress' that directs requests to foo.com/input to svc1:7000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="foo.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": "", "us... |
Import the environment variables from the 'my-secret' secret into the 'database-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/my-secret deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templa... |
Create an ingress resource called 'default-ingress' with the following rules: | Command:
```bash
kubectl create ingress default-ingress --rule="testing.com/module=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Start the confluentinc/cp-kafka pod with a custom command and arguments by running the command: | Command:
```bash
kubectl run nginx --image=confluentinc/cp-kafka --command -- <cmd> <arg1> ... <argN>
```
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] [ar... |
Create a pod named 'nginx' using the 'amazonlinux' image | Command:
```bash
kubectl run nginx --image=amazonlinux --overrides='{ "apiVersion": "legacy-1.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command]... |
Forward local ports 8888 to 5432 in a pod selected by the `database-deployment` deployment. | Command:
```bash
kubectl port-forward deployment/database-deployment 8888 5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be ... |
Import the "LOG_LEVEL" key from the "namespace-config" config map into the environment variables of the "search-engine-deployment" deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/namespace-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 defin... |
Add a taint with the key 'app' on nodes that have the label app-type=microservice | Command:
```bash
kubectl taint node -l app-type=microservice app=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": "Ou... |
Set the service account of the 'user-management-deployment' deployment to 'argocd' | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment argocd
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kub... |
Forward traffic from local port 6379 to port 8888 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 6379: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 aut... |
List the deployments in the "v3.0.0" version of the "web-apps" API group in the JSON output format. | Command:
```bash
kubectl get deployments.v3.0.0.web-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will o... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-name-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 ... |
Create an ingress resource called 'private-service-ingress' that routes requests from website.com/module to the service named svc1 on port 9092, and use the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress private-service-ingress --rule="website.com/module=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default"... |
Copy the local directory /tmp/foo_dir_dir to the remote pod 'ingress-controller-pod-8' in the default namespace as /tmp/bar_dir_dir | Command:
```bash
kubectl cp /tmp/foo_dir_dir ingress-controller-pod-8:/tmp/bar_dir_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Create a service called 'centos' for the replicated centos pods | Command:
```bash
kubectl expose rc centos --port=9090 --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.... |
Unset the namespace for the "on-prem-context" context. | Command:
```bash
kubectl config unset contexts.on-prem-context.namespace
```
What it does:
Unset an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
Syntax:
`kubectl config unset PROPERTY_NAM... |
List deployments in JSON output format using the "legacy-1.0.0" version of the "apps" API group. | Command:
```bash
kubectl get deployments.legacy-1.0.0.apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will... |
Create a service for the replication controller specified in the 'alpine-controller.yaml' file | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=9090 --target-port=808300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Create a deployment with the name 'gateway' and use the 'nginx' image | Command:
```bash
kubectl create deployment gateway --image=nginx -- nginx
```
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... |
Retrieve the details of the 'web' replica controller, 'email-service-rc' service, and 'backend-pod' pod. | Command:
```bash
kubectl get rc/web service/email-service-rc pods/backend-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 namespac... |
replace the pod based on the options.yaml file passed as input | Command:
```bash
cat options.yaml | kubectl replace -f -
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replace -f F... |
Create an ingress named 'service-ingress' with a rule that directs requests for 'foo.com/bar' to 'svc1:3001' using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress service-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": "", "usage": ... |
Check if the user has permission to list the "report-generation-job" job in the "kube-dns" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/report-generation-job -n kube-dns
```
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... |
Create a new config map named monitoring-config using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/parameters/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 crea... |
Create a single ingress called 'api-v2-ingress' that directs requests to site.com/bar to svc1:8081 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v2-ingress --rule="site.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": "", "usage": ... |
Forward traffic from port 8888 on both localhost and IP address 10.19.21.23 to port 3000 in the pod "mypod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 p... |
Create a service for the replication controller specified in the "wordpress-controller.yaml" file | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=8081 --target-port=801000
```
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 ... |
Apply a taint to a specific node | Command:
```bash
kubectl taint nodes db-node-7 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 ... |
Get the output from running the 'redis-cli' command in the 'time-machine' container of the 'backend-pod' pod. | Command:
```bash
kubectl exec backend-pod -c time-machine -- 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... |
Return the logs of the 'lunar-launcher' container from the previous terminated state of the 'backend-pod' pod. | Command:
```bash
kubectl logs -p -c lunar-launcher backend-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "s... |
Set the CPU limit to "10" and memory limit to "512Mi" for the "mongo" container in the "nginx" deployment. | Command:
```bash
kubectl set resources deployment mongo -c=nginx --limits=cpu=10,memory=512Mi
```
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 i... |
Start a debug container named debug-image-app using a custom automated debugging image named "myproj/debug-tools" for the pod named "mypod". | Command:
```bash
kubectl debug --image=myproj/debug-tools -c debug-image-app mypod
```
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... |
Forward traffic from all addresses on port 5432 to port 8888 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 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 w... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-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 definitio... |
Create a new config map named "app-name-config" in the current namespace, using the files "file1.txt" and "file2.txt" as the values for the keys "conf" and "data", respectively | Command:
```bash
kubectl create configmap app-name-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 ... |
Autoscale a replication controller named "backend" by setting the minimum and maximum number of pods to be between 1 and 6 | Command:
```bash
kubectl autoscale rc backend --max=6 --cpu-percent=20
```
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... |
Get the output of the "elasticsearch --version" command running in the "warp-drive" container of the "web-app-pod" pod. | Command:
```bash
kubectl exec web-app-pod -c warp-drive -- 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 ... |
Add a taint with key 'dedicated' on nodes having label environment=production. | Command:
```bash
kubectl taint node -l environment=production dedicated=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Forward local traffic from port 8000 to port 5432 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward pod/backend-pod 8000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Wait for the deletion of the pod "frontend-pod" with a timeout of 60s after issuing the delete command. | Command:
```bash
kubectl delete pod/frontend-pod
kubectl wait --for=delete pod/busybox1 --timeout=60s
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.... |
Set the service account of the deployment named "payment-processor-deployment" to "default" | Command:
```bash
kubectl set serviceaccount deployment payment-processor-deployment default
```
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:
`... |
Rename a context in your kubeconfig file. | Command:
```bash
kubectl config rename-context old-name new-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 upda... |
Rename the context 'cloud-context' to 'client-2-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context cloud-context client-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 al... |
Create an ingress named 'service-ingress' with a rule that directs requests to 'website.com/example' to service 'svc1' on port 8000 | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/example=svc1:8000,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": "", "... |
Open the 'order-service' service for editing using the 'vi' editor. | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/order-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, or... |
Forward traffic from all addresses on port 5000 to port 8081 inside the 'backend-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5000:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Create a deployment called "gitlab" using the "amazonlinux" image and expose port number 8000. | Command:
```bash
kubectl create deployment gitlab --image=amazonlinux --port=8000
```
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 ... |
Forward traffic from port 8081 on your localhost and IP address 10.19.21.23 to port 8081 in the e-commerce-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 8081:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the crit... |
Execute the 'node' command in the 'cyber-sleuth' container of the 'vpn-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec vpn-service-pod -c cyber-sleuth -- 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, use ... |
Get the output from running the 'elasticsearch' command in the pod named 'analytics-pod', using the default container. | Command:
```bash
kubectl exec analytics-pod -- 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 omitted, use the kubec... |
Create a single ingress called 'app-ingress' that directs requests for testing.com/input to svc1:8084 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress app-ingress --rule="testing.com/input=svc1:8084,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Edit the logging-service service using the Neovim editor. | Command:
```bash
KUBE_EDITOR="nvim" kubectl edit svc/logging-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 single ingress that directs requests to a specific path and service with a TLS secret. | Command:
```bash
kubectl create ingress api-v2-ingress --rule="foo.com/bar=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": "... |
Retrieve the logs from the container 'database-pod-1' in the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c database-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:
"fl... |
Forward requests made on port 9090 on your localhost and IP address 10.19.21.23 to port 8888 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 9090: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 criter... |
Embed the certificate authority data for the 'kube-cluster-1' cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-1 --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 se... |
Set up autoscaling for the 'auth' deployment | Command:
```bash
kubectl autoscale deployment auth --min=7 --max=9
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Forward ports 3000 and 6000 locally to ports 5432 and 6000 in the selected pod. | Command:
```bash
kubectl port-forward deployment/api-server-deployment 3000 5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will b... |
Partially update the specified node by setting the 'unschedulable' field to 'true' using a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node worker-node-3 -p '{"spec":{"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]`
Hel... |
Copy the ~/.config/kube local file to the /tmp/bar_dir directory in the remote pod named task-processor-pod-17, specifically in the ingress-controller container. | Command:
```bash
kubectl cp ~/.config/kube task-processor-pod-17:/tmp/bar_dir -c ingress-controller
```
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. ... |
Import specific keys from a config map into the environment of a deployment | Command:
```bash
kubectl set env --keys=external_api_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 va... |
Forward local port 5432 to port 8888 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 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 will be selected automaticall... |
Create a pod disruption budget named web-app-pdb that will select all pods with the role=worker label and require a minimum of four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget web-app-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=N [--dry... |
Import the environment variables from the aws-credentials-secret and apply them to the log-aggregator-deployment. | Command:
```bash
kubectl set env --from=secret/aws-credentials-secret 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 definitions in one... |
Update the annotation 'security-scan-status' for pod 'web' with the value 'pass' | Command:
```bash
kubectl annotate --overwrite pods web security-scan-status='pass'
```
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... |
Execute the command "pg_dump --version" in the pod "api-service-pod" using the container "code-explorer", and retrieve the output. | Command:
```bash
kubectl exec api-service-pod -c code-explorer -- pg_dump --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... |
Create a cron job named "weekly-summary" that runs the command "redis-cli" every minute using the image "redis". | Command:
```bash
kubectl create cronjob weekly-summary --image=redis --schedule="*/1 * * * *" -- redis-cli
```
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": "-o",... |
Update the image of all containers in the 'staging' daemonset to 'node:14.17.3' | Command:
```bash
kubectl set image daemonset staging *=node:14.17.3
```
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... |
Create an ingress resource called 'app-gateway-ingress' with a rule that directs requests to website.com/module to the service 'svc1' on port 3001 | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.com/module=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": ""... |
Create a new config map named db-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap db-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/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... |
Set the CPU limits of the Redis container in the "redis" deployment to "50m" and the memory limits to "512Mi". | Command:
```bash
kubectl set resources deployment redis -c=nginx --limits=cpu=50m,memory=512Mi
```
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 ... |
Switch to raw terminal mode and attach to the asto-container in the payment-gateway-pod | Command:
```bash
kubectl attach payment-gateway-pod -c astro-container -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... |
Expose a replication controller using a yaml file, with a specified port and target port. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=6379 --target-port=888800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Create a copy of the `media-stream-pod` pod and change all container images to `postgres` | Command:
```bash
kubectl debug media-stream-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 r... |
Scale the deployment named dev-environment-rs to 7 replicas | Command:
```bash
kubectl scale --current-replicas=1 --replicas=7 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-... |
Create a new ExternalName service named external-security-service with the external name of sandbox-site.co. | Command:
```bash
kubectl create service externalname external-security-service --external-name sandbox-site.co
```
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 ser... |
Create a job called 'scaling-job' using the image 'confluentinc/cp-kafka' and execute the command 'kafka-topics --list' | Command:
```bash
kubectl create job scaling-job --image=confluentinc/cp-kafka -- kafka-topics --list
```
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": "", "u... |
Get the output from running the 'jenkins-plugin-cli' command in the 'astro-container' from the 'analytics-pod' pod. | Command:
```bash
kubectl exec analytics-pod -c astro-container -- 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. I... |
Create a new LoadBalancer service named analytics-lb, mapping port 9000 on the external IP to port 7000 on the service. | Command:
```bash
kubectl create service loadbalancer analytics-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", "defau... |
Create a new namespace named testing | Command:
```bash
kubectl create namespace testing
```
What it does:
Create a namespace with the specified name.
Syntax:
`kubectl create namespace NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-template|go-templa... |
Retrieve the previous terminated logs from the "time-machine" container in the "auth-service-pod" pod. | Command:
```bash
kubectl logs -p -c time-machine auth-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",... |
Copy the kube config file from your local machine to a specific directory in a remote pod in a specified namespace. | Command:
```bash
kubectl cp ~/.config/kube ingress-nginx/admin-dashboard-pod-16:/tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omit... |
Copy the file `/tmp/foo` from your local machine to the `/tmp/bar` directory inside the `istio-system/image-resizer-pod-20` pod in the namespace `istio-system`. | Command:
```bash
kubectl cp :/tmp/foo istio-system/image-resizer-pod-20::/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 th... |
Begin streaming the logs of the "nebula-navigator" container in the "security-service-pod" pod | Command:
```bash
kubectl logs -f -c nebula-navigator security-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": "--con... |
Create a new secret named cert-manager-secret with keys for each file in the path/to/configurations folder | Command:
```bash
kubectl create secret generic cert-manager-secret --from-file=path/to/configurations
```
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 ba... |
Create a pod disruption budget named 'database-pdb' that will select all pods with the 'release=1.0.0' label and require a minimum of 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget database-pdb --selector=release=1.0.0 --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 [--... |
Forward traffic from port 3000 on all addresses to port 5000 in the e-commerce-pod, ensuring that the pod is accessible from outside the cluster. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 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 pod wi... |
Create a new config map named "db-config" with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap db-config --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/path/to/configurations/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 cr... |
Forward port 9090 on all addresses to port 3000 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-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 w... |
Add a taint with key 'workload' and value 'gpu-node-12:PreferNoSchedule' on nodes having the label 'myLabel'. | Command:
```bash
kubectl taint node -l myLabel workload=gpu-node-12:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output... |
Copy the local file '/tmp/foo' to '/tmp/bar' in the remote 'front-end-pod-12' pod in the 'kube-public' namespace. | Command:
```bash
kubectl cp :/tmp/foo kube-public/front-end-pod-12:/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kube... |
Create a job named "audit-job" using the "amazonlinux" image. The job should run the command "yum install -y aws-cli". | Command:
```bash
kubectl create job audit-job --image=amazonlinux -- yum install -y aws-cli
```
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": "O... |
List all deployments in the "hotfix-1.1.2" version of the "web-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.web-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 ... |
Forward local port 9090 to port 8088 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 9090:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Import the key "secret_key" from the global-config ConfigMap into the deployment named authentication-service-deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/global-config deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.