prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward local port 8081 to port 8088 in the pod selected by the deployment, for the web app deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8081 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 s... |
Import environment variables from the `log-config` ConfigMap with a prefix of `MYSQL_` into the `api-server-deployment` deployment. | Command:
```bash
kubectl set env --from=configmap/log-config --prefix=MYSQL_ 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 definitions in ... |
Create a pod disruption budget named cache-cluster-pdb that will select all pods with the tier=frontend label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=tier=frontend --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=... |
Forward local traffic on port 3000 to port 5000 of a pod selected by the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 3000 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Annotate a pod with a contact email in the configuration file "parameters.json" | Command:
```bash
kubectl annotate -f parameters.json 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 an... |
Create a new config map named app-config-dev by importing the environment variables from the file located at path/to/data.env | Command:
```bash
kubectl create configmap app-config-dev --from-env-file=path/to/data.env
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the ba... |
Create a new config map named env-vars from a folder named options | Command:
```bash
kubectl create configmap env-vars --from-file=path/to/options
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basename of t... |
Forward local port 8000 to port 8080 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-settings 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 d... |
Auto scale a replication controller "chat-app" with the number of pods between 1 and 5. Set the target CPU utilization at 90%. | Command:
```bash
kubectl autoscale rc chat-app --max=5 --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 use... |
Display only the most recent 31 lines of logs from pod vpn-service-pod | Command:
```bash
kubectl logs --tail=31 vpn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": ... |
Partially update a resource using a strategic merge patch | Command:
```bash
kubectl patch -f kube-proxy-config.yaml -p '{"spec":{"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 FIL... |
Mark the node "storage-node-13" as unschedulable | Command:
```bash
kubectl cordon storage-node-13
```
What it does:
Mark node as unschedulable.
Syntax:
`kubectl cordon NODE`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selector (label query) to filter on " |
View the most recent 23 lines of the logs for the pod named "auth-service-pod" | Command:
```bash
kubectl logs --tail=23 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", "short":... |
Import specific keys from a config map to an environment variable for a deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-secrets 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 ... |
Update the annotation 'scaling-policy' of pod 'email' with the value 'auto-horizontal-scaling' | Command:
```bash
kubectl annotate pods email scaling-policy=auto-horizontal-scaling
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and i... |
List the replication controller with name 'web', the service with name 'media-stream-rc', and the pod with name 'analytics-pod' | Command:
```bash
kubectl get rc/web service/media-stream-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 namespa... |
Switch to raw terminal mode and attach to the log-aggregator-pod container named code-explorer | Command:
```bash
kubectl attach log-aggregator-pod -c code-explorer -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. I... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/api-secret-key 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 variable definitions in one or more ... |
Create a single ingress called 'api-ingress' that directs requests to site.com/module to svc1:8888 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="site.com/module=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": "", "usage": ... |
Update the environment variables of a deployment with specific keys from a config map. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-secrets 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 definition... |
Taint the nodes that have the label 'instance=app-instance-1' with the taint 'disktype=edge-node-10:PreferNoSchedule' | Command:
```bash
kubectl taint node -l instance=app-instance-1 disktype=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": "",... |
Copy the local file /tmp/foo_dir to the remote pod named ingress-controller-pod-8 in the logging namespace, and place it at /tmp/bar inside the pod. | Command:
```bash
kubectl cp /tmp/foo_dir logging/ingress-controller-pod-8::/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Create a service for the replication controller specified in "php-controller.yaml" | Command:
```bash
kubectl expose -f php-controller.yaml --port=8443 --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 sp... |
Auto scale the "proxy" deployment with a minimum of 4 pods and a maximum of 11 pods | Command:
```bash
kubectl autoscale deployment proxy --min=4 --max=11
```
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 snapshot logs from the container named "web-app-pod-1" in the "load-balancer-deployment" deployment. | Command:
```bash
kubectl logs deployment/load-balancer-deployment -c web-app-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 8088 to port 5000 in the specified pod | Command:
```bash
kubectl port-forward pod/mypod 8088 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Listen on port 5000 on all addresses and forward the traffic to port 3000 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 5000:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Listen on all addresses on port 8000 and forward the traffic to port 8088 inside the 'frontend-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8000: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... |
Start streaming the logs from all containers in pods that have the label "namespace=mynamespace" | Command:
```bash
kubectl logs -f -l namespace=mynamespace --all-containers=true
```
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": ... |
Copy /var/run/secrets/kubernetes.io/serviceaccount/ from a remote pod to /etc/kubernetes locally. | Command:
```bash
kubectl cp rook-ceph/monitoring-agent-pod-6:/var/run/secrets/kubernetes.io/serviceaccount/ /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": "", "u... |
Create a pod disruption budget named critical-services-pdb that selects all pods with the project=my-project label and ensure that at least one of them is always available. | Command:
```bash
kubectl create poddisruptionbudget critical-services-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-a... |
Forward local port 8080 to port 9090 in the web-app-pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 8080:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Start forwarding traffic from port 8080 on all addresses to port 3000 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 8080:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Begin streaming the logs of the 'rocket-ranger' container in the 'vpn-service-pod' pod | Command:
```bash
kubectl logs -f -c rocket-ranger vpn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container",... |
Import the environment variables from the 'encryption-key-secret' secret into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/encryption-key-secret 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 definitions in ... |
Forward port 8080 on your local machine to port 8088 inside the pod 'chat-app-pod' | Command:
```bash
kubectl port-forward pod/chat-app-pod 8080: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 autom... |
Taint node 'kube-master-9' with a new taint or replace the value of an existing taint if it already exists | Command:
```bash
kubectl taint nodes kube-master-9 zone=us-west-1a: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 f... |
Create a copy of the monitoring-pod and change all container images to docker.elastic.co/elasticsearch/elasticsearch | Command:
```bash
kubectl debug monitoring-pod --copy-to=my-custom-dbg --set-image=*=docker.elastic.co/elasticsearch/elasticsearch
```
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.... |
Add a taint with key 'cpu-type' on nodes having label zone=us-east-1 | Command:
```bash
kubectl taint node -l zone=us-east-1 cpu-type=dev-node-4: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": "... |
Set the custom TLS server name to "kube-cluster-2" for the "moon-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster moon-cluster --tls-server-name=kube-cluster-2
```
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] [--certifica... |
embed certificate authority data for the web-cluster cluster entry | Command:
```bash
kubectl config set-cluster web-cluster --embed-certs --certificate-authority=~/.kube/on-prem-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 s... |
Create a pod named "hazelcast" using the "mongo" image and expose port 8083. | Command:
```bash
kubectl run hazelcast --image=mongo --port=8083
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Copy the file /tmp/foo from the remote pod 'worker-pod-4' in the 'rook-ceph' namespace to the local directory /tmp/bar | Command:
```bash
kubectl cp rook-ceph/worker-pod-4:/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.ku... |
Create a new secret named 'api-key-secret' and add the keys for each file in the 'bar' folder to it by specifying the path to the 'profiles' file. | Command:
```bash
kubectl create secret generic api-key-secret --from-file=path/to/profiles
```
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 t... |
Add a taint with key 'dedicated' on nodes having label myLabel | Command:
```bash
kubectl taint node -l myLabel 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": "", "usage": "Output... |
Create a deployment named sonarqube with the redis image and expose port 8080. | Command:
```bash
kubectl create deployment sonarqube --image=redis --port=8080
```
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:... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Forward port 9090 on the pod 'backend-pod' to port 8888 on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 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 ... |
Create an ingress called 'private-ingress' that directs requests to a specific domain and path to a service with TLS. | Command:
```bash
kubectl create ingress private-ingress --rule="site.com/input=svc1:3306,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 cluster role named "custom_role" with the following permissions: | Command:
```bash
kubectl create clusterrole custom_role --verb=connect --resource=configmaps --resource-name=billing-service --resource-name=load-balancer
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=s... |
create a job with a specific command | Command:
```bash
kubectl create job certificate-renewal --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... |
Remove the label 'bar' from the pod 'cdn' if it exists | Command:
```bash
kubectl label pods cdn unhealthy-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If tru... |
Create a cluster role named "foo" with the specified resource names | Command:
```bash
kubectl create clusterrole foo --verb=connect --resource=configmaps --resource-name=prod-api-gateway --resource-name=image-processor
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server... |
Set the service account of the deployment "backend-microservice-deployment" to "gitlab-runner" | Command:
```bash
kubectl set serviceaccount deployment backend-microservice-deployment gitlab-runner
```
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
... |
Listen on a random local port and forward traffic to port 5000 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod :5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Update the MAX_CONNECTIONS environment variable in the log-aggregator-deployment deployment by importing the value from the keys specified in the env-vars ConfigMap. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/env-vars 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 defini... |
Execute the command 'nginx -t' in the code-explorer container of the monitoring-pod pod and return the output. | Command:
```bash
kubectl exec monitoring-pod -c code-explorer -- nginx -t
```
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, ... |
Create a cluster role named "default_role" with the following permissions: verb=get, resource=pods, resource names=web-frontend and cache-redis | Command:
```bash
kubectl create clusterrole default_role --verb=get --resource=pods --resource-name=web-frontend --resource-name=cache-redis
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|n... |
Update the annotation 'expiration-date' of the pod 'log-aggregator' with the value '2024-12-31' | Command:
```bash
kubectl annotate pods log-aggregator expiration-date='2024-12-31'
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/namespace-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 def... |
Create a LoadBalancer service named api-service-lb and map the port 8084 of the service to the port 8088 of the pods. | Command:
```bash
kubectl create service loadbalancer api-service-lb --tcp=8084:8088
```
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", "def... |
Create a job with a specific command | Command:
```bash
kubectl create job testing --image=confluentinc/cp-kafka -- kafka-console-producer --broker-list localhost:9092 --topic test
```
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": "--... |
Set the service account of the deployment "search-engine-deployment" to "spinnaker" | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment spinnaker
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`ku... |
import the 'external_api_url' key from the 'log-config' config map and set it as an environment variable for the 'mydeployment' deployment. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/log-config deployment/mydeployment
```
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 o... |
Set the cluster field in a specific context to a specific cluster | Command:
```bash
kubectl config set contexts.admin-context.cluster galaxy-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you ... |
Update the 'monitoring' pod by setting the annotation 'owner' to 'alice smith'. | Command:
```bash
kubectl annotate pods monitoring owner='alice smith'
```
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 arbitra... |
Remove all the taints with key 'disktype' from the 'web-node-8' node | Command:
```bash
kubectl taint nodes web-node-8 disktype-
```
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|yaml|n... |
Rename a context in the kubeconfig file | Command:
```bash
kubectl config rename-context cluster-2-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 wil... |
Create a cron job named "email-notifications" that runs every minute and executes the command "kafka-server-start /etc/kafka/server.properties" using the container image "confluentinc/cp-kafka". | Command:
```bash
kubectl create cronjob email-notifications --image=confluentinc/cp-kafka --schedule="*/1 * * * *" -- kafka-server-start /etc/kafka/server.properties
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [a... |
Set cpu and memory limits for the Kafka container in a deployment. | Command:
```bash
kubectl set resources deployment kafka -c=nginx --limits=cpu=50m,memory=1Gi
```
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 it... |
Create a debuggable copy of the frontend pod by changing the command of the container "mycontainer". | Command:
```bash
kubectl debug frontend-pod -it --copy-to=debug-image-app --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... |
Create a deployment named sonarqube, using the jenkins image, and expose port 8088. | Command:
```bash
kubectl create deployment sonarqube --image=jenkins --port=8088
```
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 o... |
Set the custom TLS server name to "staging-cluster" for the cluster entry "kube-cluster-2" | Command:
```bash
kubectl config set-cluster kube-cluster-2 --tls-server-name=staging-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certif... |
Create a new config map named global-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap global-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.
Whe... |
Forward local port 8088 to port 8000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 8088: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 auto... |
Auto scale the 'gateway' deployment with a minimum of 1 and a maximum of 12 pods, using the default autoscaling policy | Command:
```bash
kubectl autoscale deployment gateway --min=1 --max=12
```
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... |
Update the label of pod 'frontend' to have the key 'component' and the value 'api' | Command:
```bash
kubectl label pods frontend component=api
```
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":... |
Edit the service 'analytics-service' using the 'code' editor. | Command:
```bash
KUBE_EDITOR="code" kubectl edit svc/analytics-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 variabl... |
Display the deployments in the "dev-2.2.0" version of the "web-apps" API group in YAML format. | Command:
```bash
kubectl get deployments.dev-2.2.0.web-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 wil... |
Create a single ingress named 'app1-ingress' that directs requests for site.com/bar to svc1:27017, and uses the tls secret "my-cert". | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/bar=svc1:27017,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": "... |
Delete the context for the testing-context cluster | Command:
```bash
kubectl config delete-context testing-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
Set CPU and memory limits for the CentOS container in the "centos" deployment to 1 CPU and 128Mi of memory. | Command:
```bash
kubectl set resources deployment centos -c=nginx --limits=cpu=1,memory=128Mi
```
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... |
Update the annotation of pod 'media-stream' with the value 'Prometheus' for the key 'monitoring-tool'. | Command:
```bash
kubectl annotate --overwrite pods media-stream 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 lab... |
Forward local port 5432 to port 5432 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 5432: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... |
create an ExternalName service named external-monitoring-service with the external name museum-example.museum | Command:
```bash
kubectl create service externalname external-monitoring-service --external-name museum-example.museum
```
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... |
Create a new secret named 'ldap-credentials-secret' with keys for each file in the 'path/to/options' folder. | Command:
```bash
kubectl create secret generic ldap-credentials-secret --from-file=path/to/options
```
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 basen... |
Create a job using the ruby image, with the 'irb' command | Command:
```bash
kubectl create job testing --image=ruby -- irb
```
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. One of: json|y... |
Listen on ports 8088 and 6000 locally, and forward data to/from ports 8000 and 6000 in a pod selected by the log-aggregator-deployment deployment. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 8088 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 wi... |
resume the rollout of the 'namespace-1' deployment | Command:
```bash
kubectl rollout resume deployment/namespace-1
```
What it does:
Resume a paused resource.
Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.
Syntax:
`kubectl rollout resume RESOURCE`
H... |
Forward data between local ports 8081 and 6000 to/from ports 6379 and 6000 in a pod selected by the deployment named 'mydeployment'. | Command:
```bash
kubectl port-forward deployment/mydeployment 8081 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selecte... |
Update the pod 'auth' by setting the annotation 'SLA' with the value '99.9% uptime'. | Command:
```bash
kubectl annotate pods auth SLA='99.9% uptime'
```
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 arbitrary stri... |
Set the environment variable JWT_SECRET to "your-jwt-secret" on the deployment named 'email-server-deployment' | Command:
```bash
kubectl set env deployment/email-server-deployment JWT_SECRET=your-jwt-secret
```
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... |
Add a taint to the node 'app-node-6' with the key 'special', value 'backup', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes app-node-6 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... |
Set custom TLS server name for a cluster entry | Command:
```bash
kubectl config set-cluster moon-cluster --tls-server-name=kube-cluster-1
```
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] [--certifica... |
Create a deployment named web using the hazelcast/hazelcast image. | Command:
```bash
kubectl create deployment web --image=hazelcast/hazelcast
```
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: jso... |
Forward local port 8000 to port 8080 in a specific pod, selected by the deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8000 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 s... |
Add a taint with key 'disktype' on nodes having label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha disktype=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": "", "u... |
Execute the command `redis-server --version` in the `quantum-quark` container of the `proxy-server-pod` pod and display the output. | Command:
```bash
kubectl exec proxy-server-pod -c quantum-quark -- redis-server --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 na... |
Retrieve the output of the 'dotnet --list-runtimes' command executed in the payment-gateway-pod. | Command:
```bash
kubectl exec payment-gateway-pod -- dotnet --list-runtimes
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.