prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new config map named db-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap db-config --from-file=settings=/path/to/configurations/file1.txt --from-file=key2=/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 creat... |
Set the cpu limits of the php container in the nginx deployment to "100m" and the memory limits to "2Gi" | Command:
```bash
kubectl set resources deployment php -c=nginx --limits=cpu=100m,memory=2Gi
```
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 directory /tmp/foo_dir from the remote pod "worker-pod-4" in the "monitoring" namespace to the local directory /tmp/bar. | Command:
```bash
kubectl cp monitoring/worker-pod-4:/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, use the kubect... |
Partially patch the specified node using a strategic merge patch in YAML format. | Command:
```bash
kubectl patch node node-2 -p $'spec:\n containers:\n- name: container-name\n resources:\n limits:\n cpu: 200m'
```
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 FILENA... |
Copy the file /tmp/foo from the pod kubeapps/image-resizer-pod-20 to the local directory /etc/kubernetes | Command:
```bash
kubectl cp kubeapps/image-resizer-pod-20::/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 ... |
Update the pod named 'email' with the annotation 'compliance-level' and set its value to 'PCI-DSS' | Command:
```bash
kubectl annotate pods email 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 arbitra... |
Check if you have permissions to list the "cron-job" job in the "default" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cron-job -n default
```
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 that star... |
Add a taint with the key 'zone' on nodes that have the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 zone=web-node-8: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": "Outp... |
Add a taint with key 'datacenter' on nodes having label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 datacenter=kube-master-9:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Create a pod disruption budget named database-pdb that will select all pods with the owner=team-1 label and require at least four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget database-pdb --selector=owner=team-1 --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--d... |
Create a service to expose the replicated alpine pods, which will serve on port 7000 and connect to the containers on port 801000 | Command:
```bash
kubectl expose rs alpine --port=7000 --target-port=801000
```
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 a job named "certificate-renewal" using the golang image, and execute the command "go version" within the job. | Command:
```bash
kubectl create job certificate-renewal --image=golang -- go 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 f... |
Create a new ExternalName service named external-identity-provider-service with the external name "travel-sample.travel" | Command:
```bash
kubectl create service externalname external-identity-provider-service --external-name travel-sample.travel
```
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... |
Auto scale the deployment named "gateway" with a minimum of 5 pods and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment gateway --min=5 --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... |
Start a pod named "hazelcast" with the image "ruby" and set the labels "app=ruby" and "env=prod" | Command:
```bash
kubectl run hazelcast --image=ruby --labels="app=ruby,env=prod"
```
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 flag... |
Forward traffic from port 8080 on all addresses to port 9090 in the security-service-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8080:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
Set the service account of the 'order-processing-deployment' deployment to 'flux' | Command:
```bash
kubectl set serviceaccount deployment order-processing-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:
`kube... |
Create a copy of the chat-app-pod and name it my-custom-dbg, changing all container images to mongo. | Command:
```bash
kubectl debug chat-app-pod --copy-to=my-custom-dbg --set-image=*=mongo
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resour... |
Create a single ingress called 'api-v1-ingress' that directs requests to website.com/input to svc1:8082 and use the tls secret "my-cert". | Command:
```bash
kubectl create ingress api-v1-ingress --rule="website.com/input=svc1:8082,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Create a cron job named 'weekly-summary' using the Alpine image and set the schedule to run every minute | Command:
```bash
kubectl create cronjob weekly-summary --image=alpine --schedule="*/1 * * * *" -- apk add curl
```
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 to nodes with a specific label | Command:
```bash
kubectl taint node -l service=auth disktype=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Forward traffic from port 8080 on localhost and IP 10.19.21.23 to port 8088 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 8080:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Execute the command 'geth version' inside the 'time-machine' container of the 'vpn-service-pod' pod. | Command:
```bash
kubectl exec vpn-service-pod -c time-machine -- geth 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 omitt... |
Create a service for the replicated ubuntu pods, which serves on port 8888 and connects to the containers on port 300100. | Command:
```bash
kubectl expose rc ubuntu --port=8888 --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.... |
Forward local ports 5432 to port 5000 in a pod selected by the deployment "authentication-service-deployment". | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 5432 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, ... |
Update the annotation "release-notes" of a pod specified in the "settings.json" file. | Command:
```bash
kubectl annotate -f settings.json 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 ... |
Create a debug pod based on log-aggregator-pod with all container images changed to amazonlinux | Command:
```bash
kubectl debug log-aggregator-pod --copy-to=debug-image-memcached --set-image=*=amazonlinux
```
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 ... |
Forward local port 8080 to port 8888 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8080 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 will be selected a... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --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... |
Create a new config map named app-name-config using specified files | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/profiles/file1.txt --from-file=data=/path/to/configs/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 creating a c... |
Create a deployment named 'web' that runs the 'confluentinc/cp-kafka' image with 3 replicas | Command:
```bash
kubectl create deployment web --image=confluentinc/cp-kafka --replicas=3
```
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... |
Create an ingress called 'api-v2-ingress' that directs requests from 'website.com/example' to service 'svc1' running on port 3000 | Command:
```bash
kubectl create ingress api-v2-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": "", "u... |
Set the service account of the deployment named "analytics-platform-deployment" to "istio" | Command:
```bash
kubectl set serviceaccount deployment analytics-platform-deployment istio
```
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:
`k... |
Create a pod disruption budget named elastic-search-pdb that will select all pods with the project=my-project label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget elastic-search-pdb --selector=project=my-project --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-avai... |
Forward local port 8888 to port 8080 in a pod selected by the monitoring-stack-deployment deployment. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8888 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 ... |
Create a ClusterIP service named ldap-service-clusterip | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=8084:8010
```
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", "... |
Copy the file '/tmp/foo' from the remote pod 'metallb-system/logging-agent-pod-7' to the local directory '/etc/kubernetes'. | Command:
```bash
kubectl cp metallb-system/logging-agent-pod-7:/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, ... |
Update the 'gateway' pod by adding or updating the annotation 'monitoring-tool' with the value 'Prometheus', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods gateway monitoring-tool='Prometheus'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels a... |
Forward all traffic from port 8080 on all addresses to port 5000 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-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 ... |
Remove all the taints with key 'app' from the node 'app-node-6' | Command:
```bash
kubectl taint nodes app-node-6 app-
```
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|name|g... |
Partially update a node by specifying the patch in YAML format. | Command:
```bash
kubectl patch node dev-node-4 -p $'spec:\n containers:\n- name: container-name\n resources:\n limits:\n cpu: 200m'
```
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 FI... |
Create a new NodePort service named monitoring-nodeport | Command:
```bash
kubectl create service nodeport monitoring-nodeport --tcp=8080:6379
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Import the MAX_CONNECTIONS key from the global-config config map into the analytics-platform-deployment deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/global-config 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 variab... |
Create a pod disruption budget named web-app-pdb that will select all pods with the tier=frontend label and require a minimum of 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget web-app-pdb --selector=tier=frontend --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 [--d... |
Create a service for the replicated wordpress deployment, which serves on port 5432 and connects to the containers on port 801000. | Command:
```bash
kubectl expose rc wordpress --port=5432 --target-port=801000
```
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... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/namespace-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 ... |
Display the details of the replication controller named 'web', the service named 'web-app-rc', and the pod named 'api-service-pod'. | Command:
```bash
kubectl get rc/web service/web-app-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 namespaced... |
Forward port 5000 on localhost and IP 10.19.21.23 to port 6379 in the backend-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 5000: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 criteri... |
Create an ingress named ingress1 with multiple hosts and the pathType set as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:8181" \
--rule="bar.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": "--output",... |
Create a single ingress called 'app-proxy-ingress' that directs requests to foo.com/module to svc1:3000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="foo.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": "", "usa... |
Create a single ingress called 'app-ingress' that directs requests to 'foo.com/module' to service 'svc1' on port '8181' with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress app-ingress --rule="foo.com/module=svc1:8181,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": "... |
Set the custom TLS server name to 'cluster-alpha' for the 'kube-cluster-1' cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-1 --tls-server-name=cluster-alpha
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certific... |
Describe the details of the security-node-13.secure-cluster.local node | Command:
```bash
kubectl describe nodes security-node-13.secure-cluster.local
```
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 objec... |
Forward traffic from port 8088 on localhost and IP 10.19.21.23 to port 3000 in the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8088:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the ... |
Copy the directory '/tmp/foo_dir' from the 'kube-system/task-processor-pod-17' pod to the local '/tmp/bar' directory. | Command:
```bash
kubectl cp kube-system/task-processor-pod-17:/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, use... |
List deployments in YAML output format for the "v1.1.0" version of the "mobile-apps" API group. | Command:
```bash
kubectl get deployments.v1.1.0.mobile-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you wil... |
Copy the ~/.config/kube local file to the /tmp/bar_dir directory in the front-end-pod-12 pod's front-end-container container. | Command:
```bash
kubectl cp ~/.config/kube front-end-pod-12:/tmp/bar_dir -c front-end-container
```
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 o... |
Return the snapshot logs from the container chat-app-pod-1 of the deployment gateway-deployment | Command:
```bash
kubectl logs deployment/gateway-deployment -c chat-app-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "-... |
Create a new ClusterIP service named git-service-clusterip with port mapping from port 7000 of the service to port 8082 of the target | Command:
```bash
kubectl create service clusterip git-service-clusterip --tcp=7000: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", "d... |
Scale a resource specified in "params.json" to a desired replica count of 5. | Command:
```bash
kubectl scale --replicas=5 -f params.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 validate... |
Check if you have permission to list the job named "load-testing-job" in the "kube-dns" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/load-testing-job -n kube-dns
```
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 ... |
Add a taint with key 'datacenter' on nodes having label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace datacenter=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Import the 'redis_host' key from the 'monitoring-config' config map and set it as an environment variable for the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/monitoring-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 ... |
Forward local port 8081 to the pod's port 8081 | Command:
```bash
kubectl port-forward pod/web-app-pod 8081: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 automa... |
Forward port 5432 on localhost and IP 10.19.21.23 to port 8080 in the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 5432: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 ... |
Run the 'go' command inside the first container of the 'media-stream-pod' pod and get the output | Command:
```bash
kubectl exec media-stream-pod -- go
```
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.kuber... |
Retrieve snapshot logs from the container "payment-processor-deployment-1" of the deployment "security-service-pod". | Command:
```bash
kubectl logs deployment/payment-processor-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... |
Start a PostgreSQL pod named 'hazelcast' with the 'postgres' image and expose port 8089. | Command:
```bash
kubectl run hazelcast --image=postgres --port=8089
```
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": "-... |
Apply a taint with the key 'workload' on nodes that have the label app-type=microservice | Command:
```bash
kubectl taint node -l app-type=microservice workload=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
List the name of the container and the image used in the api-service-pod, with custom columns as "CONTAINER" and "IMAGE". | Command:
```bash
kubectl get pod api-service-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 -... |
Create an ingress with TLS enabled using the default ingress certificate and different path types. | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="foo.com/=svc:https,tls" \
--rule="site.com/path/subpath*=othersvc:8083"
```
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": "--ou... |
Listen on port 8088 on localhost and IP address 10.19.21.23, and forward the traffic to port 8888 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 8088: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 cri... |
Forward local port 3000 to port 6379 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward pod/cdn-service-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 au... |
Create a job named "indexing" using the Node image and run the command "node --version" | Command:
```bash
kubectl create job indexing --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 format. On... |
Start port forwarding from local port 8081 to port 3000 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8081:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Check if you have permission to list the "cleanup-job" job in the "logging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cleanup-job -n logging
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that s... |
View the rollout history of the 'services' deployment. | Command:
```bash
kubectl rollout history deployment/services
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files iden... |
Copy a local file to a remote pod in a specific namespace | Command:
```bash
kubectl cp /tmp/foo_dir kube-server/ingress-controller-pod-8:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Retrieve the output from running the 'geth' command in the 'mycontainer' container of the 'proxy-server-pod' pod | Command:
```bash
kubectl exec proxy-server-pod -c mycontainer -- geth
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Expose the deployment named "centos" as a service, serving on port 9090 and connecting to the containers on port 8080. | Command:
```bash
kubectl expose deployment centos --port=9090 --target-port=808400
```
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 specifi... |
Create a deployment named "ingress" with the image "docker.elastic.co/elasticsearch/elasticsearch" and expose port 3306. | Command:
```bash
kubectl create deployment ingress --image=docker.elastic.co/elasticsearch/elasticsearch --port=3306
```
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"... |
Import specific keys from a config map and set them as environment variables for a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/ui-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... |
Set the custom TLS server name to use as "prod-cluster" for the "cluster-alpha" cluster entry | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=prod-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] [--certificat... |
Import the max_connections key from the app-config-prod config map and set it as an environment variable for the search-engine-deployment deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-config-prod 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 ... |
Forward traffic from port 9090 on localhost and IP address 10.19.21.23 to port 5000 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 9090: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 cr... |
Listen on port 8088 on localhost and IP 10.19.21.23, forwarding traffic to port 5000 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8088:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a p... |
Create a deployment named "jenkins-x" that runs the "node" image. | Command:
```bash
kubectl create deployment jenkins-x --image=node
```
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... |
Create a pod disruption budget named cache-cluster-pdb that selects all pods with the release=1.0.0 label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=release=1.0.0 --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 a new secret named azure-storage-secret using a combination of a file and a literal | Command:
```bash
kubectl create secret generic azure-storage-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
```
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 bas... |
Configure auto scaling for the "email" replication controller with a minimum of 1 pod, maximum of 2 pods, and target CPU utilization at 90%. | Command:
```bash
kubectl autoscale rc email --max=2 --cpu-percent=90
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses t... |
List deployments in YAML output format, specifically in the "feature-branch-2.3.0" version of the "extensions" API group. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.extensions -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is names... |
Create an ingress named ingtls with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="testing.com/=svc:https,tls" \
--rule="website.com/path/subpath*=othersvc:5001"
```
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"... |
Forward the local port 8088 to the pod port 8088 | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8088: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... |
Switch to raw terminal mode and interact with the 'bash' shell in the 'warp-drive' container of the 'auth-service-pod' pod | Command:
```bash
kubectl exec auth-service-pod -c warp-drive -i -t -- bash -il
```
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 omit... |
Start streaming the logs of the 'quantum-quark' container in the 'cdn-service-pod' pod. | Command:
```bash
kubectl logs -f -c quantum-quark cdn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container",... |
Create an ingress called 'api-gateway-ingress' with the following rules: | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="testing.com/bar=svc1:5000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Use the Sublime Text editor to modify the cache-service service. | Command:
```bash
KUBE_EDITOR="sublime" kubectl edit svc/cache-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 variable... |
Execute the command 'kafka-server-start /etc/kafka/server.properties' in the 'lunar-launcher' container of the 'email-service-pod' pod and retrieve the output | Command:
```bash
kubectl exec email-service-pod -c lunar-launcher -- kafka-server-start /etc/kafka/server.properties
```
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":... |
Create an ingress called ingress1 in the default class with two rules | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:3306" \
--rule="bar.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": "--output", "sh... |
Add a taint with key 'dedicated' on nodes having label role=database | Command:
```bash
kubectl taint node -l role=database dedicated=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.