prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Set the cpu limits of the mongo container in the deployment to "500m" and memory limits to "64Mi" | Command:
```bash
kubectl set resources deployment mongo -c=nginx --limits=cpu=500m,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 ... |
Add a taint with the key 'environment' and the value 'gpu-node-12:PreferNoSchedule' on nodes that have the label 'region=eu-west-2'. | Command:
```bash
kubectl taint node -l region=eu-west-2 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": "", "usa... |
Create a new ExternalName service named 'external-authentication-service' that points to the external DNS name 'practice-online.site' | Command:
```bash
kubectl create service externalname external-authentication-service --external-name practice-online.site
```
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 re... |
Copy the ~/.config/kube local file to the /tmp/bar directory inside the api-server-pod-3 pod, specifically in the database-container container. | Command:
```bash
kubectl cp ~/.config/kube api-server-pod-3:/tmp/bar -c database-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 omitte... |
Remove all the taints with the key 'hardware' from the 'prod-node-5' node. | Command:
```bash
kubectl taint nodes prod-node-5 hardware-
```
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|... |
Create a new secret named 'database-secret' using the preferences.env file located at 'path/to/preferences.env' | Command:
```bash
kubectl create secret generic database-secret --from-env-file=path/to/preferences.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 b... |
Start a pod named `hazelcast` with the `alpine` image, and expose port `8080` | Command:
```bash
kubectl run hazelcast --image=alpine --port=8080
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Create a job named "log-collection" using the Jenkins image and run the command "jenkins --version" in the job. | Command:
```bash
kubectl create job log-collection --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": "Outpu... |
Create a deployment named 'app' using the 'amazonlinux' image and expose port 8084 | Command:
```bash
kubectl create deployment app --image=amazonlinux --port=8084
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Create a service for the hazelcast deployment, serving on port 8443 and connecting to the containers on port 700000. | Command:
```bash
kubectl expose deployment hazelcast --port=8443 --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... |
Create a job named "monitoring-job" with the image "node" and run the command "npm --version" | Command:
```bash
kubectl create job monitoring-job --image=node -- npm --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 forma... |
Listen on port 5000 on your local machine and forward the traffic to port 5432 in the 'mypod' pod. | Command:
```bash
kubectl port-forward pod/mypod 5000: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... |
Create a copy of the `cdn-service-pod` and change all container images to `busybox` using the `kubectl debug` command | Command:
```bash
kubectl debug cdn-service-pod --copy-to=my-debugger --set-image=*=busybox
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no res... |
Set environment variables from a specific key in a config map for a deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/db-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 definitions ... |
Get logs from container proxy-server-pod-1 of the deployment user-management-deployment. | Command:
```bash
kubectl logs deployment/user-management-deployment -c proxy-server-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags... |
Create a new ExternalName service named my-ns with the external name travel-sample.travel | Command:
```bash
kubectl create service externalname my-ns --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 reference services that exis... |
Add a taint with key 'special' on nodes having the label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth special=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": "... |
Import the environment variables from the 'api-key-secret' secret and set them for the 'mydeployment' deployment. | Command:
```bash
kubectl set env --from=secret/api-key-secret deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod template... |
Set the cluster field in the testing-context context to staging-cluster | Command:
```bash
kubectl config set contexts.testing-context.cluster staging-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value y... |
Run the command 'kafka-console-producer --broker-list localhost:9092 --topic test' in the 'rocket-ranger' container of the 'payment-gateway-pod' pod and get the output. | Command:
```bash
kubectl exec payment-gateway-pod -c rocket-ranger -- kafka-console-producer --broker-list localhost:9092 --topic test
```
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"... |
Switch to raw terminal mode and attach to the 'cosmic-container' in the 'gateway-pod' pod. | Command:
```bash
kubectl attach gateway-pod -c cosmic-container -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 om... |
Forward port 5432 from all addresses to port 8081 on the pod named cdn-service-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 5432: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 w... |
Check if you have permission to list the job named "security-scan-job" in the "monitoring" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/security-scan-job -n monitoring
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial U... |
Copy the ~/.config/kube local file to :/tmp/bar inside the 'web-app-pod-1' pod in the 'monitoring' namespace | Command:
```bash
kubectl cp ~/.config/kube monitoring/web-app-pod-1::/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 ku... |
Remove all the taints with the key 'special' from the node 'monitoring-node-15' | Command:
```bash
kubectl taint nodes monitoring-node-15 special-
```
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... |
Import environment variables from a secret into a specific deployment | Command:
```bash
kubectl set env --from=secret/api-secret-key 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 one or more pod te... |
Create a centos pod with port 3001 exposed | Command:
```bash
kubectl run hazelcast --image=centos --port=3001
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Create a job named database-seeding-job using the mcr.microsoft.com/dotnet/core/runtime image | Command:
```bash
kubectl create job database-seeding-job --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-runtimes
```
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", "sho... |
Begin streaming the logs of the astro-container container in the frontend-pod pod | Command:
```bash
kubectl logs -f -c astro-container frontend-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", ... |
Create a pod disruption budget named statefulset-pdb that selects all pods with the app=rails label and ensures that at least one of them is always available. | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=app=rails --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-available=N [--d... |
Create a new ClusterIP service named api-service-clusterip that maps port 8084 on the cluster to port 3001 on the service. | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=8084:3001
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Create a deployment named "app" using the Jenkins image and expose port 27017 | Command:
```bash
kubectl create deployment app --image=jenkins --port=27017
```
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 new config map named kube-system-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap kube-system-config --from-file=conf=/path/to/options/file1.txt --from-file=data=/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 creatin... |
Start streaming the logs of the "warp-drive" container in the "security-service-pod" pod. | Command:
```bash
kubectl logs -f -c warp-drive security-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 a copy of the backend-pod named debug-image-app, launching it with interactive mode and attaching a debug container | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-app --image=debian --set-image=logger=logging-app:debug,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 b... |
Create a new config map named app-name-config using specific keys for the provided files | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/settings/file1.txt --from-file=data=/path/to/profiles/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 ... |
Configure autoscaling for the "auth" deployment, allowing the number of pods to scale between 4 and 15 | Command:
```bash
kubectl autoscale deployment auth --min=4 --max=15
```
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 th... |
Create a service for the replication controller specified in the "hazelcast-controller.yaml" file | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=8443 --target-port=637900
```
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 ... |
Embed the certificate authority data for the "cluster-alpha" cluster entry by executing the command: kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/kube-cluster-1/kubernetes.ca.crt | Command:
```bash
kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/kube-cluster-1/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 ... |
Create a pod disruption budget with the name "frontend-pdb" that selects pods with the label "version=v2" and ensures that a minimum of 9 of these pods are available at all times. | Command:
```bash
kubectl create poddisruptionbudget frontend-pdb --selector=version=v2 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry... |
Set the cluster field to star-cluster in the my-context context | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster star-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 y... |
Copy the local file /tmp/foo_dir to the remote pod named payment-gateway-pod-19 in the openfaas namespace, and place it in the /tmp/bar_dir directory. | Command:
```bash
kubectl cp /tmp/foo_dir openfaas/payment-gateway-pod-19:/tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Remove a taint from a specific node | Command:
```bash
kubectl taint nodes storage-node-13 disktype:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One... |
Forward local port 6379 to the pod's port 6379 | Command:
```bash
kubectl port-forward pod/security-service-pod 6379: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 select... |
create a service for a replicated php application on port 80, connecting to containers on port 8000 | Command:
```bash
kubectl expose rc php --port=8010 --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. A ... |
Create a deployment named "monitoring" with the python image, and configure it to expose port 8084. | Command:
```bash
kubectl create deployment monitoring --image=python --port=8084
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One o... |
Switch to raw terminal mode and attach to the 'mycontainer' inside the 'web-app-pod' pod | Command:
```bash
kubectl attach web-app-pod -c mycontainer -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
Create a deployment named gateway with 6 replicas using the python image. | Command:
```bash
kubectl create deployment gateway --image=python --replicas=6
```
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:... |
Forward traffic from port 3000 on all addresses to port 6379 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-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... |
Create a job named 'backup' using the 'ethereum/client-go' image, with the command 'geth attach' | Command:
```bash
kubectl create job backup --image=ethereum/client-go -- geth attach
```
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 an ingress named 'internal-ingress' that routes requests to 'website.com/input' to service 'svc1' on port 9000, with a TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress internal-ingress --rule="website.com/input=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Update the annotation 'criticality' of the pod 'cdn' with the value 'high'. | Command:
```bash
kubectl annotate pods cdn criticality=high
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string ... |
Create a job named "audit-job" with the image "redis" and run the command "redis-server --version" inside the job. | Command:
```bash
kubectl create job audit-job --image=redis -- redis-server --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 ... |
Delete the pods and services named "monitoring" and "database" | Command:
```bash
kubectl delete pod,service monitoring database
```
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 selec... |
Create a copy of the auth-service-pod with the addition of a debug container and changing the container images | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=app=app:debug,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource a... |
Import the 'DATABASE_URL' key from the 'env-vars' config map and set it as an environment variable for the 'scheduler-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/env-vars 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... |
Remove the on-prem-cluster cluster from the kubectl configuration. | Command:
```bash
kubectl config delete-cluster on-prem-cluster
```
What it does:
Delete the specified cluster from the kubeconfig.
Syntax:
`kubectl config delete-cluster NAME` |
Create a role named "foo" with specific resource names | Command:
```bash
kubectl create role foo --verb=proxy --resource=pods --resource-name=app-worker-1 --resource-name=auth-service
```
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|... |
Create an ingress resource called 'app2-ingress' that directs requests from testing.com/example to the service 'svc1' on port 8181 | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/example=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": "", "usa... |
Update node 'dev-node-4' with a taint with key 'environment' and value 'production' and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes dev-node-4 environment=production:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output for... |
Create a new ClusterIP service named 'payment-service-clusterip' and map the container port 9090 to the port 6379 on the service | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=6379:9090
```
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"... |
Set the cluster field in the user-b-context context to galaxy-cluster | Command:
```bash
kubectl config set contexts.user-b-context.cluster galaxy-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... |
Output the modified deployment in YAML format without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/log-aggregator-deployment DB_PASSWORD=secretpassword -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 o... |
Forward traffic from port 8888 on all addresses to port 9090 on the e-commerce-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8888: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 wi... |
Create a deployment called "registry" using the "php" image and expose port 5432. | Command:
```bash
kubectl create deployment registry --image=php --port=5432
```
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... |
Add a taint with the key 'special' on nodes that have the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend special=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": "Ou... |
Delete the pods and services with the names "cdn" and "email" | Command:
```bash
kubectl delete pod,service cdn email
```
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 ... |
Listen on port 8888 on localhost and IP 10.19.21.23, forwarding the traffic to port 3000 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 8888: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 criter... |
Execute the command '/bin/bash -c "echo 'Hello, Amazon Linux'"' in the 'stardust-shuttle' container of the 'log-aggregator-pod' pod and display the output | Command:
```bash
kubectl exec log-aggregator-pod -c stardust-shuttle -- /bin/bash -c "echo 'Hello, Amazon Linux'"
```
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 a new ExternalName service named 'external-git-service' with the external name 'travel-sample.travel' | Command:
```bash
kubectl create service externalname external-git-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 reference ser... |
Create an ingress called 'api-v1-ingress' with the rule that directs requests from foo.com/bar to svc1 on port 8443 | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.com/bar=svc1:8443,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": "... |
List the replication controller "web", service "analytics-rc", and pod "backend-pod". | Command:
```bash
kubectl get rc/web service/analytics-rc pods/backend-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 y... |
Output the modified 'search-engine-deployment' deployment in YAML format and do not make any changes to the deployment on the server | Command:
```bash
kubectl set env deployment/search-engine-deployment JWT_SECRET=your-jwt-secret -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... |
Import the DEBUG_MODE key from the namespace-config config map into the environment variables of the backend-microservice-deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/namespace-config deployment/backend-microservice-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 an ingress called 'api-v2-ingress' with a rule that directs requests from website.com/example to svc1:9000, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v2-ingress --rule="website.com/example=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Forward local port 6379 and IP 10.19.21.23 to port 3000 in the 'cdn-service-pod' pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 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 cri... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/env-vars deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or m... |
Partially update a node's container limit resources by specifying a strategic merge patch in YAML format. | Command:
```bash
kubectl patch node testing-node-11 -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 (... |
Copy the file ~/.config/kube from the 'argocd/auth-service-pod-11' pod to the /etc/kubernetes directory on the local machine | Command:
```bash
kubectl cp argocd/auth-service-pod-11:~/.config/kube /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Approve the Certificate Signing Request (CSR) for 'csr-mongo-13' | Command:
```bash
kubectl certificate approve csr-mongo-13
```
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 attri... |
Create an ingress called 'api-gateway-ingress' that directs requests for 'website.com/example' to 'svc1:8082' with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="website.com/example=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": "... |
Forward all traffic from port 8888 on all addresses to port 8081 in the security-service-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8888:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
create a job named 'monitoring-job' with the image 'node' and execute the command 'node --version' | Command:
```bash
kubectl create job monitoring-job --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 form... |
Get the output from running the 'jenkins --version' command in the time-machine container of the media-stream-pod. | Command:
```bash
kubectl exec media-stream-pod -c time-machine -- jenkins --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... |
Create a cluster role named "view" that has permissions to watch the "services" resource with the specific resource names "blog-backend" and "prod-api-gateway" | Command:
```bash
kubectl create clusterrole view --verb=watch --resource=services --resource-name=blog-backend --resource-name=prod-api-gateway
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|clien... |
Add a taint to the node 'dev-node-4' with the key 'disktype' and no value | Command:
```bash
kubectl taint nodes dev-node-4 disktype:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Create a service for the replicated nginx deployment, which serves on port 3001 and connects to the containers on port 8089 | Command:
```bash
kubectl expose rc nginx --port=3001 --target-port=808900
```
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 traffic from port 8888 on all addresses to port 5432 in the e-commerce-pod pod, using the command "kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8888:5432" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8888: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 wi... |
Import environment variables from a config map with a prefix for a deployment. | Command:
```bash
kubectl set env --from=configmap/app-settings --prefix=MYSQL_ deployment/backend-microservice-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 def... |
Listen for incoming traffic on port 8081 on your local machine and forward it to port 8888 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 8081: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 autom... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/api-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 def... |
Create a new namespace named logging | Command:
```bash
kubectl create namespace logging
```
What it does:
Create a namespace with the specified name.
Syntax:
`kubectl create namespace NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-template|go-templa... |
Listen on port 8088 on all addresses, forwarding to port 6379 in the frontend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8088:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Update the backup strategy of the pod specified in the "conf.json" file to 'daily backups' | Command:
```bash
kubectl annotate -f conf.json backup-strategy='daily backups'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and includ... |
Get the output of the 'pip --version' command running in the stardust-shuttle container of the mypod pod | Command:
```bash
kubectl exec mypod -c stardust-shuttle -- pip --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, u... |
Update the image of all containers in the DaemonSet named prod to 'mongo:5.0.2' | Command:
```bash
kubectl set image daemonset prod *=mongo:5.0.2
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kubectl... |
Start a pod named nginx with the image docker.elastic.co/elasticsearch/elasticsearch, but override the spec with a partial set of values parsed from the JSON provided in the --overrides flag. | Command:
```bash
kubectl run nginx --image=docker.elastic.co/elasticsearch/elasticsearch --overrides='{ "apiVersion": "v1.1.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overri... |
Create a service for a replicated node that serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose rc node --port=80 --target-port=800000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A d... |
Autoscale the deployment "database" with a minimum of 7 pods and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment database --min=7 --max=15
```
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... |
Get the output from running the 'mongo' command inside the first pod of the deployment 'proxy-service-deployment'. | Command:
```bash
kubectl exec deploy/proxy-service-deployment -- 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.