prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new config map named db-config from the key=value pairs in the file "path/to/options". | Command:
```bash
kubectl create configmap db-config --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 ... |
Get the output from running the 'mysqld' command in the 'warp-drive' container of the 'monitoring-pod' pod. | Command:
```bash
kubectl exec monitoring-pod -c warp-drive -- mysqld
```
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... |
Forward local port 5000 to port 8088 in the pod "log-aggregator-pod" for listening. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5000: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... |
Start a php pod with the name nginx and the base image php, but override the spec with a partial set of values parsed from JSON. | Command:
```bash
kubectl run nginx --image=php --overrides='{ "apiVersion": "v3.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] -- [COMMAND] ... |
Check if you have permission to list a specific job in a namespace | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n production
```
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 parti... |
Copy the local file "/tmp/foo_dir" to the remote pod "database-pod-2" in the container "ingress-controller" at the destination path "/tmp/bar" | Command:
```bash
kubectl cp /tmp/foo_dir database-pod-2:/tmp/bar -c ingress-controller
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Create a new config map named namespace-config with specified keys from files | Command:
```bash
kubectl create configmap namespace-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/path/to/data/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 creati... |
Create an ingress called 'www-ingress' that directs requests from testing.com/input to a service named 'svc1' on port 6379, and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress www-ingress --rule="testing.com/input=svc1:6379,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"... |
Import the 'smtp_server' key from the 'db-config' ConfigMap into the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/db-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 definitions i... |
Update the pod named 'log-aggregator' with the annotation 'monitoring-tool' and the value 'Prometheus', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods log-aggregator 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 l... |
Copy the file '/tmp/foo' from the 'rook-ceph/cache-pod-5' pod to the local '/tmp/bar' directory | Command:
```bash
kubectl cp rook-ceph/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.ku... |
Create a new config map named "app-config-dev" with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-dev --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/path/to/options/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creatin... |
Import the 'SMTP_SERVER' key from the 'kube-system-config' config map and set it as an environment variable for the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/kube-system-config deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Create a new secret called cert-manager-secret using the environment file parameters.env. | Command:
```bash
kubectl create secret generic cert-manager-secret --from-env-file=path/to/parameters.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to th... |
Embed the certificate authority data for the "cloud-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster cloud-cluster --embed-certs --certificate-authority=~/.kube/app-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... |
Expose a replica set called nginx as a service, using port 8443 to serve traffic and connecting to containers on port 500100. | Command:
```bash
kubectl expose rs nginx --port=8443 --target-port=500100
```
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. ... |
Set the CPU limits of the Jenkins container in a deployment to "2" and the memory limits to "128Mi". | Command:
```bash
kubectl set resources deployment jenkins -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 ... |
Set the resource request and limits for all containers in a Python deployment. | Command:
```bash
kubectl set resources deployment python --limits=cpu=200m,memory=512Mi --requests=cpu=200m,memory=256Mi
```
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 reque... |
Create a new job named 'batch-processing' using the 'amazonlinux' image, and execute the 'bash' command within the job. | Command:
```bash
kubectl create job batch-processing --image=amazonlinux -- bash
```
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 forma... |
Attach to the first pod of the replica set named "postgres" and get its output | Command:
```bash
kubectl attach rs/postgres
```
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.kub... |
Import the API_KEY key from the namespace-config config map into the search-engine-deployment deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/namespace-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Update the pod named 'proxy' with the annotation 'contact-email' and set the value to 'support@example.com' | Command:
```bash
kubectl annotate pods proxy 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 includ... |
Create a service for the replicated php resource, which serves on port 8443 and connects to the containers on port 500000. | Command:
```bash
kubectl expose rc php --port=8443 --target-port=500000
```
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 ... |
Add a taint with key 'disktype' and no value to node 'app-node-6' | Command:
```bash
kubectl taint nodes app-node-6 disktype: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: j... |
Create a deployment named logging that runs the ubuntu image. | Command:
```bash
kubectl create deployment logging --image=ubuntu
```
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|na... |
Expose the replicated WordPress deployment as a service, which will serve on port 8082 and connect to the containers on port 808100 | Command:
```bash
kubectl expose rc wordpress --port=8082 --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 specified po... |
Check if you have permission to list the "backup-job" job in the "cert-manager" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/backup-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 partial URL th... |
Create a new config map named 'db-config' using the configurations from the 'configurations.env' file | Command:
```bash
kubectl create configmap db-config --from-env-file=path/to/configurations.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 t... |
Drain the worker-node-3 node forcefully, even if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set on it | Command:
```bash
kubectl drain worker-node-3 --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/ . Otherwise... |
Execute the command 'kafka-topics --list' inside the 'mycontainer' container in the 'mypod' pod and retrieve the output. | Command:
```bash
kubectl exec mypod -c mycontainer -- kafka-topics --list
```
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, ... |
Update the annotation 'contact-email' of pod 'monitoring' with the value 'support@example.com' | Command:
```bash
kubectl annotate pods monitoring 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 i... |
Create a cron job that runs a specific command at a specified schedule | Command:
```bash
kubectl create cronjob metrics-collection --image=redis --schedule="*/1 * * * *" -- redis-cli
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "... |
scale the resource specified in pod.json to 7 replicas | Command:
```bash
kubectl scale --replicas=7 -f pod.json
```
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 validated b... |
Forward ports locally to a 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... |
Print the supported API resources for the 'extensions' APIGroup | Command:
```bash
kubectl api-resources --api-group=extensions
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Set the service account for the deployment named "user-management-deployment" to "kube-controller-manager". | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment kube-controller-manager
```
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), stateful... |
Create a job with a command to perform a deployment rollout | Command:
```bash
kubectl create job deployment-rollout-job --image=centos -- bash
```
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 form... |
Create a new secret named 'password-secret' and include keys for each file in the folder 'path/to/preferences' | Command:
```bash
kubectl create secret generic password-secret --from-file=path/to/preferences
```
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 ... |
Create a deployment named "monitoring" using the "mongo" image and run the "mongo" command inside the container. | Command:
```bash
kubectl create deployment monitoring --image=mongo -- mongo
```
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... |
Create a job with a specific command and image | Command:
```bash
kubectl create job data-migration-job --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch --version
```
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... |
Create an ingress called 'private-ingress' with a rule that directs requests from website.com/example to svc1:3000 | Command:
```bash
kubectl create ingress private-ingress --rule="website.com/example=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Create a copy of the "proxy-service-pod" pod, changing the command of the "mycontainer" container. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=my-custom-dbg --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 d... |
Open the frontend-service service for editing using the vim editor | Command:
```bash
KUBE_EDITOR="vim" kubectl edit svc/frontend-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables... |
Import the key "smtp_server" from the "app-name-config" config map and set it as an environment variable in the "user-management-deployment" deployment. | Command:
```bash
kubectl set env --keys=smtp_server --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 variable de... |
Partially update the worker-node-3 node by setting `spec.unschedulable` to `true` using a strategic merge patch in YAML format. | Command:
```bash
kubectl patch node worker-node-3 -p $'spec:\n unschedulable: true'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpfu... |
Create a copy of chat-app-pod, changing all container images to ethereum/client-go and name it my-debugger | Command:
```bash
kubectl debug chat-app-pod --copy-to=my-debugger --set-image=*=ethereum/client-go
```
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 i... |
Create a deployment named wordpress that runs the php image and exposes port 8084 | Command:
```bash
kubectl create deployment wordpress --image=php --port=8084
```
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... |
Attach to the first pod of the replica set named centos and get its output | Command:
```bash
kubectl attach rs/centos
```
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.kuber... |
Import the 'debug_mode' key from the 'kube-system-config' config map and set it as an environment variable in the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/kube-system-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 defin... |
Expose the replica set named 'ubuntu' and make it accessible on port 8081, connecting to the containers on port 330600. | Command:
```bash
kubectl expose rs ubuntu --port=8081 --target-port=330600
```
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.... |
Create an ingress resource named 'website-ingress' with a rule that directs requests for 'website.com/module' to service 'svc1' on port 8010, and use the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress website-ingress --rule="website.com/module=svc1:8010,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... |
Create an ingress resource called 'app1-ingress' with a routing rule that directs requests to site.com/module to the service 'svc1' on port 3000 | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/module=svc1:3000,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 'api' pod by adding the annotation 'owner' with the value 'alice smith' | Command:
```bash
kubectl annotate pods api 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 arbitrary stri... |
Start a Ubuntu pod with a container that exposes port 9091 | Command:
```bash
kubectl run hazelcast --image=ubuntu --port=9091
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Remove the context for the admin-context cluster from the current configuration | Command:
```bash
kubectl config delete-context admin-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
Retrieve the output from running the 'elasticsearch --version' command in the stardust-shuttle container of the database-pod pod. | Command:
```bash
kubectl exec database-pod -c stardust-shuttle -- elasticsearch --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container na... |
Partially update the app-node-6 node by applying a strategic merge patch with the JSON specified in the command. | Command:
```bash
kubectl patch node app-node-6 -p '{"data":{"key":"new-value"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful fl... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=database_url --from=configmap/ui-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in ... |
Retrieve the details for the following resources: replication controller 'web', service 'monitoring-rc', and pod 'chat-app-pod' | Command:
```bash
kubectl get rc/web service/monitoring-rc pods/chat-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced... |
Add a taint with key 'cpu-type', value 'x86' and effect 'NoSchedule' to the 'worker-node-3' node | Command:
```bash
kubectl taint nodes worker-node-3 cpu-type=x86: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. On... |
Print the list of supported namespaced resources. | Command:
```bash
kubectl api-resources --scopespaced=true
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Forward traffic from port 9090 on all addresses to port 6379 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 9090:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Add a taint to the nodes in the 'us-east-1' zone that have the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 disktype=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": "", "u... |
Create a copy of the "email-service-pod" with a debug container, using the "debian" image | Command:
```bash
kubectl debug email-service-pod -it --copy-to=debug-image-web --image=debian --set-image=proxy=nginx:1.21,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource... |
Copy the ~/.config/kube directory from the 'argocd/logging-agent-pod-7' pod to the local /etc/kubernetes directory. | Command:
```bash
kubectl cp argocd/logging-agent-pod-7:~/.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, us... |
Copy the file /var/run/secrets/kubernetes.io/serviceaccount/ from your local machine to the /tmp/bar directory inside the front-end-pod-12 pod | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ front-end-pod-12:/tmp/bar -c security-scanner
```
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": "", "usag... |
Create a copy of the analytics-pod with a modified command for the cosmic-container | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-1 --container=cosmic-container -- 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 ... |
Allow local port forwarding from port 9090 to port 9090 in a pod selected by the monitoring-stack-deployment deployment. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 9090 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 ... |
Set the server field on the kube-cluster-2 cluster entry without modifying any other values | Command:
```bash
kubectl config set-cluster kube-cluster-2 --server=https://1.2.3.4
```
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] [--certificate-aut... |
Copy the contents of the ~/.config/kube directory from a remote pod named "admin-dashboard-pod-16" to the local directory "/tmp/bar". | Command:
```bash
kubectl cp ingress-nginx/admin-dashboard-pod-16:~/.config/kube :/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... |
Forward traffic from port 8888 on localhost and IP 10.19.21.23 to port 8088 in the pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-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 criteri... |
Create an ingress called 'app-loadbalancer-ingress' that directs requests to foo.com/example to a service called svc1:8010, using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="foo.com/example=svc1:8010,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Copy the file /var/run/secrets/kubernetes.io/serviceaccount/ from your local machine to the remote pod named openfaas/ingress-controller-pod-8, and place it in the directory /tmp/bar. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ openfaas/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"... |
Create a new config map named monitoring-config using the properties file1.txt and settings file2.txt as keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap monitoring-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creatin... |
Check if you have permission to list the "image-processing-job" job in the "staging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/image-processing-job -n staging
```
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 U... |
List the replication controller "web", service "monitoring-rc", and pod "api-service-pod" | Command:
```bash
kubectl get rc/web service/monitoring-rc pods/api-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespa... |
Create a pod disruption budget named cache-cluster-pdb that will select all pods with the region=us-east label and require at least 9 of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=region=us-east --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... |
Create an ingress called 'app2-ingress' that routes requests to 'site.com/example' to 'svc1:9000' using a TLS secret called 'my-cert'. | Command:
```bash
kubectl create ingress app2-ingress --rule="site.com/example=svc1:9000,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"... |
Import the SECRET_KEY key from the app-config-prod config map into the cache-cluster-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config-prod 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... |
Set the service account of the 'database-deployment' deployment to 'vault' | Command:
```bash
kubectl set serviceaccount deployment database-deployment vault
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kubectl set... |
Create an ingress called 'app-ingress' with a rule that directs requests from "website.com/module" to "svc1:9092" using the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-ingress --rule="website.com/module=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Add a taint to the node 'edge-node-10' with the key 'zone' and no value | Command:
```bash
kubectl taint nodes edge-node-10 zone: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: jso... |
Retrieve the phase value of the pod named "cdn-service-pod" | Command:
```bash
kubectl get -o template pod/cdn-service-pod --template={{.status.phase}}
```
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... |
Listen on port 3000 on localhost and the IP address 10.19.21.23, forwarding the traffic to port 8088 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the crit... |
Update the node 'monitoring-node-15' by adding a taint with key 'environment' and value 'production', and set the effect to 'NoSchedule' | Command:
```bash
kubectl taint nodes monitoring-node-15 environment=production: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": "Ou... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/api-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 one o... |
Set up certificate authority data for the "cloud-cluster" cluster entry, embedding the certs in the configuration. | Command:
```bash
kubectl config set-cluster cloud-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... |
Copy the ~/.config/kube file from the remote pod "openfaas/load-balancer-pod-9" to the local directory /etc/kubernetes. | Command:
```bash
kubectl cp openfaas/load-balancer-pod-9:~/.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, ... |
create a ClusterIP service named log-service-clusterip to expose port 3001 to port 8888 | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=8888:3001
```
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... |
Forward local port 6379 to pod port 9090, and local port 6000 to pod port 6000 in the 'web-app-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 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 s... |
Switch to raw terminal mode and attach to the 'nebula-navigator' container inside the 'proxy-server-pod' pod. | Command:
```bash
kubectl attach proxy-server-pod -c nebula-navigator -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. ... |
Forward local port 8088 to pod port 6379 on selected IP and localhost. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8088: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 p... |
Increase the number of replicas in the 'mysql' replica set to 5. | Command:
```bash
kubectl scale --replicas=5 rs/mysql
```
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 validated befo... |
Set the cluster field of the my-context context to staging-cluster in the cloud-context configuration. | Command:
```bash
kubectl config set contexts.cloud-context.cluster staging-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... |
Retrieve the previous terminated container logs named "rocket-ranger" from the pod named "monitoring-pod". | Command:
```bash
kubectl logs -p -c rocket-ranger 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", ... |
Delete pods and services with the label "stack=tech-stack". | Command:
```bash
kubectl delete pods,services -l stack=tech-stack
```
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 sel... |
Start a pod named "hazelcast" with the Ruby image and expose port 8080 on the container | Command:
```bash
kubectl run hazelcast --image=ruby --port=8080
```
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": "--fil... |
Create a job named 'report-generation-job' using the 'amazonlinux' image, with the command 'bash' | Command:
```bash
kubectl create job report-generation-job --image=amazonlinux -- bash
```
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 ... |
Set the environment variables for a deployment by importing from a secret | Command:
```bash
kubectl set env --from=secret/api-key-secret deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or m... |
Auto scale the deployment "gateway" with a minimum of 5 pods and a maximum of 11 pods. | Command:
```bash
kubectl autoscale deployment gateway --min=5 --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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.