prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/api-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Set the cluster field in the specified context to the provided cluster name | Command:
```bash
kubectl config set contexts.local-context.cluster sun-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 wan... |
Forward traffic from port 5000 on all addresses to port 6379 inside the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 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 criteria, a pod will be sel... |
Forward traffic from local port 6379 to port 8081 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 6379:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Create an ingress resource called 'app2-ingress' with a rule that directs requests from 'foo.com/input' to 'svc1:27017' | Command:
```bash
kubectl create ingress app2-ingress --rule="foo.com/input=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": "", "usage": ... |
Start a hazelcast pod with the hazelcast/hazelcast image and expose port 9090 | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=9090
```
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:... |
Create a new secret with keys for each file in a specific folder | Command:
```bash
kubectl create secret generic gcp-service-account-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... |
Execute the 'wp' command inside the container of the pod named gateway-pod and display the output | Command:
```bash
kubectl exec gateway-pod -- wp
```
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.kubernetes... |
Copy the content of the local file "/var/run/secrets/kubernetes.io/serviceaccount/" to the "/tmp/bar_dir" directory in the pod named "logging-agent-pod-7" in the "default" namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ default/logging-agent-pod-7:/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": "... |
Auto scale the deployment "proxy-server" with a minimum of 3 pods and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment proxy-server --min=3 --max=13
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that... |
Import the 'database_url' key from the 'ui-config' config map into the 'user-management-deployment' deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/ui-config deployment/user-management-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Add a taint with the key 'zone' and value 'db-node-7:PreferNoSchedule' on nodes that have the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice zone=db-node-7: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":... |
Copy the contents of the /var/run/secrets/kubernetes.io/serviceaccount/ directory from the remote pod named 'database-pod-2' to the local directory /tmp/bar_dir | Command:
```bash
kubectl cp kube-proxy/database-pod-2:/var/run/secrets/kubernetes.io/serviceaccount/ /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": "Co... |
Create a new ExternalName service named external-logging-service that points to the hostname `placeholder-app.app` | Command:
```bash
kubectl create service externalname external-logging-service --external-name placeholder-app.app
```
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 ... |
create a secret named ssl-key-secret from an environment file | Command:
```bash
kubectl create secret generic ssl-key-secret --from-env-file=path/to/options.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basena... |
Forward traffic from port 5000 on all addresses to port 9090 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 5000: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... |
Forward traffic from port 8000 on localhost and IP address 10.19.21.23 to port 8888 in the pod named "chat-app-pod". | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 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 criter... |
Create an ingress named 'app-proxy-ingress' with a rule that directs requests from testing.com/module to the service 'svc1:3001' and uses the tls secret 'my-cert' | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/module=svc1:3001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Create a new config map named 'app-config-dev' using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/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 c... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/api-config deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Set the CPU limits of the golang container to "5" and the memory limits to "64Mi" in the deployment. | Command:
```bash
kubectl set resources deployment golang -c=nginx --limits=cpu=5,memory=64Mi
```
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 it... |
Create a new job called log-processing-job with the jenkins image and run the command "jenkins --version" inside the job. | Command:
```bash
kubectl create job log-processing-job --image=jenkins -- jenkins --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": "O... |
create a deployment called "worker" using the "ubuntu" image. | Command:
```bash
kubectl create deployment worker --image=ubuntu -- docker run -it ubuntu
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output form... |
Run the 'wp' command in the time-machine container of the vpn-service-pod pod and retrieve the output | Command:
```bash
kubectl exec vpn-service-pod -c time-machine -- wp
```
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 th... |
Create a deployment named "jenkins" that runs the "nginx" image and exposes port 8181. | Command:
```bash
kubectl create deployment jenkins --image=nginx --port=8181
```
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... |
Forward the local port 8088 to the pod frontend-pod's port 8000 | Command:
```bash
kubectl port-forward pod/frontend-pod 8088:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=database_url --from=configmap/env-vars 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 definit... |
Retrieve the details of the following resources: | Command:
```bash
kubectl get rc/web service/analytics-rc pods/monitoring-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 namespace... |
Create a cron job named 'alerts-cleanup' that will run the 'mysql' command every minute using the 'mysql' image | Command:
```bash
kubectl create cronjob alerts-cleanup --image=mysql --schedule="*/1 * * * *" -- mysql
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "de... |
Start a php pod and expose port 3306 | Command:
```bash
kubectl run hazelcast --image=php --port=3306
```
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": "--file... |
import the 'log_level' key from the 'app-settings' config map and set it as an environment variable in the 'search-engine-deployment' deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-settings 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 definitio... |
Import the specific key "api_key" from the config map "env-vars" into the deployment "email-server-deployment" | Command:
```bash
kubectl set env --keys=api_key --from=configmap/env-vars deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Create a copy of the monitoring-pod named "my-debugger", adding a debug container with the debian image and changing the container images to "my-scheduler:1.0" for the scheduler container and "nginx:latest" for the web container | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=my-debugger --image=debian --set-image=scheduler=my-scheduler:1.0,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Set the service account of the `order-processing-deployment` deployment to `kube-scheduler` | Command:
```bash
kubectl set serviceaccount deployment order-processing-deployment kube-scheduler
```
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
Syn... |
List the resource(s) by their type and names. | Command:
```bash
kubectl get rc/web service/vpn-service-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 namesp... |
Update the deployment 'frontend-deployment' by adding a new environment variable with the key 'GOOGLE_API_KEY' and the corresponding value being your Google API key. | Command:
```bash
kubectl set env deployment/frontend-deployment GOOGLE_API_KEY=your-google-api-key
```
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... |
Forward local port 8000 to port 3000 in the pod named 'proxy-server-pod' | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8000: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 a... |
Forward local port 6379 to port 8080 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod 6379 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 automa... |
Get the output from running the 'redis-server' command in the nano-bot container from the media-stream-pod pod. | Command:
```bash
kubectl exec media-stream-pod -c nano-bot -- redis-server
```
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,... |
Create a role named "reader" with API Group specified to allow creating, listing, and deleting persistent volumes. | Command:
```bash
kubectl create role reader --verb=create,list,delete --resource=persistentvolumes.storage.k8s.io
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpfu... |
Import environment variables from a config map with a specified prefix for a deployment. | Command:
```bash
kubectl set env --from=configmap/api-config --prefix=MYSQL_ deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Start streaming the logs of the 'rocket-ranger' container in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl logs -f -c rocket-ranger log-aggregator-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... |
Begin streaming logs of the specified container in the given pod | Command:
```bash
kubectl logs -f -c rocket-ranger 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",... |
Set the service account of the gateway-deployment deployment to gitlab-runner | Command:
```bash
kubectl set serviceaccount deployment gateway-deployment gitlab-runner
```
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... |
Copy the file "/tmp/foo" from the remote pod "web-app-pod-1" in the namespace "rook-ceph" to the local directory "/etc/kubernetes". | Command:
```bash
kubectl cp rook-ceph/web-app-pod-1::/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 ku... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Create a cron job named "cleanup-task" that runs the command "kafka-console-producer --broker-list localhost:9092 --topic test" every minute using the image "confluentinc/cp-kafka". | Command:
```bash
kubectl create cronjob cleanup-task --image=confluentinc/cp-kafka --schedule="*/1 * * * *" -- kafka-console-producer --broker-list localhost:9092 --topic test
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [C... |
Add a taint with key 'environment' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta environment=gpu-node-12: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 copy of the "proxy-server-pod" with a debug container, changing the container images to "debian", and setting specific images for the "worker" and "scheduler" containers. | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=dgb-img --image=debian --set-image=worker=my-custom-worker:1.2.3,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identifi... |
Dump the current state of the cluster and save it to the specified directory | Command:
```bash
kubectl cluster-info dump --output-directory=/path/to/cluster-state
```
What it does:
Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you specify a director... |
Start a pod named 'hazelcast' using the ethereum/client-go image and expose port 9090 | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --port=9090
```
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:
... |
Edit the 'order-processing-deployment' deployment in YAML format and save the modified configuration in its annotation by running the command 'kubectl edit deployment/order-processing-deployment -o yaml --save-config'. | Command:
```bash
kubectl edit deployment/order-processing-deployment -o yaml --save-config
```
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... |
Set a custom TLS server name for the cloud-cluster cluster entry | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=moon-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... |
Forward local port 8088 to port 9090 in a pod selected by the deployment email-server-deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8088 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... |
Update node 'edge-node-10' with a taint specifying key 'hardware', value 'gpu', and effect 'NoExecute' | Command:
```bash
kubectl taint nodes edge-node-10 hardware=gpu:NoExecute
```
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 ... |
Copy the file "/tmp/foo" from the remote pod "load-balancer-pod-9" to the local directory "/etc/kubernetes". | Command:
```bash
kubectl cp cert-manager/load-balancer-pod-9::/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, u... |
Create a pod disruption budget named worker-pdb that will select all pods with the app=nginx label and require at least 70% of the selected pods to be available at any time. | Command:
```bash
kubectl create pdb worker-pdb --selector=app=nginx --min-available=70%
```
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-run=server|clien... |
Embed the certificate authority data for the "dev-cluster" cluster by using the provided certificate authority file. | Command:
```bash
kubectl config set-cluster dev-cluster --embed-certs --certificate-authority=~/.kube/cluster-beta/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-... |
Set the cpu limits of the postgres container in the deployment called "postgres" to "10" and the memory limits to "4Gi" | Command:
```bash
kubectl set resources deployment postgres -c=nginx --limits=cpu=10,memory=4Gi
```
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 ... |
Get output from running the 'postgres' command in the pod named api-service-pod | Command:
```bash
kubectl exec api-service-pod -- 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 the kubectl.... |
Set the label 'env' to 'staging' for the pod 'security' | Command:
```bash
kubectl label pods security env=staging
```
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": "... |
Create a job named "report-generation-job" with the image "golang" and a command to run "go". | Command:
```bash
kubectl create job report-generation-job --image=golang -- go
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format.... |
Start the ethereum/client-go pod with a different command and custom arguments by running the nginx pod with the image ethereum/client-go using the specified command and arguments. | Command:
```bash
kubectl run nginx --image=ethereum/client-go --command -- <cmd> <arg1> ... <argN>
```
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.... |
Listen on the local ports 8000 and 6000 and forward data to/from ports 3000 and 6000 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 8000 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 automa... |
Apply the configuration in the manifest.yaml file that has the label region=eu-west-2, and delete any other resources that are not in the file and also have the label app=nginx | Command:
```bash
kubectl apply --prune -f manifest.yaml -l region=eu-west-2
```
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' o... |
Create a service for the hazelcast deployment, which serves on port 9000 and connects to the containers on port 700000. | Command:
```bash
kubectl expose deployment hazelcast --port=9000 --target-port=700000
```
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... |
Forward port 3000 on all addresses to port 9090 in the backend-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-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 ... |
Forward the local port 8081 to port 3000 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-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... |
Copy the local file /tmp/foo_dir to the remote pod web-app-pod-1 in the /tmp/bar directory, specifically within the worker-container container. | Command:
```bash
kubectl cp /tmp/foo_dir web-app-pod-1::/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... |
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=conf=/path/to/data/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 config map... |
Get the output from running the 'nginx -t' command in the first pod of the 'scheduler-service' service, using the first container as default. | Command:
```bash
kubectl exec svc/scheduler-service -- nginx -t
```
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 ku... |
Forward port 8000 on localhost and IP 10.19.21.23 to port 5000 in the pod named web-app-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-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 criteri... |
Forward local port 6379 to port 5432 in the pod named "mypod" and listen for incoming connections. | Command:
```bash
kubectl port-forward pod/mypod 6379: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 automaticall... |
Scale the replication controller "web" to automatically create or remove pods based on the CPU utilization, with a maximum of 3 pods and a target CPU utilization of 81%. | Command:
```bash
kubectl autoscale rc web --max=3 --cpu-percent=81
```
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 the... |
Expose a replicated centos container as a service, with the service serving on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose rc centos --port=8000 --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 specified port.... |
Forward local port 8081 to the targetPort of the "https" service port in a selected pod. | Command:
```bash
kubectl port-forward service/order-service 8081: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... |
Create a deployment named 'proxy' with the image 'redis' and a command 'redis-cli' | Command:
```bash
kubectl create deployment proxy --image=redis -- redis-cli
```
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: js... |
Create a job named "database-seeding-job" using the "mongo" container image and execute the "mongo" command within the job. | Command:
```bash
kubectl create job database-seeding-job --image=mongo -- mongo
```
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... |
Set the client-key field on the cloud-user entry to the value of ~/.kube/admin.key, without changing any other values | Command:
```bash
kubectl config set-credentials cloud-user --client-key=~/.kube/admin.key
```
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
Bearer token ... |
Create a new ExternalName service named external-analytics-service with the external name set to "bar.com" | Command:
```bash
kubectl create service externalname external-analytics-service --external-name bar.com
```
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 services t... |
Create a copy of a pod with a debug container and change container images | Command:
```bash
kubectl debug mypod -it --copy-to=debug-image-api --image=debian --set-image=scheduler=my-scheduler:1.0,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by re... |
Open the 'backend-service' service for editing using vim as the editor | Command:
```bash
KUBE_EDITOR="vim" kubectl edit svc/backend-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables,... |
Create a service for a replication controller using the configuration specified in the "centos-controller.yaml" file | Command:
```bash
kubectl expose -f centos-controller.yaml --port=8089 --target-port=300000
```
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... |
Run the 'go' command in the 'proxy-server-pod' pod, using the first container | Command:
```bash
kubectl exec proxy-server-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... |
Create an ingress named 'www-ingress' with a rule that directs requests to foo.com/input to svc1:8000 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress www-ingress --rule="foo.com/input=svc1:8000,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": "O... |
Create a cluster role named "foo" with the ability to create pods and access specific resources named "auth-service" and "cache-redis" | Command:
```bash
kubectl create clusterrole foo --verb=create --resource=pods --resource-name=auth-service --resource-name=cache-redis
```
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]`
... |
Import the 'CONFIG_FILE_PATH' key from the 'log-config' config map to the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/log-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Set a custom TLS server name for validation of the star-cluster cluster entry. | Command:
```bash
kubectl config set-cluster star-cluster --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] [--certificat... |
Include the certificate authority data in the sun-cluster cluster entry by running the command: | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/star-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-... |
Get the output from running the 'dotnet' command in the first container of the first pod in the 'notification-service' service. | Command:
```bash
kubectl exec svc/notification-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 k... |
View the last-applied-configuration annotations of the alpine deployment in YAML format | Command:
```bash
kubectl apply view-last-applied deployment/alpine
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-applied... |
List the replication controller named 'web', the service named 'proxy-service-rc', and the pod named 'security-service-pod' | Command:
```bash
kubectl get rc/web service/proxy-service-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... |
List deployments in the "rc-1.1.0" version of the "custom-deployments" API group in YAML format | Command:
```bash
kubectl get deployments.rc-1.1.0.custom-deployments -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 namespace... |
Create a deployment named wordpress with the mcr.microsoft.com/dotnet/core/runtime image and 4 replicas | Command:
```bash
kubectl create deployment wordpress --image=mcr.microsoft.com/dotnet/core/runtime --replicas=4
```
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": "",... |
Create a copy of the backend-pod in an interactive mode, adding a debug container with the image debian and changing the images of the existing containers to logger=logging-app:debug and web=nginx:latest. | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-memcached --image=debian --set-image=logger=logging-app:debug,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by ... |
Create a new secret named git-credentials-secret using the configurations defined in the path/to/configurations.env file | Command:
```bash
kubectl create secret generic git-credentials-secret --from-env-file=path/to/configurations.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will defaul... |
Start a pod with the image postgres, but provide a partial set of values parsed from a JSON file as an override for the pod's spec | Command:
```bash
kubectl run nginx --image=postgres --overrides='{ "apiVersion": "legacy-1.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] --... |
Create a copy of the 'proxy-server-pod' adding a debug container | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=debug-image-memcached --image=debian --set-image=proxy=nginx:1.21,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 r... |
Configure the replication controller "backend" to automatically scale the number of pods between 1 and 2 based on CPU utilization, with a target CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc backend --max=2 --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 uses... |
Update the environment variables of the specified deployment by importing specific keys from a config map. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/namespace-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 variable de... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.