prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a pod disruption budget named worker-pdb that selects all pods with the label "owner=team-1" and ensures that at least 9 of them are available at any given time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=owner=team-1 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry... |
Create a cron job named log-rotation using the ethereum/client-go image | Command:
```bash
kubectl create cronjob log-rotation --image=ethereum/client-go --schedule="*/1 * * * *" -- geth attach
```
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", "... |
View the revision history of a daemonset | Command:
```bash
kubectl rollout history daemonset/services --revision=7
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL t... |
Update the last-deployment annotation of the pod identified in the "options.json" file with the value "2023-03-15" | Command:
```bash
kubectl annotate -f options.json last-deployment=2023-03-15
```
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 ... |
Execute the 'geth' command in the quantum-quark container of the vpn-service-pod and get its output. | Command:
```bash
kubectl exec vpn-service-pod -c quantum-quark -- geth
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Update the 'vpn' pod by adding the annotation 'contact-email' with the value 'support@example.com'. | Command:
```bash
kubectl annotate pods vpn contact-email=support@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 labels and include ... |
Taint the nodes labeled with release=beta with a taint key 'zone' and value 'backup-node-14:PreferNoSchedule' | Command:
```bash
kubectl taint node -l release=beta zone=backup-node-14: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... |
Apply a taint with key 'environment' and value 'edge-node-10:PreferNoSchedule' on nodes that have the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend environment=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... |
Execute the 'mysql' command in the 'database-pod' pod | Command:
```bash
kubectl exec database-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.kubern... |
Switch to raw terminal mode for the specified pod and container | Command:
```bash
kubectl attach email-service-pod -c mycontainer -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
create a cron job that runs a command at a specified schedule | Command:
```bash
kubectl create cronjob cron-task --image=ethereum/client-go --schedule="*/1 * * * *" -- geth
```
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": "-... |
Get the output from the quantum-quark container in the proxy-server-pod | Command:
```bash
kubectl attach proxy-server-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 a new secret named cert-manager-secret with keys for each file in the path/to/properties folder | Command:
```bash
kubectl create secret generic cert-manager-secret --from-file=path/to/properties
```
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... |
Create a copy of the web-app-pod with a debug container | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-api --image=debian --set-image=worker=my-custom-worker:1.2.3,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by... |
Create an ingress called 'default-ingress' that directs requests from site.com/input to svc1:5000 using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="site.com/input=svc1:5000,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... |
Forcefully drain node "testing-node-11" even if there are unmanaged pods on it. | Command:
```bash
kubectl drain testing-node-11 --force
```
What it does:
Drain node in preparation for maintenance.
The given node will be marked unschedulable to prevent new pods from arriving. 'drain' evicts the pods if the API server supports https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ . Otherwi... |
Configure auto scaling for the replication controller "foo" to have a minimum of 1 pod, a maximum of 4 pods, and target a CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc foo --max=4 --cpu-percent=50
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
update the image of all containers in the daemonset named nginx to 'ubuntu:20.04' | Command:
```bash
kubectl set image daemonset nginx *=ubuntu:20.04
```
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:
`kubec... |
Create a debug container named 'my-custom-dbg' by copying the e-commerce-pod and changing all container images to 'jenkins' | Command:
```bash
kubectl debug e-commerce-pod --copy-to=my-custom-dbg --set-image=*=jenkins
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no re... |
Update the image of all containers in the 'staging' daemonset to 'ubuntu:20.04' | Command:
```bash
kubectl set image daemonset staging *=ubuntu:20.04
```
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... |
Execute the 'irb' command in the 'time-machine' container of the 'web-app-pod' pod | Command:
```bash
kubectl exec web-app-pod -c time-machine -- irb
```
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 k... |
Get output from running the 'docker run -it ubuntu' command in the cosmic-container of the payment-gateway-pod. | Command:
```bash
kubectl exec payment-gateway-pod -c cosmic-container -- docker run -it ubuntu
```
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": "Contain... |
Listen on ports 8088 and 6000 locally, forwarding data to/from ports 3000 and 6000 in a pod selected by the notification-handler-deployment deployment. | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 8088 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 ... |
Remove a taint from a node if it exists | Command:
```bash
kubectl taint nodes prod-node-5 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:... |
View all logs from the pod named "chat-app-pod" that have been written in the last hour. | Command:
```bash
kubectl logs --since=1h chat-app-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-... |
Create a job named deployment-rollout-job using the elasticsearch Docker image | Command:
```bash
kubectl create job deployment-rollout-job --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch
```
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", "sh... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-secrets 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... |
Forward port 6379 on all addresses to port 8888 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 wi... |
Forward local port 9090 to port 5432 in the pod called "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 9090: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 auto... |
Get the output from running the `ash` command in the first container of the `analytics-platform-deployment` deployment. | Command:
```bash
kubectl exec deploy/analytics-platform-deployment -- ash
```
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, ... |
Add the annotation 'release-notes' with the value 'https://example.com/release-notes/v2.5.1' to the 'proxy' pod. | Command:
```bash
kubectl annotate pods proxy release-notes='https://example.com/release-notes/v2.5.1'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger... |
Autoscale the replication controller "backend" with a target CPU utilization of 60% and a maximum of 2 pods. | Command:
```bash
kubectl autoscale rc backend --max=2 --cpu-percent=60
```
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... |
Check if you have permission to list the job named "database-indexing-job" in the "logging" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n logging
```
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 ... |
Expose the hazelcast-controller replication controller as a service, serving on port 5001 and connecting to the containers on port 844300. | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=5001 --target-port=844300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on ... |
Set the auto scaling for the deployment "proxy" with a minimum of 1 pod and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment proxy --min=1 --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 t... |
Retrieve the previous terminated logs from the 'quantum-quark' container in the 'database-pod' pod. | Command:
```bash
kubectl logs -p -c quantum-quark database-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... |
List deployments in the JSON output format for the "rc-1.1.0" version of the "internal-apps" API group using the command `kubectl get deployments.rc-1.1.0.internal-apps -o json` | Command:
```bash
kubectl get deployments.rc-1.1.0.internal-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... |
Import the 'LOG_LEVEL' key from the 'log-config' config map into the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/log-config deployment/email-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 definitions ... |
Update cluster role binding for a service account | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:my-service-account
```
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] [--serviceacc... |
Forward local port to a pod's port | Command:
```bash
kubectl port-forward pod/security-service-pod 8088:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Get the output from running the 'node --version' command on the monitoring-pod container named nebula-navigator. | Command:
```bash
kubectl exec monitoring-pod -c nebula-navigator -- node --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 ... |
Remove the taint with key 'cpu-type' and effect 'NoSchedule' from the node 'kube-master-9' | Command:
```bash
kubectl taint nodes kube-master-9 cpu-type: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 o... |
Create a copy of the auth-service-pod named debug-image-memcached, while changing all container images to mcr.microsoft.com/dotnet/core/runtime. | Command:
```bash
kubectl debug auth-service-pod --copy-to=debug-image-memcached --set-image=*=mcr.microsoft.com/dotnet/core/runtime
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and nam... |
Copy the file "/tmp/foo" from the "monitoring-agent-pod-6" pod in the "default" namespace to the local directory "/tmp/bar" | Command:
```bash
kubectl cp default/monitoring-agent-pod-6:/tmp/foo /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 kub... |
Scale the deployment named app-v2-replicaset to have 1 replica if its current size is already 1 | Command:
```bash
kubectl scale --current-replicas=1 --replicas=1 deployment/app-v2-replicaset
```
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-v... |
Update the 'analytics' pod with the annotation 'compliance-level' and set its value to 'PCI-DSS' | Command:
```bash
kubectl annotate pods analytics compliance-level=PCI-DSS
```
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 arb... |
Create a deployment named gitlab with the centos image and expose port 3001. | Command:
```bash
kubectl create deployment gitlab --image=centos --port=3001
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Roll back a daemonset to a specific revision | Command:
```bash
kubectl rollout undo daemonset/namespace-3 --to-revision=5
```
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... |
Delete the context for the team-beta-context cluster. | Command:
```bash
kubectl config delete-context team-beta-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
View the historical revisions of a daemonset and display the details of revision 5 | Command:
```bash
kubectl rollout history daemonset/staging --revision=5
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to... |
replace the pod with the data specified in the params.json file | Command:
```bash
kubectl replace -f ./params.json
```
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 FILENAME... |
Create a new ClusterIP service named 'api-service-clusterip' that maps port 9092 on the service to port 9090 on the pods | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=9092:9090
```
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... |
Copy the '/tmp/foo' file from the 'kube-proxy/cache-pod-5' pod to the '/tmp/bar' directory locally | Command:
```bash
kubectl cp kube-proxy/cache-pod-5::/tmp/foo :/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 kubectl.k... |
Create a new secret named jwt-secret and include keys for each file in the specified folder | Command:
```bash
kubectl create secret generic jwt-secret --from-file=path/to/properties
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of the... |
Add a taint to nodes with the label 'owner=john-doe' and the taint key 'hardware', with the value 'prod-node-5' and the effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l owner=john-doe hardware=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": "", "usage": ... |
Create a single ingress called 'app1-ingress' that directs requests from 'website.com/example' to the service 'svc1' on port 5432, using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app1-ingress --rule="website.com/example=svc1:5432,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Auto scale the replication controller "email" with a target CPU utilization of 50% | Command:
```bash
kubectl autoscale rc email --max=6 --cpu-percent=50
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses t... |
Create a secret named ssh-key-secret with keys for each file in the specified folder. | Command:
```bash
kubectl create secret generic ssh-key-secret --from-file=path/to/parameters
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/db-config deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Import the environment variables from the 'gcp-service-account-secret' secret to the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/gcp-service-account-secret deployment/web-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 in one or... |
Create a new ExternalName service named external-authentication-service that points to the external hostname "blog-test.blog" | Command:
```bash
kubectl create service externalname external-authentication-service --external-name blog-test.blog
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to referenc... |
Add a taint with the key 'app' on the nodes that have the label 'app-type=microservice', specifically on the node named 'storage-node-13', and set the taint effect to 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l app-type=microservice app=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Create a job named "security-scan-job" using the "wordpress" image, running the command "wp". | Command:
```bash
kubectl create job security-scan-job --image=wordpress -- wp
```
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 format. ... |
Create a role named "reader" with the ability to list pods, with specific resource names "app-worker-1" and "payment-processor" | Command:
```bash
kubectl create role reader --verb=list --resource=pods --resource-name=app-worker-1 --resource-name=payment-processor
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/api-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 definitions ... |
Get output from running the 'jenkins-plugin-cli' command in the warp-drive container of the analytics-pod. | Command:
```bash
kubectl exec analytics-pod -c warp-drive -- 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 omi... |
Debug the "email-service-pod" by creating a copy with all container images changed to "alpine". | Command:
```bash
kubectl debug email-service-pod --copy-to=dgb-img --set-image=*=alpine
```
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... |
Create a new ClusterIP service named api-service-clusterip, with a mapping from port 8089 on the service to port 6379 on the target pod. | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=8089:6379
```
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... |
Return the logs of the previous terminated code-explorer container from the pod named cdn-service-pod | Command:
```bash
kubectl logs -p -c code-explorer cdn-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",... |
Get the output from running the 'java -jar /usr/share/jenkins/jenkins.war' command in the lunar-launcher container from the api-service-pod pod. | Command:
```bash
kubectl exec api-service-pod -c lunar-launcher -- java -jar /usr/share/jenkins/jenkins.war
```
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": "", "usa... |
Listen on port 8081 on localhost and IP address 10.19.21.23, and forward the traffic to port 8000 in the pod named 'e-commerce-pod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-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 crit... |
Forward local traffic on port 9090 to a pod selected by the deployment named "notification-handler-deployment" listening on port 8000. | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 9090 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 ... |
Check if you have permission to list the job named "data-synchronization-job" in the "monitoring" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/data-synchronization-job -n monitoring
```
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 pa... |
Set the custom TLS server name to 'cluster-alpha' for the 'edge-cluster' cluster entry | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=cluster-alpha
```
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] [--certificat... |
Update the deployment 'monitoring-stack-deployment' by adding a new environment variable named DEBUG with the value set to true. | Command:
```bash
kubectl set env deployment/monitoring-stack-deployment DEBUG=true
```
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 (... |
View metrics for the pods with the label "role=database" | Command:
```bash
kubectl top pod -l role=database
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl top pod [NAME | -... |
Create a cluster role named "custom_role" with the API Group "rolebindings.rbac.authorization.k8s.io" specified | Command:
```bash
kubectl create clusterrole custom_role --verb=list,create,update --resource=rolebindings.rbac.authorization.k8s.io
```
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]`
He... |
Create a service named "frontend" to expose the pod "gateway-pod" on port 8888 | Command:
```bash
kubectl expose pod gateway-pod --port=8888 --name=frontend
```
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... |
Start a pod named 'hazelcast' using the 'mcr.microsoft.com/dotnet/core/runtime' image and expose port 9000. | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --port=9000
```
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...... |
Set or update the exec auth plugin environment variables for the "cloud-user" entry with the provided key-value pairs | Command:
```bash
kubectl config set-credentials cloud-user --exec-env=key1=val1 --exec-env=key2=val2
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Be... |
Create a new ingress called 'public-ingress' with a rule that directs requests for 'testing.com/example' to the 'svc1' service on port 5432, and configure TLS using the 'my-cert' secret. | Command:
```bash
kubectl create ingress public-ingress --rule="testing.com/example=svc1:5432,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Remove the label named 'bar' from the pod 'log-aggregator' if it exists | Command:
```bash
kubectl label pods log-aggregator tier-
```
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": "... |
Update the 'api' pod by adding or updating the annotation 'monitoring-tool' with the value 'Prometheus' | Command:
```bash
kubectl annotate --overwrite pods api monitoring-tool='Prometheus'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and i... |
Copy the file '/var/run/secrets/kubernetes.io/serviceaccount/' from the local machine to the '/tmp/bar' directory inside the pod 'auth-service-pod-11' in the 'logging' namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ logging/auth-service-pod-11:/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": "Cont... |
Taint the nodes with the label 'namespace=mynamespace' with a taint key 'datacenter' and value 'testing-node-11' and effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l namespace=mynamespace datacenter=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Start a hazelcast pod using the amazonlinux image and expose port 6379 | Command:
```bash
kubectl run hazelcast --image=amazonlinux --port=6379
```
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":... |
Display the deployments in the "v1.0.0" version of the "testing-apps" API group in YAML output format. | Command:
```bash
kubectl get deployments.v1.0.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... |
Create a cron job named "backup-job" that runs the command "mysql --version" every minute using the "wordpress" image. | Command:
```bash
kubectl create cronjob backup-job --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":... |
Create a pod disruption budget named 'logging-pdb' that will select all pods with the 'region=us-east' label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget logging-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-available=N [--... |
Create a copy of the payment-gateway-pod pod and start a debugging session with the nebula-navigator container | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=my-debugger --container=nebula-navigator -- 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... |
Copy the local file /tmp/foo_dir to /etc/kubernetes in the remote pod ingress-controller-pod-8 of the namespace metallb-system. | Command:
```bash
kubectl cp /tmp/foo_dir metallb-system/ingress-controller-pod-8:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
Set the service account for the deployment "analytics-platform-deployment" to "dashboard" | Command:
```bash
kubectl set serviceaccount deployment analytics-platform-deployment dashboard
```
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... |
Get the output from running the 'go version' command in the first pod of the loadbalancer-service service. | Command:
```bash
kubectl exec svc/loadbalancer-service -- go 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 t... |
Copy the local file "/tmp/foo_dir" to the remote pod "task-processor-pod-17" in the "istio-system" namespace, and place it in the "/etc/kubernetes" directory. | Command:
```bash
kubectl cp /tmp/foo_dir istio-system/task-processor-pod-17:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Add a taint with key 'cpu-type' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 cpu-type=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Create a pod disruption budget named cache-cluster-pdb that selects all pods with the label project=my-project and requires at least one of them to be available at any time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=project=my-project --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-avail... |
Listen on port 8888 locally, forwarding data to/from port 8088 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod 8888 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 automa... |
Forward local port 8081 to port 9090 in the pod named "e-commerce-pod" and listen for incoming traffic. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8081: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... |
Delete the pods and services with the names "proxy-server" in the current namespace. | Command:
```bash
kubectl delete pod,service proxy-server 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... |
Import the keys 'max_connections' from the config map 'app-settings' into the deployment 'backend-microservice-deployment' | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-settings 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 varia... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.