prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the MAX_CONNECTIONS key from the log-config ConfigMap into the cache-cluster-deployment deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/log-config deployment/cache-cluster-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... |
Create a new ClusterIP service named frontend-service-clusterip and map port 5000 of the service to port 7000 of the pods | Command:
```bash
kubectl create service clusterip frontend-service-clusterip --tcp=5000:7000
```
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... |
Start a Redis pod and expose port 9092 | Command:
```bash
kubectl run hazelcast --image=redis --port=9092
```
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... |
Check if you have permission to list the job named "batch-processing-job" in the "cert-manager" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/batch-processing-job -n cert-manager
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a part... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/payment-gateway-secret deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Forward traffic from port 8080 on your local machine to port 8081 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8080: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 be selected aut... |
Restart the 'prod' daemon set. | Command:
```bash
kubectl rollout restart daemonset/prod
```
What it does:
Restart a resource.
Resource rollout will be restarted.
Syntax:
`kubectl rollout restart RESOURCE`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the resource to ... |
Create a copy of the vpn-service-pod and change all container images to alpine for debugging | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-web --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 ... |
Forward traffic from port 8080 on all addresses to port 5000 in the frontend-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8080: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... |
Create a cron job that runs a task every minute. | Command:
```bash
kubectl create cronjob cron-task --image=busybox --schedule="*/1 * * * *"
```
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", "default": "", ... |
Create an autoscaling policy for the "payment" deployment with a minimum of 7 pods and a maximum of 15 pods | Command:
```bash
kubectl autoscale deployment payment --min=7 --max=15
```
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... |
Create a pod using the data in a preferences.json file | Command:
```bash
kubectl create -f ./preferences.json
```
What it does:
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
Syntax:
`kubectl create -f FILENAME`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files to use to c... |
Create an ingress rule named 'service-ingress' that routes requests from testing.com/module to svc1:7000 with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="testing.com/module=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": "", "u... |
Copy the /tmp/foo_dir directory from the ingress-controller-pod-8 pod in the cert-manager namespace to the /tmp/bar directory on your local machine. | Command:
```bash
kubectl cp cert-manager/ingress-controller-pod-8:/tmp/foo_dir :/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,... |
display the most recent 43 lines of logs for the monitoring-pod pod | Command:
```bash
kubectl logs --tail=43 monitoring-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "... |
Display the most recent 53 lines of logs for the pod named web-app-pod | Command:
```bash
kubectl logs --tail=53 web-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": "-c"... |
Copy the ~/.config/kube file from the api-server-pod-3 pod to the /etc/kubernetes directory on your local machine | Command:
```bash
kubectl cp kube-proxy/api-server-pod-3:~/.config/kube /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 omitted, u... |
Add the annotation 'security-scan-status' with the value 'pass' to the pod 'analytics' | Command:
```bash
kubectl annotate pods analytics 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 include ar... |
Forward traffic from port 3000 on all addresses to port 8088 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-settings 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... |
List all deployments in the "alpha-2.0" version of the "apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.alpha-2.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 on... |
Create a new ClusterIP service named auth-service-clusterip, exposing port 6379 on the service and targeting port 8082 on the backend. | Command:
```bash
kubectl create service clusterip auth-service-clusterip --tcp=6379:8082
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "... |
Remove all taints with the key 'datacenter' from the node 'dev-node-4' | Command:
```bash
kubectl taint nodes dev-node-4 datacenter-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml... |
Forward the traffic from port 5000 on localhost and IP address 10.19.21.23 to port 3000 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 5000:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/env-vars deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Create a role named "bar" with specific resource names | Command:
```bash
kubectl create role bar --verb=delete --resource=pods --resource-name=cache-redis --resource-name=app-worker-2
```
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|client|... |
Create a copy of a pod with modified container images | Command:
```bash
kubectl debug proxy-server-pod --copy-to=my-custom-dbg --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 name. Pods ... |
Delete the pods and services named "proxy" and "media-stream" | Command:
```bash
kubectl delete pod,service proxy media-stream
```
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 select... |
Create a service for the wordpress deployment, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose deployment wordpress --port=8089 --target-port=808100
```
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 spec... |
Create a deployment called db with the ruby image | Command:
```bash
kubectl create deployment db --image=ruby
```
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|yaml|name|go-t... |
Apply the configuration in the settings.json file to a pod | Command:
```bash
kubectl apply -f ./settings.json
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
... |
Create a cluster role binding named 'cluster-admin' with the 'cluster-admin' cluster role assigned to the users 'admin' and 'devops-user', and the group 'operations-team' | Command:
```bash
kubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=admin --user=devops-user --group=operations-team
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--gr... |
Update the service account of the 'proxy-service-deployment' deployment to 'flux'. | Command:
```bash
kubectl set serviceaccount deployment proxy-service-deployment flux
```
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:
`kubectl... |
Create a job with a command to build an image using the Golang image | Command:
```bash
kubectl create job image-build-job --image=golang -- go
```
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 o... |
Import the DEBUG_MODE key from the app-settings config map and set it as an environment variable for the frontend-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-settings deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Create a cron job named "data-processing" with the image "node" and schedule it to run every minute | Command:
```bash
kubectl create cronjob data-processing --image=node --schedule="*/1 * * * *" -- node --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": ... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/kube-system-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 ... |
Import the DEBUG_MODE key from the app-config-dev ConfigMap into the payment-processor-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-config-dev deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Add a taint with the key 'dedicated' on nodes that have the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice dedicated=worker-node-3: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": "",... |
Create a copy of vpn-service-pod with a debug container and new container images | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=debug-image-web --image=debian --set-image=api=api:v2,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and... |
Update the 'gateway' pod with the annotation 'release-notes' and set its value as 'https://example.com/release-notes/v2.5.1' | Command:
```bash
kubectl annotate pods gateway 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 larg... |
Forward traffic from port 8888 on all addresses to port 3000 in the log-aggregator-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8888:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a po... |
replace a pod using the configuration provided in the "config.json" file | Command:
```bash
cat config.json | 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 FI... |
Forward port 6379 on your local machine to port 9090 in the pod named security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 6379: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 select... |
Import the 'external_api_url' key from the 'app-name-config' config map into the 'user-management-deployment' deployment | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-name-config deployment/user-management-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 variab... |
Create a copy of auth-service-pod with all container images changed to postgres for debugging purposes. | Command:
```bash
kubectl debug auth-service-pod --copy-to=debug-image-1 --set-image=*=postgres
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no... |
Start streaming the logs of the "nano-bot" container in the "monitoring-pod" pod | Command:
```bash
kubectl logs -f -c nano-bot monitoring-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "shor... |
Create a cluster role named "admin_role" with the verb "update" and the resources "configmaps" and "queue-consumer" and "search-elasticsearch" | Command:
```bash
kubectl create clusterrole admin_role --verb=update --resource=configmaps --resource-name=queue-consumer --resource-name=search-elasticsearch
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-r... |
create a cron job named email-notifications that runs the command `python` every minute | Command:
```bash
kubectl create cronjob email-notifications --image=python --schedule="*/1 * * * *" -- python
```
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": "-... |
Add a taint with key 'workload' on nodes having label feature=feature-xyz | Command:
```bash
kubectl taint node -l feature=feature-xyz workload=monitoring-node-15: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 port 8000 to the targetPort of the "https" service port in a pod selected by the "scheduler-service" service. | Command:
```bash
kubectl port-forward service/scheduler-service 8000:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sele... |
Update the environment variable SMTP_USERNAME to "your-username" for all containers in all replication controllers in the project. | Command:
```bash
kubectl set env rc --all SMTP_USERNAME=your-username
```
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 (within replic... |
Embed the certificate authority data for the "testing-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster testing-cluster --embed-certs --certificate-authority=~/.kube/staging-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 conf... |
Embed a certificate authority data for the app-cluster cluster entry | Command:
```bash
kubectl config set-cluster app-cluster --embed-certs --certificate-authority=~/.kube/prod-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-... |
Forward traffic from local port 5432 to port 9090 in the pod named "backend-pod", allowing connections from all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5432: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 a new config map named 'namespace-config' using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap namespace-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When crea... |
Update the image of all containers in the daemonset app-v2 to 'mongo:5.0.2' | Command:
```bash
kubectl set image daemonset app-v2 *=mongo:5.0.2
```
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... |
Execute the 'yum install -y wget' command in the 'nano-bot' container of the 'mypod' pod and provide the output. | Command:
```bash
kubectl exec mypod -c nano-bot -- yum install -y wget
```
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... |
Set the resource request and limits for all containers in the php deployment | Command:
```bash
kubectl set resources deployment php --limits=cpu=200m,memory=512Mi --requests=cpu=3,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, ... |
Create a deployment named 'grafana' using the 'ethereum/client-go' image and expose port 9090. | Command:
```bash
kubectl create deployment grafana --image=ethereum/client-go --port=9090
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output form... |
Import the 'debug_mode' key from the 'ui-config' config map and set it as an environment variable for the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/ui-config deployment/cache-cluster-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... |
Retrieve the snapshot logs from container frontend-deployment-1 in the deployment named media-stream-pod. | Command:
```bash
kubectl logs deployment/frontend-deployment -c media-stream-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... |
Set the basic authentication credentials for the "admin" entry with the username "admin" and password "uXFGweU9l35qcif" | Command:
```bash
kubectl config set-credentials admin --username=admin --password=uXFGweU9l35qcif
```
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
Beare... |
Create a job named "data-migration-job" using the "node" image, and run the command "node" in the container | Command:
```bash
kubectl create job data-migration-job --image=node -- node
```
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. On... |
Forward local port 6379 to port 8000 in the pod "chat-app-pod" and listen on port 6000 locally and forward data to/from port 6000 in the pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 6379 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Run the `mongo --version` command in the `stardust-shuttle` container of the `web-app-pod` pod and display the output. | Command:
```bash
kubectl exec web-app-pod -c stardust-shuttle -- mongo --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 om... |
Start a pod named nginx with the ubuntu image, but override the pod's specification by providing a partial set of values extracted from a JSON object | Command:
```bash
kubectl run nginx --image=ubuntu --overrides='{ "apiVersion": "alpha-2.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] -- [COM... |
Create a pod disruption budget named auth-service-pdb that will ensure at least one pod with the label owner=team-1 is always available. | Command:
```bash
kubectl create poddisruptionbudget auth-service-pdb --selector=owner=team-1 --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Setup a port forwarding from port 8088 on localhost and IP 10.19.21.23 to port 8000 on the pod named 'chat-app-pod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-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 criter... |
Create an ingress called 'api-ingress' with a rule that directs requests from foo.com/example to svc1:7000 and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="foo.com/example=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": ... |
Forward port 3000 to 8000 in the given pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 3000: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 ... |
Create a role named "custom_role" with the following permissions: | Command:
```bash
kubectl create role custom_role --verb=proxy --resource=pods --resource-name=database-master --resource-name=file-storage
```
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=ser... |
Add a taint with key 'disktype' on nodes having label namespace=mynamespace as 'PreferNoSchedule' for node-1 | Command:
```bash
kubectl taint node -l namespace=mynamespace disktype=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"... |
Create a service for the replicated 'php' resource, serving on port 9090 and connecting to the containers on port 300100. | Command:
```bash
kubectl expose rc php --port=9090 --target-port=300100
```
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. A ... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-secrets 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 de... |
Forward traffic from port 6379 on all addresses to port 9090 in the chat-app-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 6379: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... |
Get output from the first pod of the replica set named mongo | Command:
```bash
kubectl attach rs/mongo
```
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 omitted, use the kubectl.kubern... |
Import environment variables from a config map with a specific prefix to a deployment | Command:
```bash
kubectl set env --from=configmap/ui-config --prefix=MYSQL_ 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 definitions i... |
Scale the replica set 'webapp-replicaset' to have 1 replica. | Command:
```bash
kubectl scale --replicas=1 rs/webapp-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-version is specified, it is va... |
Embed the certificate authority data for the e2e cluster entry, using the certificate authority file located at ~/.kube/testing-cluster/kubernetes.ca.crt. | Command:
```bash
kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/testing-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-clust... |
Start a pod called "nginx" with the image "ubuntu", but modify the spec of the pod using the values parsed from the provided JSON. | Command:
```bash
kubectl run nginx --image=ubuntu --overrides='{ "apiVersion": "v2.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] -- [COMMAN... |
Retrieve the previous terminated warp-drive container logs from the chat-app-pod pod | Command:
```bash
kubectl logs -p -c warp-drive 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", "shor... |
Update the 'auth' pod with the annotation 'SLA' and set the value to '99.9% uptime', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite 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 ar... |
Create a role named "default_role" with API Group specified | Command:
```bash
kubectl create role default_role --verb=create,list,delete --resource=persistentvolumes.storage.k8s.io
```
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|client|none]`
... |
Get the output from running the 'python' command in the web-app-pod pod. | Command:
```bash
kubectl exec web-app-pod -- python
```
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... |
Copy the file named "foo" from the local machine to the "/etc/kubernetes" directory in the remote pod named "monitoring-agent-pod-6" in the "kube-node-lease" namespace. | Command:
```bash
kubectl cp :/tmp/foo kube-node-lease/monitoring-agent-pod-6:/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 omit... |
Import the "secret_key" key from the "monitoring-config" ConfigMap into the "scheduler-app-deployment" deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/monitoring-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... |
Start streaming the logs of the stardust-shuttle container in the mypod pod | Command:
```bash
kubectl logs -f -c stardust-shuttle mypod
```
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... |
Delete pods and services with the names "web" and "api" | Command:
```bash
kubectl delete pod,service web api
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
Some re... |
Set the criticality of the pod identified by the type and name specified in "conf.json" to high by running the command 'kubectl annotate -f conf.json criticality=high | Command:
```bash
kubectl annotate -f conf.json criticality=high
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary str... |
Create a pod disruption budget named notification-service-pdb that requires at least four frontend pods to be available at any point in time | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=tier=frontend --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-ava... |
Stream the logs of the "lunar-launcher" container in the "auth-service-pod" pod | Command:
```bash
kubectl logs -f -c lunar-launcher 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 file '/tmp/foo' from the 'backend-pod-13' pod to the local directory '/tmp/bar_dir' | Command:
```bash
kubectl cp velero/backend-pod-13::/tmp/foo /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 omitted, use the kubectl... |
Set the active context to the kube-cluster-1 cluster | Command:
```bash
kubectl config use-context kube-cluster-1
```
What it does:
Set the current-context in a kubeconfig file.
Syntax:
`kubectl config use-context CONTEXT_NAME` |
Create a role named "bar" with ResourceName specified | Command:
```bash
kubectl create role bar --verb=create --resource=pods --resource-name=queue-consumer --resource-name=content-delivery
```
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|... |
Set the custom TLS server name for the edge-cluster cluster entry to "testing-cluster" | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=testing-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] [--certific... |
Set the cpu limits of the postgres container in the deployment named 'postgres' to "2" and the memory limits to "128Mi" | Command:
```bash
kubectl set resources deployment postgres -c=nginx --limits=cpu=2,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... |
Auto scale the deployment "proxy-server" with a minimum of 6 pods and a maximum of 10 pods, using the default autoscaling policy. | Command:
```bash
kubectl autoscale deployment proxy-server --min=6 --max=10
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that... |
import the 'external_api_url' key from the 'api-config' config map and set it as an environment variable for the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/api-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Forward local port 5432 to port 8088 in the web-app-pod pod | Command:
```bash
kubectl port-forward pod/web-app-pod 5432:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.