prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new secret named azure-storage-secret with keys for each file in folder bar | Command:
```bash
kubectl create secret generic azure-storage-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 base... |
List the replication controller 'web', service 'api-service-rc', and pods 'auth-service-pod' | Command:
```bash
kubectl get rc/web service/api-service-rc pods/auth-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 names... |
Create an ingress called 'api-v2-ingress' with a rule that directs requests from foo.com/example to svc1:8010 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v2-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": "", "usage... |
Forward local port 5432 to port 6379 in the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5432: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... |
Listen on port 5000 on all addresses and forward to port 8888 in the pod named 'proxy-server-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 5000: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 ... |
Set a custom TLS server name for validation for the cluster-gamma cluster entry | Command:
```bash
kubectl config set-cluster cluster-gamma --tls-server-name=on-prem-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] [--certifi... |
Create a secret named 'jwt-secret' and include keys for each file inside the 'path/to/parameters' folder | Command:
```bash
kubectl create secret generic jwt-secret --from-file=path/to/parameters
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of the... |
Create a pod disruption budget named "payment-gateway-pdb" where at least one pod with the label "env=production" must be available at all times | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=env=production --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-availab... |
Copy a file from a remote pod to a local directory | Command:
```bash
kubectl cp logging/monitoring-agent-pod-6::/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 k... |
Add the annotation "scaling-policy=auto-horizontal-scaling" to the pod defined in the "preferences.json" file | Command:
```bash
kubectl annotate -f preferences.json scaling-policy=auto-horizontal-scaling
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than lab... |
Set a custom TLS server name to use for validation when accessing the "cluster-alpha" cluster | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=sun-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] [--certificate... |
Execute the command 'elasticsearch --version' in the nano-bot container of the mypod pod. | Command:
```bash
kubectl exec mypod -c nano-bot -- 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 name. If omitted,... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config-dev 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 defini... |
Apply the configuration from a JSON file to a pod | Command:
```bash
kubectl apply -f ./params.json
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
JS... |
Remove the 'env' label from the 'proxy' pod | Command:
```bash
kubectl label pods proxy env-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true, c... |
Create a pod disruption budget named elastic-search-pdb that ensures a minimum of four frontend pods are always available. | Command:
```bash
kubectl create poddisruptionbudget elastic-search-pdb --selector=tier=frontend --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available... |
Forward local port to a port in a pod selected by a deployment | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 6379 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Embed the certificate authority data for the 'dev-cluster' cluster entry, using the certificate authority file at '~/.kube/web-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster dev-cluster --embed-certs --certificate-authority=~/.kube/web-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-c... |
Get the output from running the 'nginx' command in the 'mycontainer' container from the 'auth-service-pod' pod | Command:
```bash
kubectl exec auth-service-pod -c mycontainer -- nginx
```
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... |
Run the 'mongo --version' command in the database-pod and print the output | Command:
```bash
kubectl exec database-pod -- mongo --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kube... |
Create a cron job named 'database-maintenance' using the 'mysql' image and schedule it to run every minute | Command:
```bash
kubectl create cronjob database-maintenance --image=mysql --schedule="*/1 * * * *" -- mysqld
```
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": "-... |
Begin streaming the logs of the quantum-quark container in the e-commerce-pod pod | Command:
```bash
kubectl logs -f -c quantum-quark e-commerce-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", ... |
Add a taint on nodes with a specific label | Command:
```bash
kubectl taint node -l release=beta zone=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Create an ingress named 'app2-ingress' that routes requests from foo.com/bar to svc1:8084, using the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress app2-ingress --rule="foo.com/bar=svc1:8084,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": "Ou... |
Run the 'postgres' command in the 'warp-drive' container of the 'monitoring-pod' pod and display the output | Command:
```bash
kubectl exec monitoring-pod -c warp-drive -- postgres
```
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 all taints with key 'app' from the 'worker-node-3' node. | Command:
```bash
kubectl taint nodes worker-node-3 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|nam... |
Create a job with a specific command | Command:
```bash
kubectl create job deployment-rollout-job --image=jenkins -- jenkins-plugin-cli
```
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 an ingress called 'private-ingress' with a rule that directs requests to site.com/bar to svc1 on port 5432, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="site.com/bar=svc1:5432,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":... |
Scale the 'backend-service-replicaset' deployment to 3 replicas, given that its current size is 5. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=3 deployment/backend-service-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --r... |
Forward local port 8000 to port 9090 inside the 'mypod' pod. | Command:
```bash
kubectl port-forward pod/mypod 8000: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 automaticall... |
Delete a pod using the configuration specified in a JSON file | Command:
```bash
kubectl delete -f ./parameters.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 r... |
Create a single ingress called 'app-gateway-ingress' that directs requests to site.com/example to the service called svc1 on port 3306, and use the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="site.com/example=svc1:3306,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
View metrics for pods in a specific namespace. | Command:
```bash
kubectl top pod --namespace=external-dns-service
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl t... |
Create a new secret named ldap-credentials-secret using the files in the 'path/to/properties' folder. | Command:
```bash
kubectl create secret generic ldap-credentials-secret --from-file=path/to/properties
```
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 ba... |
Listen on port 8080 locally, forwarding to the targetPort of the "https" service port in a pod selected by the "backend-service" service. | Command:
```bash
kubectl port-forward service/backend-service 8080:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Execute the 'psql' command in the 'cosmic-container' from the pod 'chat-app-pod' and get the output. | Command:
```bash
kubectl exec chat-app-pod -c cosmic-container -- psql
```
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... |
Forward port 5000 on localhost and IP 10.19.21.23 to port 8088 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-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 cri... |
Set the certificate-authority-data field on the 'dev-cluster' cluster to the provided certificate data string. | Command:
```bash
kubectl config set clusters.dev-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
```
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 d... |
Return the snapshot logs from container 'vpn-service-pod-1' of the 'database-deployment' deployment | Command:
```bash
kubectl logs deployment/database-deployment -c vpn-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 flags:
"flag"... |
Create a deployment named 'ingress' with the specified image and expose port 8081 | Command:
```bash
kubectl create deployment ingress --image=mcr.microsoft.com/dotnet/core/runtime --port=8081
```
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": "", "u... |
Add a taint with the key 'datacenter' on nodes that have the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice 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": "... |
Create a cluster role named "view" with ResourceName specified | Command:
```bash
kubectl create clusterrole view --verb=exec --resource=pods --resource-name=mail-server --resource-name=file-processing
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]... |
Create an ingress called 'app2-ingress' that routes requests from testing.com/module to svc1:9092 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.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... |
Approve Certificate Signing Request (CSR) for 'csr-elastic-9' | Command:
```bash
kubectl certificate approve csr-elastic-9
```
What it does:
Approve a certificate signing request.
kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the attr... |
Output the modified deployment in YAML format without applying the changes to the actual deployment object on the server. | Command:
```bash
kubectl set env deployment/load-balancer-deployment CACHE_SIZE=64MB -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 one or more pod t... |
Retrieve the output from running the command 'geth attach' in the 'time-machine' container of the 'vpn-service-pod' pod. | Command:
```bash
kubectl exec vpn-service-pod -c time-machine -- geth attach
```
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... |
Execute the 'mongo' command in the cyber-sleuth container of the backend-pod and view the output. | Command:
```bash
kubectl exec backend-pod -c cyber-sleuth -- mongo
```
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... |
Copy the local file /tmp/foo to the remote pod cache-pod-5, specifically to the container worker-container at the path /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo cache-pod-5::/tmp/bar -c worker-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 omitted, use the k... |
Import the environment variables with the prefix MYSQL_ from the config map named ui-config into the load-balancer-deployment. | Command:
```bash
kubectl set env --from=configmap/ui-config --prefix=MYSQL_ deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Create an ingress named 'private-ingress' that routes requests from foo.com/module to svc1:8083 with a TLS secret called "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="foo.com/module=svc1:8083,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Create a deployment named 'monitoring' that runs the 'hazelcast' image and exposes port 5000 | Command:
```bash
kubectl create deployment monitoring --image=hazelcast/hazelcast --port=5000
```
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 ... |
Get output from running the 'mysql' command in container 'quantum-quark' from pod 'frontend-pod' | Command:
```bash
kubectl exec frontend-pod -c quantum-quark -- mysql
```
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... |
Retrieve the information for the replication controller 'web', the service 'monitoring-rc', and the pod 'security-service-pod' | Command:
```bash
kubectl get rc/web service/monitoring-rc pods/security-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 na... |
Create a deployment named my-dep using the centos image and expose port 8000. | Command:
```bash
kubectl create deployment my-dep --image=centos --port=8000
```
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... |
Import the 'my-example-key' keys from the 'app-config-dev' config map and set them as environment variables in the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-config-dev 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 definiti... |
Run a command using `dotnet` in the first container of the `logging-service` service. | Command:
```bash
kubectl exec svc/logging-service -- dotnet
```
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 kubect... |
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=conf=/path/to/configs/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 creating a co... |
Update the 'cdn' pod with the annotation 'custom-label' and set its value to 'my-custom-value' | Command:
```bash
kubectl annotate pods cdn custom-label=my-custom-value
```
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 arbit... |
Set the custom TLS server name to 'web-cluster' for the 'cloud-cluster' cluster entry | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=web-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] [--certificate... |
Create a new ExternalName service named external-caching-service with an external name set to documentation-tech.tech | Command:
```bash
kubectl create service externalname external-caching-service --external-name documentation-tech.tech
```
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 refere... |
Attach to the quantum-quark container in the e-commerce-pod pod to get output | Command:
```bash
kubectl attach e-commerce-pod -c quantum-quark
```
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,... |
Create a new config map named ui-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=settings=/path/to/profiles/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 creating a ... |
import the DEBUG_MODE key from the app-config-dev config map and set it as an environment variable for the frontend-deployment deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-config-dev deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
create a ClusterIP service named auth-service-clusterip with a TCP port forwarding from port 3001 to port 6379 | Command:
```bash
kubectl create service clusterip auth-service-clusterip --tcp=3001:6379
```
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", "... |
create a cron job with a command "nginx -g daemon off;" with a schedule of running every minute | Command:
```bash
kubectl create cronjob cron-task --image=nginx --schedule="*/1 * * * *" -- nginx -g "daemon off;"
```
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 the label 'region=eu-west-2' and the key 'app' with the value 'edge-node-10' and the effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l region=eu-west-2 app=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Configure auto scaling for the replication controller "chat-app" with a target CPU utilization of 50% and a minimum of 1 pod and a maximum of 8 pods. | Command:
```bash
kubectl autoscale rc chat-app --max=8 --cpu-percent=50
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
Create a new config map named api-config by reading environment variables from a file | Command:
```bash
kubectl create configmap api-config --from-env-file=path/to/options.env
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the bas... |
Switch to raw terminal mode and attach to the 'rocket-ranger' container in the 'vpn-service-pod' pod. | Command:
```bash
kubectl attach vpn-service-pod -c rocket-ranger -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 o... |
List deployments in the JSON output format for the "feature-branch-2.3.0" version of the "legacy-apps" API group. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.legacy-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 name... |
Create a pod disruption budget named elastic-search-pdb that selects all pods with the env=production label, and requires a minimum of one of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget elastic-search-pdb --selector=env=production --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-availabl... |
Create a new ExternalName service named external-monitoring-service with the external name "illustration-shop.shop" | Command:
```bash
kubectl create service externalname external-monitoring-service --external-name illustration-shop.shop
```
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 refe... |
Add a taint with the key 'environment' and value 'app-node-6:PreferNoSchedule' on nodes that have the label 'role=database' | Command:
```bash
kubectl taint node -l role=database environment=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":... |
Create a pod disruption budget named logging-pdb that will select all pods with the release=1.0.0 label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=release=1.0.0 --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... |
Execute the command 'kafka-server-start /etc/kafka/server.properties' in the 'stardust-shuttle' container of the 'log-aggregator-pod' pod and print the output. | Command:
```bash
kubectl exec log-aggregator-pod -c stardust-shuttle -- 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", "defaul... |
Forward incoming traffic on local port 9090 to the targetPort of the "https" service port in a selected pod named "order-service" | Command:
```bash
kubectl port-forward service/order-service 9090:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Embed the certificate authority data for the "cluster-alpha" cluster entry | Command:
```bash
kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/staging-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config... |
List deployments in YAML output format for the "hotfix-1.1.2" version of the "testing-apps" API group. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.testing-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 ... |
Delete the pods and services named "vpn" and "analytics" | Command:
```bash
kubectl delete pod,service vpn analytics
```
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.
S... |
Copy the file ~/.config/kube from the remote pod "ingress-nginx/auth-service-pod-11" to the local directory /tmp/bar | Command:
```bash
kubectl cp ingress-nginx/auth-service-pod-11:~/.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, us... |
Import the max_connections key from the app-settings config map into the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-settings 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 ... |
Get detailed information about the pods with the label tier=frontend. | Command:
```bash
kubectl describe po -l tier=frontend
```
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 objects of that type, provide... |
Forward port 6379 locally to port 8088 in the 'chat-app-pod' pod | Command:
```bash
kubectl port-forward pod/chat-app-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 autom... |
Embed the certificate authority data for the 'galaxy-cluster' cluster entry by executing the command 'kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/web-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/web-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 se... |
Copy the service account secrets from a remote pod to a local directory | Command:
```bash
kubectl cp kube-public/database-pod-2:/var/run/secrets/kubernetes.io/serviceaccount/ /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage":... |
Set the cluster field in the 'staging-context' context to 'web-cluster'. | Command:
```bash
kubectl config set contexts.staging-context.cluster web-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 w... |
Add a taint with key 'zone' on nodes having label namespace=mynamespace | Command:
```bash
kubectl taint node -l namespace=mynamespace zone=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Set environment variables from specified keys in a config map | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/namespace-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 definition... |
Forward traffic from your local machine's port 8080 to port 6379 in the pod named "api-service-pod". | Command:
```bash
kubectl port-forward pod/api-service-pod 8080: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... |
Forward local port 6379 to port 3000 in a pod selected by the authentication-service-deployment deployment | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 6379 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, ... |
Create a debug version of the media-stream-pod by adding a debug container and changing the container images. | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-app --image=debian --set-image=logger=logging-app:debug,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by... |
Set the cluster field in the user-a-context context to kube-cluster-2 | Command:
```bash
kubectl config set contexts.user-a-context.cluster kube-cluster-2
```
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... |
list the replication controller 'web', the service 'analytics-rc' and the pod 'frontend-pod' | Command:
```bash
kubectl get rc/web service/analytics-rc pods/frontend-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 ... |
Retrieve the replication controller named "web", the service named "security-service-rc", and the pod named "email-service-pod". | Command:
```bash
kubectl get rc/web service/security-service-rc pods/email-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... |
Forward the local port 3000 to port 8080 in the pod named chat-app-pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 3000: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 autom... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/kube-system-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Get the output from running the 'node' command in the first container of the database-service pod | Command:
```bash
kubectl exec svc/database-service -- node
```
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... |
create a service for a replicated python application that serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rc python --port=8443 --target-port=909100
```
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 port 9090 to port 6379 in the pod selected by the deployment named authentication-service-deployment. | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 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, ... |
Add a taint to a node named 'backup-node-14' with the key 'cpu-type' and no value | Command:
```bash
kubectl taint nodes backup-node-14 cpu-type: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 o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.