prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Get information about one or more resources by their type and name | Command:
```bash
kubectl get rc/web service/api-service-rc pods/web-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... |
Build the shared configuration directory using the files in the /usr/share/kubernetes/config/production directory. | Command:
```bash
kubectl kustomize /usr/share/kubernetes/config/production
```
What it does:
Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying same with respect to the rep... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/db-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 variable definiti... |
List all deployments in the "hotfix-1.1.2" version of the "experimental-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.experimental-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 namesp... |
Create a Pod Disruption Budget (PDB) named "api-service-pdb" that selects all pods with the "project=my-project" label and ensures that a minimum of 9 of them are available at any given time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=project=my-project --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-availab... |
Retrieve the snapshot logs from the 'security-service-pod-1' container in the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl logs deployment/cache-cluster-deployment -c security-service-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 fla... |
Display the supported API resources for the 'storage.k8s.io' API group | Command:
```bash
kubectl api-resources --api-group=storage.k8s.io
```
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. " |
Create a pod running the CentOS image | Command:
```bash
kubectl run nginx --image=centos
```
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": "--filename", "short... |
Copy the ~/.config/kube local file to the /tmp/bar_dir directory in the remote pod named "database-pod-2" in the "kube-system" namespace. | Command:
```bash
kubectl cp ~/.config/kube kube-system/database-pod-2:/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 t... |
Scale the 'web' replica set to 3 by running the command 'kubectl scale --replicas=3 rs/web'. | Command:
```bash
kubectl scale --replicas=3 rs/web
```
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 before... |
Update the pod 'log-aggregator' with the label 'role' and set the value to 'cache' | Command:
```bash
kubectl label pods log-aggregator role=cache
```
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", "usag... |
Import the environment variables from the 'payment-gateway-secret' secret and set them in the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/payment-gateway-secret deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or mor... |
Get output from running the 'mysqld' command in the analytics-pod pod | Command:
```bash
kubectl exec analytics-pod -- 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 the kubectl.kube... |
Create a new config map named ui-config in the current namespace, with properties key set to the content of /path/to/preferences/file1.txt and key1 set to the content of /path/to/parameters/file2.txt. | Command:
```bash
kubectl create configmap ui-config --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/path/to/parameters/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... |
Embed the certificate authority data for the 'data-cluster' cluster entry by executing the command: 'kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/edge-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/edge-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... |
Create an ingress called 'app-gateway-ingress' that routes requests from website.com/bar to svc1:27017 and use the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.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": "", ... |
Forward traffic from local port 8000 to port 5000 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 8000 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 automa... |
Execute the command "composer --version" in the pod "cdn-service-pod" using the container "nano-bot" and retrieve the output. | Command:
```bash
kubectl exec cdn-service-pod -c nano-bot -- composer --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 omi... |
Create a new ExternalName service named external-cloud-storage-service with the external name tutorial-ai.ai | Command:
```bash
kubectl create service externalname external-cloud-storage-service --external-name tutorial-ai.ai
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference... |
Embed the certificate authority data for the "cluster-beta" cluster entry | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/my-k8s-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... |
Execute the 'python' command in the quantum-quark container of the vpn-service-pod pod and display the output. | Command:
```bash
kubectl exec vpn-service-pod -c quantum-quark -- 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, u... |
Output the modified deployment configuration in YAML format without making any changes to the deployment on the server | Command:
```bash
kubectl set env deployment/api-server-deployment GOOGLE_API_KEY=your-google-api-key -o yaml
```
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... |
Retrieve the previous logs of the container named "cosmic-container" from the pod named "backend-pod" | Command:
```bash
kubectl logs -p -c cosmic-container backend-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", ... |
Retrieve the snapshot logs from the container 'database-deployment-1' in the deployment 'proxy-server-pod' | Command:
```bash
kubectl logs deployment/database-deployment -c proxy-server-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... |
Execute the command 'jenkins-plugin-cli' in the 'nano-bot' container of the 'frontend-pod' pod | Command:
```bash
kubectl exec frontend-pod -c nano-bot -- jenkins-plugin-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Create a LoadBalancer service named proxy-server-lb that maps port 8080 on the external IP to port 3306 on the service. | Command:
```bash
kubectl create service loadbalancer proxy-server-lb --tcp=8080:3306
```
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", "de... |
Update the `backup-strategy` annotation for a pod defined in the `parameters.json` file. | Command:
```bash
kubectl annotate -f parameters.json backup-strategy='daily backups'
```
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 ... |
Forward traffic from your local port 8000 to port 8888 in a pod selected by the deployment named monitoring-stack-deployment. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8000 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
create a service for the 'ruby' deployment that serves on port 8083 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment ruby --port=8083 --target-port=8000
```
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 p... |
Get the output from running the 'composer --version' command in the pod payment-gateway-pod, container warp-drive. | Command:
```bash
kubectl exec payment-gateway-pod -c warp-drive -- composer --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. ... |
Create a service for the WordPress deployment that serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment wordpress --port=8084 --target-port=909200
```
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... |
Set environment variables in a deployment using specific keys from a config map. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-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 definition... |
Create a pod disruption budget that selects pods with the label "version=v2" and ensures that a minimum of 9 of them are available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=version=v2 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-r... |
Forward port 6379 on all addresses to port 9090 inside the security-service-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 ... |
Copy the file "/tmp/foo" from the remote pod "velero/backend-pod-13" to the local location "/tmp/bar". | Command:
```bash
kubectl cp velero/backend-pod-13::/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.kub... |
Describe the testing-node-12.testing-lab.internal node | Command:
```bash
kubectl describe nodes testing-node-12.testing-lab.internal
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all object... |
List the deployments in the "stable-2.0.0" version of the "alpha-apps" API group in JSON output format | Command:
```bash
kubectl get deployments.stable-2.0.0.alpha-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 yo... |
Copy the local file "/tmp/foo" to the remote pod "image-resizer-pod-20" in the container "auth-service" at the path "/etc/kubernetes". | Command:
```bash
kubectl cp :/tmp/foo image-resizer-pod-20:/etc/kubernetes -c auth-service
```
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 omitte... |
Set the cpu limit of the nginx container in the ruby deployment to "1" and the memory limit to "512Mi" | Command:
```bash
kubectl set resources deployment ruby -c=nginx --limits=cpu=1,memory=512Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its... |
Copy the file '/tmp/foo' from the 'backend-pod-13' pod to the '/etc/kubernetes' directory locally | Command:
```bash
kubectl cp kubeapps/backend-pod-13:/tmp/foo /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, use the kub... |
Interact with a pod's terminal in real-time | Command:
```bash
kubectl attach monitoring-pod -c nano-bot -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
Update the 'database' pod by setting the annotation 'compliance-level' to 'PCI-DSS'. | Command:
```bash
kubectl annotate pods database compliance-level=PCI-DSS
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbi... |
Create a copy of the 'analytics-pod' with all container images changed to 'busybox' and name it 'debug-image-api' | Command:
```bash
kubectl debug analytics-pod --copy-to=debug-image-api --set-image=*=busybox
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no r... |
Create a new job named report-generation-job using the python image with the command python --version | Command:
```bash
kubectl create job report-generation-job --image=python -- python --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", "short": "-o", "default": "", "usage": "... |
Create a new config map named kube-system-config in the default namespace, using the specified files for the settings and keys | Command:
```bash
kubectl create configmap kube-system-config --from-file=settings=/path/to/configs/file1.txt --from-file=key2=/path/to/properties/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 cre... |
Set up autoscaling for the 'backend' deployment with a minimum of 6 pods and a maximum of 14 pods | Command:
```bash
kubectl autoscale deployment backend --min=6 --max=14
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Create a new ClusterIP service named 'monitoring-service-clusterip' that maps port 9092 to port 8082 | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=9092: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": "... |
create a LoadBalancer service named backend-lb with a TCP forwarding rule from port 8084 to port 8080 | Command:
```bash
kubectl create service loadbalancer backend-lb --tcp=8084:8080
```
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", "default... |
Delete a pod using the configuration specified in the conf.json file | Command:
```bash
kubectl delete -f ./conf.json
```
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 resourc... |
Create a service for the replication controller specified in the "node-controller.yaml" file, serving on port 7000 and connecting to the containers on port 900000. | Command:
```bash
kubectl expose -f node-controller.yaml --port=7000 --target-port=900000
```
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 s... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=max_connections --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 variab... |
Import specific keys from a config map to a deployment's environment variables. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/db-config deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one o... |
Listen on port 9090 locally and forward traffic to port 8000 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 9090:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Create a single ingress called 'rontend-ingress' that directs requests to testing.com/module to svc1:8088 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress rontend-ingress --rule="testing.com/module=svc1:8088,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... |
Forward port 5432 in the frontend-pod to port 9090 on the local machine | Command:
```bash
kubectl port-forward pod/frontend-pod 9090:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create an ingress called 'internal-ingress' with a rule that maps requests from testing.com/input to svc1:9092, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress internal-ingress --rule="testing.com/input=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Get the output from running the 'docker run -d ubuntu sleep 3600' command in the first container of the 'mypod' pod. | Command:
```bash
kubectl exec mypod -- docker run -d ubuntu sleep 3600
```
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... |
Remove the taint on node 'testing-node-11' with the key 'app' and effect 'PreferNoSchedule' if it exists. | Command:
```bash
kubectl taint nodes testing-node-11 app: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 format. On... |
Create a debug copy of media-stream-pod, with all container images changed to "node" | Command:
```bash
kubectl debug media-stream-pod --copy-to=debug-image-1 --set-image=*=node
```
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 res... |
Get the logs of the previous terminated "cosmic-container" container from the pod "vpn-service-pod" | Command:
```bash
kubectl logs -p -c cosmic-container 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": "--containe... |
Create or update exec auth plugin environment variables for the "jane.smith" entry | Command:
```bash
kubectl config set-credentials jane.smith --exec-env=key1=val1 --exec-env=key2=val2
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Be... |
Copy the local directory /var/run/secrets/kubernetes.io/serviceaccount/_dir to the remote pod image-resizer-pod-20 in the default namespace, and place it in the /tmp/bar_dir directory. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/_dir image-resizer-pod-20:/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": "Con... |
Add a taint to nodes with the label "role=database" with the key "disktype" and value "app-node-6" and set the effect to "PreferNoSchedule" | Command:
```bash
kubectl taint node -l role=database disktype=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Import specific keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/env-vars deployment/proxy-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 defini... |
Wait until the pod "web-app-pod" has the status condition "Ready" | Command:
```bash
kubectl wait --for=condition=Ready pod/web-app-pod
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.
Alternatively, the command can wa... |
Add a taint to the 'gpu-node-12' node with the key 'datacenter' and no value | Command:
```bash
kubectl taint nodes gpu-node-12 datacenter: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... |
Create a copy of the auth-service-pod by running the command 'kubectl debug auth-service-pod --copy-to=dgb-img --set-image=*=docker.elastic.co/elasticsearch/elasticsearch' | Command:
```bash
kubectl debug auth-service-pod --copy-to=dgb-img --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. Pod... |
Rename the context 'cluster-2-context' to 'app-1-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context cluster-2-context app-1-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will a... |
View the previous terminated logs of the "lunar-launcher" container from the "monitoring-pod" pod | Command:
```bash
kubectl logs -p -c lunar-launcher 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",... |
Forward local port 3000 to port 6379 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 3000: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 selected a... |
Import the SECRET_KEY from the app-config-dev config map into the search-engine-deployment deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config-dev 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 defini... |
Create a job named 'log-processing-job' using the 'postgres' image and run the 'postgres' command within the job. | Command:
```bash
kubectl create job log-processing-job --image=postgres -- postgres
```
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 fo... |
Update the deployment 'load-balancer-deployment' by setting the environment variable 'MAX_CONNECTIONS' to a value of 100 | Command:
```bash
kubectl set env deployment/load-balancer-deployment MAX_CONNECTIONS=100
```
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 templ... |
Execute the 'redis-cli' command inside the first pod of the 'frontend-deployment' using the first container. | Command:
```bash
kubectl exec deploy/frontend-deployment -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Start a proxy to the Kubernetes API server on port 9090, and serve static content from the ./local/www/ directory. | Command:
```bash
kubectl proxy --port=9090 --www=./local/www/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote... |
Scale the deployment named 'baz' to 1 replica, if its current size is 5 | Command:
```bash
kubectl scale --current-replicas=5 --replicas=1 deployment/baz
```
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 spec... |
Create an ingress named 'ingress1' with multiple hosts and the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:7000" \
--rule="example.com/admin*=svc2:http"
```
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": "--outp... |
Create a deployment named 'jenkins' using the 'postgres' image | Command:
```bash
kubectl create deployment jenkins --image=postgres
```
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|... |
Update the label of the 'analytics' pod to 'status=unhealthy', but only if the resource version is still 1 | Command:
```bash
kubectl label pods analytics status=unhealthy --resource-version=1
```
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", "de... |
Set the cluster field in the my-context context to cluster-beta | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster cluster-beta
```
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 yo... |
View the documentation for the "status.phase" field of the "pods" resource | Command:
```bash
kubectl explain resource=pods.status.phase
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag to disp... |
Create an ingress called 'default-ingress' with a rule that directs requests from site.com/module to svc1:9092, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="site.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": "", "usag... |
Start streaming the logs of the "quantum-quark" container in the "media-stream-pod" pod. | Command:
```bash
kubectl logs -f -c quantum-quark media-stream-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"... |
Create a pod disruption budget named payment-gateway-pdb that selects all pods with the env=production label and ensures a minimum of 9 of them are always available. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=env=production --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-availab... |
Create a new ExternalName service named external-third-party-api-service that points to the external DNS name museum-example.museum | Command:
```bash
kubectl create service externalname external-third-party-api-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 ... |
Forward the local port 3000 to port 9090 in the pod named proxy-server-pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 3000: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 a... |
Create an ingress named 'www-ingress' that routes requests from site.com/input to the service 'svc1' on port 5001, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress www-ingress --rule="site.com/input=svc1:5001,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 an ingress called 'app-gateway-ingress' that directs requests for the path 'testing.com/example' to service 'svc1' on port 8081 | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="testing.com/example=svc1:8081,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Set the custom TLS server name to "staging-cluster" for the "data-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster data-cluster --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] [--certific... |
Update the deployment 'backend-microservice-deployment' by adding a new environment variable named REDIS_HOST with the value of redis-server. | Command:
```bash
kubectl set env deployment/backend-microservice-deployment REDIS_HOST=redis-server
```
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 mor... |
Embed certificate authority data for the prod-cluster cluster entry. | Command:
```bash
kubectl config set-cluster prod-cluster --embed-certs --certificate-authority=~/.kube/data-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... |
Create a job named "certificate-renewal" using the image "node" and run the command "node --version" within the job. | Command:
```bash
kubectl create job certificate-renewal --image=node -- node --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", "short": "-o", "default": "", "usage": "Output... |
List deployments in the "custom-apps" API group, with the output in JSON format and using the "legacy-1.0.0" version. | Command:
```bash
kubectl get deployments.legacy-1.0.0.custom-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 y... |
Forward local port 6379 to pod port 8088 | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 6379: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... |
Create a role binding for multiple users and a group using a specific cluster role | Command:
```bash
kubectl create rolebinding foo --clusterrole=foo --user=user1 --user=user2 --group=group1
```
What it does:
Create a role binding for a particular role or cluster role.
Syntax:
`kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=name... |
Forward the traffic from port 8000 on all addresses to port 8000 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8000: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 ... |
Forward local traffic on port 8888 to port 8081 in the 'mypod' pod | Command:
```bash
kubectl port-forward pod/mypod 8888: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 automaticall... |
Start a pod with custom overrides using a JSON file | Command:
```bash
kubectl run nginx --image=confluentinc/cp-kafka --overrides='{ "apiVersion": "v2.1.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] [--comm... |
Copy the local file /tmp/foo to the remote pod named auth-service-pod-11 in the namespace ingress-nginx, and place it in the /etc/kubernetes directory. | Command:
```bash
kubectl cp /tmp/foo ingress-nginx/auth-service-pod-11:/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... |
Delete the pods and services with the names "auth" and "proxy" | Command:
```bash
kubectl delete pod,service auth proxy
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.