prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Set the cluster field in the dev-context context to cluster-beta | Command:
```bash
kubectl config set contexts.dev-context.cluster cluster-beta
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you want... |
Create a new secret named password-secret using files from the path/to/parameters folder. | Command:
```bash
kubectl create secret generic password-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 o... |
Create a cron job named 'email-notifications' with the image 'ethereum/client-go', scheduled to run every minute, executing the command 'geth attach' | Command:
```bash
kubectl create cronjob email-notifications --image=ethereum/client-go --schedule="*/1 * * * *" -- geth attach
```
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": "--out... |
Create a service for the replicated ruby controller, serving on port 80 and connecting to the containers on port 8000 | Command:
```bash
kubectl expose rc ruby --port=8000 --target-port=808300
```
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... |
Forward requests from local port 8080 to the target port of the "https" service port in a pod selected by the "monitoring-service" service | Command:
```bash
kubectl port-forward service/monitoring-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 sel... |
Import the "redis_host" key from the "env-vars" config map and set it as an environment variable for the "email-server-deployment" deployment. | Command:
```bash
kubectl set env --keys=redis_host --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 i... |
Create a service for a replication controller called "ruby-controller.yaml" that listens on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8083 --target-port=808100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Update the pod 'media-stream' by setting the annotation 'expiration-date' to '2024-12-31', making sure to overwrite any existing value | Command:
```bash
kubectl annotate --overwrite pods media-stream expiration-date='2024-12-31'
```
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... |
Check if you have permission to list the job named "cleanup-job" in the "kube-public" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cleanup-job -n kube-public
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL th... |
Set a taint with key 'app' on nodes that have the label zone=us-east-1. | Command:
```bash
kubectl taint node -l zone=us-east-1 app=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": "Outpu... |
Import the specific key 'LOG_LEVEL' from the 'monitoring-config' ConfigMap and set it as an environment variable for the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/monitoring-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... |
Create a service for the replicated ruby by exposing the rc ruby on port 8080 and connecting to the containers on port 888800. | Command:
```bash
kubectl expose rc ruby --port=8080 --target-port=888800
```
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... |
Check whether the current user has permission to list the "queue-processing-job" in the "kube-system" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/queue-processing-job -n kube-system
```
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 parti... |
Create an ingress called 'service-ingress' that directs requests to testing.com/example to svc1:3000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="testing.com/example=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Auto scale the replication controller "email" with a target CPU utilization of 50% and number of pods between 1 and 2. | Command:
```bash
kubectl autoscale rc email --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 t... |
Add a taint with the key 'special' to all nodes that have the label 'project=project-alpha' | Command:
```bash
kubectl taint node -l project=project-alpha special=node-2: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":... |
Automatically scale the replication controller "cdn" based on CPU utilization, with the number of pods between 1 and 3. | Command:
```bash
kubectl autoscale rc cdn --max=3 --cpu-percent=40
```
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... |
Copy the local directory `foo_dir` to the remote pod's directory `bar_dir_dir` in the `/tmp` path of the default namespace. | Command:
```bash
kubectl cp :/tmp/foo_dir task-processor-pod-17:/tmp/bar_dir_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Create a job named 'batch-processing' with the image 'docker.elastic.co/elasticsearch/elasticsearch' and the command 'elasticsearch --version' | Command:
```bash
kubectl create job batch-processing --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch --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",... |
Get the output of the 'ruby --version' command from the e-commerce-pod pod. | Command:
```bash
kubectl exec e-commerce-pod -- ruby --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 kub... |
Scale the deployment named "prod-app-rs" to have 7 replicas to match the current size of 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/prod-app-rs
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version... |
Create a service for the 'node' deployment, serving on port 3001 and forwarding traffic to containers on port 8000. | Command:
```bash
kubectl expose deployment node --port=3001 --target-port=8000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified p... |
Create a service for a replication controller based on the configuration specified in "python-controller.yaml", which serves on port 5432 and connects to the containers on port 500000 | Command:
```bash
kubectl expose -f python-controller.yaml --port=5432 --target-port=500000
```
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... |
Create a copy of the web-app-pod and change all container images to wordpress by running the command "kubectl debug web-app-pod --copy-to=debug-image-api --set-image=*=wordpress" | Command:
```bash
kubectl debug web-app-pod --copy-to=debug-image-api --set-image=*=wordpress
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no r... |
Switch to a specific context for the my-k8s-cluster cluster. | Command:
```bash
kubectl config use-context my-k8s-cluster
```
What it does:
Set the current-context in a kubeconfig file.
Syntax:
`kubectl config use-context CONTEXT_NAME` |
Add a taint to the 'k8s-node-1' node with the key 'dedicated', value 'special-user', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes k8s-node-1 dedicated=special-user: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... |
Get the output from running the 'python' command in the 'nebula-navigator' container of the 'cdn-service-pod' pod. | Command:
```bash
kubectl exec cdn-service-pod -c nebula-navigator -- python
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
Create a new ExternalName service named external-monitoring-service with the external name governmental-demo.gov. | Command:
```bash
kubectl create service externalname external-monitoring-service --external-name governmental-demo.gov
```
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 refer... |
Create a service for the hazelcast deployment that serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=9091 --target-port=900000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Import specific keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/log-config deployment/database-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... |
Update the cluster field in the specified context to a new value | Command:
```bash
kubectl config set contexts.cloud-context.cluster edge-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 wa... |
Create a new role named "default_role" with API Group specified | Command:
```bash
kubectl create role default_role --verb=list,create,connect --resource=deployments.apps
```
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]`
Helpful flags:
... |
Set the custom TLS server name "sun-cluster" to use for validation for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --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-authority... |
Get the output of the 'wp' command from the first container of the 'backend-microservice-deployment' deployment. | Command:
```bash
kubectl exec deploy/backend-microservice-deployment -- 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,... |
Delete the pods and services with the names "vpn" and "gateway" | Command:
```bash
kubectl delete pod,service vpn gateway
```
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.
Som... |
Create a pod disruption budget named elastic-search-pdb that will select all pods with the version=v2 label and require a minimum of four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget elastic-search-pdb --selector=version=v2 --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 ... |
Set the resource request and limits for all containers in the Wordpress deployment | Command:
```bash
kubectl set resources deployment wordpress --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=512Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource re... |
Create a new NodePort service named api-service-nodeport, mapping port 7000 on the host to port 8081 on the pod. | Command:
```bash
kubectl create service nodeport api-service-nodeport --tcp=7000:8081
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default":... |
Add a taint with key 'app' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 app=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": "Output... |
Listen on port 8080 on all addresses and forward the traffic to port 9090 in the 'api-service-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8080:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Create a copy of the "proxy-server-pod" by adding a debug container and changing container images | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=debug-image-api --image=debian --set-image=cache=redis:alpine,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource a... |
Scale the deployment named prod-app-rs to match the current size of 5 pods. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=5 deployment/prod-app-rs
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version... |
Copy the local file ~/.config/kube to the remote pod named cache-pod-5 in the namespace logging at the location /etc/kubernetes. | Command:
```bash
kubectl cp ~/.config/kube logging/cache-pod-5:/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 k... |
Import environment variables from the payment-gateway-secret secret and set them for the backend-microservice-deployment deployment | Command:
```bash
kubectl set env --from=secret/payment-gateway-secret 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 definitions ... |
Create a new ClusterIP service named log-service-clusterip, mapping port 8088 on the service to port 5000 on the target | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=8088:5000
```
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... |
Output the modified 'notification-handler-deployment' deployment in YAML format without actually making any changes to the object on the server | Command:
```bash
kubectl set env deployment/notification-handler-deployment SMTP_HOST=smtp.example.com -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... |
Run the 'mysql --version' command inside the pod named analytics-pod and get the output. | Command:
```bash
kubectl exec analytics-pod -- mysql --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 kub... |
Create a job named "report-generation-job" using the golang image and run the command "go run hello.go" within the job | Command:
```bash
kubectl create job report-generation-job --image=golang -- go run hello.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": "O... |
View the details of a specific revision for a daemonset. | Command:
```bash
kubectl rollout history daemonset/namespace-1 --revision=3
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or UR... |
Start port forwarding from port 9090 on all addresses to port 3000 in the pod named 'frontend-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 9090: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... |
Continuously stream the logs of the "nebula-navigator" container in the pod named "vpn-service-pod" | Command:
```bash
kubectl logs -f -c nebula-navigator vpn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--containe... |
Autoscale the deployment "media-stream" with a minimum of 2 pods and a maximum of 13 pods | Command:
```bash
kubectl autoscale deployment media-stream --min=2 --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... |
Create a role named "bar" with the ability to create pods and specifically named "database-master" and "api-server" resources. | Command:
```bash
kubectl create role bar --verb=create --resource=pods --resource-name=database-master --resource-name=api-server
```
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|clien... |
List the 'database-pod' pod in YAML output format. | Command:
```bash
kubectl get -o yaml pod database-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 you will only see res... |
Forward traffic from port 9090 on your localhost and IP address 10.19.21.23 to port 8080 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 9090: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 cri... |
Increase the number of replicas for the "mysql" deployment to 5 | Command:
```bash
kubectl scale --current-replicas=3 --replicas=5 deployment/mysql
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is sp... |
Listen on all addresses for incoming traffic on port 8000 and forward it to port 3000 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 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 sel... |
Import the 'api_key' key from the 'db-config' ConfigMap and set it as an environment variable for the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/db-config 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 ... |
Listen on port 8888 locally, forwarding to the targetPort of the user-service's "https" port in a selected pod. | Command:
```bash
kubectl port-forward service/user-service 8888: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 ... |
Remove the taint, if exists, with key 'disktype' and effect 'NoSchedule' from the node named 'app-node-6' | Command:
```bash
kubectl taint nodes app-node-6 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: ... |
Add the annotation 'env' with the value 'staging' to the pod named 'log-aggregator' | Command:
```bash
kubectl annotate pods log-aggregator env=staging
```
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 s... |
Create a service for the replica set "node" that serves on port 8083 and connects to the containers on port 808800. | Command:
```bash
kubectl expose rs node --port=8083 --target-port=808800
```
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... |
Import the value of the REDIS_HOST key from the app-config-dev ConfigMap and set it as an environment variable for the cache-cluster-deployment deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-config-dev 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 defini... |
Create a new config map named app-config-prod using specified files as the key-value pairs | Command:
```bash
kubectl create configmap app-config-prod --from-file=conf=/path/to/configurations/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 cre... |
Update the nginx container image from a local file without making any changes on the server and print the result in YAML format | Command:
```bash
kubectl set image -f path/to/file.yaml alpine=alpine:3.14 --local -o yaml
```
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), replic... |
Update the annotation 'release-notes' of the pod 'payment' with the value 'https://example.com/release-notes/v2.5.1', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods payment release-notes='https://example.com/release-notes/v2.5.1'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that... |
Create an ingress called 'ingress1' in the default class with multiple hosts and set the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:5432" \
--rule="input.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "... |
Scale the deployment named prod-app-rs to 3 replicas | Command:
```bash
kubectl scale --current-replicas=3 --replicas=3 deployment/prod-app-rs
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version... |
Output the modified 'frontend-deployment' deployment in YAML format, without making any changes to the existing deployment object on the server | Command:
```bash
kubectl set env deployment/frontend-deployment QUEUE_NAME=task-queue -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 ... |
Create a new ClusterIP service named my-cs, with port mapping from local port 8081 to target port 8010 | Command:
```bash
kubectl create service clusterip my-cs --tcp=8081:8010
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Retrieve the output of the 'mongo --version' command from the first container of the 'search-engine-deployment' deployment. | Command:
```bash
kubectl exec deploy/search-engine-deployment -- 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 om... |
Get the replication controller 'web', the service 'cdn-service-rc', and the pod 'log-aggregator-pod' | Command:
```bash
kubectl get rc/web service/cdn-service-rc pods/log-aggregator-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 nam... |
Create a copy of the e-commerce-pod container, changing all container images to hazelcast/hazelcast for debugging purposes | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-1 --set-image=*=hazelcast/hazelcast
```
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 defa... |
Forward traffic from local port 8888 to port 9090 in pod "mypod" | Command:
```bash
kubectl port-forward pod/mypod 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 will be selected automaticall... |
Change the cluster field in the "prod-context" context to "kube-cluster-2" | Command:
```bash
kubectl config set contexts.prod-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 w... |
Execute the 'geth attach' command in the stardust-shuttle container of the backend-pod pod and retrieve the output. | Command:
```bash
kubectl exec backend-pod -c stardust-shuttle -- 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... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-name-config deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Create a new config map named 'app-config-dev' with the 'properties' key sourced from the '/path/to/preferences/file1.txt' file and the 'key1' key sourced from the '/path/to/profiles/file2.txt' file | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/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 cre... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/db-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... |
Add a taint with key 'environment' on nodes having the label role=database | Command:
```bash
kubectl taint node -l role=database 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"... |
Update the label of the pod 'proxy-server' only if the pod is unchanged from version 1 | Command:
```bash
kubectl label pods proxy-server status=unhealthy --resource-version=1
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", ... |
Get the output of the 'jenkins --version' command from the first pod of the deployment 'proxy-service-deployment' | Command:
```bash
kubectl exec deploy/proxy-service-deployment -- 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 pod disruption budget named logging-pdb that will ensure at least one pod with the component=web label is always available. | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=component=web --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... |
Forward traffic from port 8088 on all addresses to port 8081 in the pod named backend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8088: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 ... |
Create a pod disruption budget named statefulset-pdb that will select all pods with the component=web label and require at least 9 of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=component=web --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 ... |
Start a pod running the nginx image and expose port 8084 on the container | Command:
```bash
kubectl run hazelcast --image=nginx --port=8084
```
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": "--fi... |
Retrieve the output of the 'composer --version' command from the pod 'auth-service-pod' using the container 'cyber-sleuth' | Command:
```bash
kubectl exec auth-service-pod -c cyber-sleuth -- composer --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
Set the cluster field in the 'staging-context' context to 'cluster-gamma' | Command:
```bash
kubectl config set contexts.staging-context.cluster cluster-gamma
```
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... |
Expose a service for a replication controller specified in a yaml file, with target port and container port specified | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=9091 --target-port=808100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Remove the taint with key 'workload' and effect 'NoSchedule' from node 'gpu-node-12' if one exists. | Command:
```bash
kubectl taint nodes gpu-node-12 workload:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Create a new ClusterIP service named 'git-service-clusterip' with a TCP port forwarding from local port 8081 to the target port 8010. | Command:
```bash
kubectl create service clusterip git-service-clusterip --tcp=8081:8010
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Expose the php deployment as a service on port 9091, connecting to the containers on port 900000. | Command:
```bash
kubectl expose deployment php --port=9091 --target-port=900000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified ... |
Set the service account of the "payment-processor-deployment" deployment to "flux" | Command:
```bash
kubectl set serviceaccount deployment payment-processor-deployment flux
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kub... |
Forward traffic from local port 6379 to port 3000 in the analytics-pod pod | Command:
```bash
kubectl port-forward pod/analytics-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 criteria, a pod will be selected auto... |
Attach to the log-aggregator pod and switch to raw terminal mode | Command:
```bash
kubectl attach log-aggregator-pod -c quantum-quark -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. I... |
Import the specific keys "debug_mode" from the config map "app-settings" into the deployment "mydeployment" | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/app-settings 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 o... |
create a new config map named kube-system-config, using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap kube-system-config --from-file=settings=/path/to/properties/file1.txt --from-file=key2=/path/to/options/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Configure autoscaling for the "proxy-server" deployment with a minimum of 1 pod and a maximum of 8 pods | Command:
```bash
kubectl autoscale deployment proxy-server --min=1 --max=8
```
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 ... |
Create an ingress named "ingress1" with the following rules: | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="site.com/path*=svc:8084" \
--rule="input.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", ... |
Forward port 8080 from your local machine to port 5000 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 8080:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.