prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the 'redis_host' key from the 'monitoring-config' config map to the environment variables of the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/monitoring-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Delete the pods and services with the names "media-stream" and "web". | Command:
```bash
kubectl delete pod,service media-stream web
```
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... |
Create a service for a WordPress deployment, exposing it on port 9000 and forwarding traffic to the containers on port 909000. | Command:
```bash
kubectl expose deployment wordpress --port=9000 --target-port=909000
```
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... |
Update the image of all containers in a daemonset to 'golang:1.17' | Command:
```bash
kubectl set image daemonset services *=golang:1.17
```
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:
`kub... |
Update the annotation 'custom-label' with the value 'my-custom-value' for the pod 'chat-app', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods chat-app custom-label='my-custom-value'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than label... |
Copy the kube config file from your local machine to a remote pod in the specified namespace. | Command:
```bash
kubectl cp ~/.config/kube monitoring/api-server-pod-3:/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... |
Set the autoscaling configuration for the deployment "cdn" with a minimum of 5 pods and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment cdn --min=5 --max=10
```
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... |
Create an ingress named 'rontend-ingress' that directs incoming requests for 'website.com/bar' to the service 'svc1' running on port 8888, and use the TLS certificate 'my-cert' for secure communication. | Command:
```bash
kubectl create ingress rontend-ingress --rule="website.com/bar=svc1:8888,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Update specific attributes of a node using a strategic merge patch. | Command:
```bash
kubectl patch -f node-settings.json -p '{"data":{"key":"new-value"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Help... |
Apply the configuration in the manifest.yaml file to resources that have the label feature=feature-xyz, and remove any other resources that are not in the file and have the label app=nginx | Command:
```bash
kubectl apply --prune -f manifest.yaml -l feature=feature-xyz
```
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... |
Create an ingress called 'public-service-ingress' that directs requests to website.com/module to a service named 'svc1' on port 6379, and use the TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/module=svc1:6379,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 deployment named "loadbalancer" with the image "docker.elastic.co/elasticsearch/elasticsearch" and expose port 6379. | Command:
```bash
kubectl create deployment loadbalancer --image=docker.elastic.co/elasticsearch/elasticsearch --port=6379
```
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", "def... |
Create a new secret named azure-storage-secret with keys for each file in the folder path/to/configurations. | Command:
```bash
kubectl create secret generic azure-storage-secret --from-file=path/to/configurations
```
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... |
Set the custom TLS server name to "kube-cluster-2" for the "web-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster web-cluster --tls-server-name=kube-cluster-2
```
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... |
Set the custom TLS server name 'edge-cluster' to use for validation for the 'star-cluster' cluster entry. | Command:
```bash
kubectl config set-cluster star-cluster --tls-server-name=edge-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate... |
Create a single ingress called 'api-v1-ingress' with a rule that directs requests from foo.com/module to svc1:5001, and use the tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.com/module=svc1:5001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Create a cron job that runs the "wp" command every minute using the "wordpress" image | Command:
```bash
kubectl create cronjob system-health-check --image=wordpress --schedule="*/1 * * * *" -- wp
```
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... |
Set the service account of the deployment 'search-engine-deployment' to 'tekton' | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment tekton
```
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:
`kubec... |
Embed the certificate authority data for the edge-cluster cluster entry by using the command: kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/kubernetes.ca.crt | Command:
```bash
kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config se... |
Add a taint with the key 'app' and value 'dev-node-4:PreferNoSchedule' on nodes that have the label 'feature=feature-xyz' | Command:
```bash
kubectl taint node -l feature=feature-xyz app=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Forward local traffic from port 8088 to port 8000 in the e-commerce-pod | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
Create a cron job named "alerts-cleanup" that runs every minute and executes the command "pip --version" | Command:
```bash
kubectl create cronjob alerts-cleanup --image=python --schedule="*/1 * * * *" -- pip --version
```
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": ... |
Create a debug copy of a pod called frontend-pod by adding a debug container and changing container images | Command:
```bash
kubectl debug frontend-pod -it --copy-to=my-custom-dbg --image=debian --set-image=api=api:v2,api=api:v2
```
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 wil... |
Forward local ports 8888 and 6000 to ports 8081 and 6000 in the selected pod | Command:
```bash
kubectl port-forward deployment/database-deployment 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 pod will be ... |
Begin streaming the logs of the rocket-ranger container in the mypod pod | Command:
```bash
kubectl logs -f -c rocket-ranger mypod
```
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", "short": ... |
Update the deployment 'search-engine-deployment' with a new environment variable named 'REDIS_HOST' with the value 'redis-server' | Command:
```bash
kubectl set env deployment/search-engine-deployment REDIS_HOST=redis-server
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod t... |
Add the annotation 'compliance-level' with the value 'PCI-DSS' to the pod named 'api' | Command:
```bash
kubectl annotate pods api compliance-level=PCI-DSS
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary... |
Create a pod named 'hazelcast' using the centos image, and expose port 8084 in the pod's container. | Command:
```bash
kubectl run hazelcast --image=centos --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": "--f... |
View the last 43 lines of logs for the security-service-pod | Command:
```bash
kubectl logs --tail=43 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", "sho... |
Import specific keys from a config map to the environment variables of a deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-settings 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 de... |
Forward local port 8080 to port 8888 in the pod "log-aggregator-pod". | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8080 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Retrieve information about the "security-service-rc" replication controller in the default format. | Command:
```bash
kubectl get replicationcontroller security-service-rc
```
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 ... |
Remove the label named 'env' from the 'log-aggregator' pod | Command:
```bash
kubectl label pods log-aggregator env-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "I... |
Create a pod disruption budget named frontend-pdb that selects all pods with the tier=frontend label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget frontend-pdb --selector=tier=frontend --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--... |
Create a new config map named "app-config" from an environment file | Command:
```bash
kubectl create configmap app-config --from-env-file=path/to/configurations.env
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to ... |
Create an ingress called 'public-service-ingress' with a rule that directs requests from 'testing.com/module' to 'svc1:8010' and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/module=svc1:8010,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default":... |
Forward port from local machine to a pod | Command:
```bash
kubectl port-forward pod/web-app-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... |
Update the image of the container named "kubernetes-serve-hostname" in the e-commerce-pod pod | Command:
```bash
kubectl patch pod e-commerce-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILEN... |
Set the CPU limits to "2" and memory limits to "64Mi" for the hazelcast container in the deployment named "hazelcast". | Command:
```bash
kubectl set resources deployment hazelcast -c=nginx --limits=cpu=2,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... |
Forward traffic from port 5432 on all addresses to port 3000 in the pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 5432: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 w... |
Update the pod 'foo' by adding an annotation 'alert-email' with the value 'alerts@example.com' | Command:
```bash
kubectl annotate pods foo alert-email=alerts@example.com
```
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 arb... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Add a taint with key 'zone' on nodes having label service=auth | Command:
```bash
kubectl taint node -l service=auth zone=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
create a service for a replication controller specified in "centos-controller.yaml" file, serving on port 7000 and connecting to containers on port 801000 | Command:
```bash
kubectl expose -f centos-controller.yaml --port=7000 --target-port=801000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Copy a file from a pod to your local machine | Command:
```bash
kubectl cp kube-node-lease/api-server-pod-3:/tmp/foo /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
Add a taint to the node 'kube-master-9' with the key 'workload' and no value | Command:
```bash
kubectl taint nodes kube-master-9 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... |
Set the service account of the deployment "authentication-service-deployment" to "spinnaker" | Command:
```bash
kubectl set serviceaccount deployment authentication-service-deployment spinnaker
```
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
Sy... |
Forward local port 8081 to port 6379 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod 8081:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a debug container in a pod, make a copy of the pod with the debug container and change the container images | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,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 res... |
Create a Kubernetes pod with the name 'hazelcast' using the 'mysql' image and expose port 9091. | Command:
```bash
kubectl run hazelcast --image=mysql --port=9091
```
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... |
create a service for the replicated alpine using the replica set, which serves on port 8010 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rs alpine --port=8010 --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 port. A... |
Copy the file named 'foo' from the '/tmp' directory of the 'backend-pod-13' pod to the '/tmp' directory on your local machine. | Command:
```bash
kubectl cp cert-manager/backend-pod-13:/tmp/foo /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubect... |
Create a deployment named 'loadbalancer' that runs the 'ethereum/client-go' image with 6 replicas. | Command:
```bash
kubectl create deployment loadbalancer --image=ethereum/client-go --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": "Outpu... |
List the replication controller named 'web', the service named 'auth-service-rc', and the pod named 'gateway-pod' | Command:
```bash
kubectl get rc/web service/auth-service-rc pods/gateway-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... |
Import the 'log_level' key from the 'app-config' config map into the 'frontend-deployment' deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Import specific keys from a config map to an environment variable in a deployment named order-processing-deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/kube-system-config deployment/order-processing-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 variabl... |
Add a taint with key 'hardware' on nodes having label environment=production and the taint effect "PreferNoSchedule". | Command:
```bash
kubectl taint node -l environment=production hardware=node-1: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 service for the replicated ruby with the following details: service port is 80, container port is 8000. | Command:
```bash
kubectl expose rc ruby --port=8083 --target-port=808000
```
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... |
Add an annotation 'alert-email' with the value 'alerts@example.com' to the pod 'media-stream' | Command:
```bash
kubectl annotate pods media-stream alert-email=alerts@example.com
```
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 in... |
Create a copy of the 'chat-app-pod' and change all container images to 'ethereum/client-go' | Command:
```bash
kubectl debug chat-app-pod --copy-to=debug-image-api --set-image=*=ethereum/client-go
```
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 defau... |
Create a pod disruption budget named database-pdb that will select all pods with the app=rails label and require at least one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget database-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 [--dry-... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/global-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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/log-config deployment/log-aggregator-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... |
View the last-applied-configuration annotations of a deployment named 'ruby' in YAML format. | Command:
```bash
kubectl apply view-last-applied deployment/ruby
```
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 (... |
Execute the 'jenkins --version' command inside the 'database-pod' pod and retrieve the output from the first container | Command:
```bash
kubectl exec database-pod -- 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 omitted, use the ku... |
Attach to the "nebula-navigator" container in the "vpn-service-pod" pod and view the output. | Command:
```bash
kubectl attach vpn-service-pod -c nebula-navigator
```
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 omit... |
Execute the 'nginx' command in the first container of the 'log-aggregator-deployment' deployment and display the output. | Command:
```bash
kubectl exec deploy/log-aggregator-deployment -- nginx
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Scale a replica set named 'staging-app-rs' to a specific number of replicas | Command:
```bash
kubectl scale --replicas=7 rs/staging-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 is specified, it is valid... |
Forward local traffic on ports 6379 and 6000 to the web-app-pod's ports 8888 and 6000 | Command:
```bash
kubectl port-forward pod/web-app-pod 6379 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 automa... |
List the deployments in YAML output format in the "stable-2.0.0" version of the "internal-apps" API group. | Command:
```bash
kubectl get deployments.stable-2.0.0.internal-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced... |
Update the image of a container in a pod | Command:
```bash
kubectl patch pod log-aggregator-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f F... |
Update the pod named 'payment' by adding or updating the annotation 'last-deployment' with the value '2023-03-15', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite pods payment last-deployment='2023-03-15'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels a... |
Import specific keys from a config map into environment variables for a deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/env-vars deployment/log-aggregator-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 deployment named loadbalancer using the mysql image and expose port 8000. | Command:
```bash
kubectl create deployment loadbalancer --image=mysql --port=8000
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
import the 'LOG_LEVEL' key from the 'api-config' config map and set it as an environment variable in the 'proxy-service-deployment' deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/api-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 definitions... |
Forward port 5432 in the backend-pod to port 8088 locally and listen for incoming connections | Command:
```bash
kubectl port-forward pod/backend-pod 8088: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 automa... |
Set the cluster field in a specific context to a specified value | Command:
```bash
kubectl config set contexts.client-2-context.cluster testing-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 ... |
Create a single ingress called 'public-service-ingress' that directs requests to website.com/input to the service 'svc1' on port 27017, using the TLS secret named "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.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":... |
Copy the ~/.config/kube local file to the /tmp/bar directory inside the 'backend-pod-13' pod in the 'velero' namespace. | Command:
```bash
kubectl cp ~/.config/kube velero/backend-pod-13::/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 kubec... |
Retrieve snapshot logs from the container named media-stream-pod-1 within the deployment named web-app-deployment | Command:
```bash
kubectl logs deployment/web-app-deployment -c media-stream-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag"... |
Create a copy of the proxy-service-pod, changing the command of the lunar-launcher container by launching an interactive shell with the dgb-img image. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=dgb-img --container=lunar-launcher -- sh
```
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... |
Create a new config map named monitoring-config based on the contents of the folder "configs" | Command:
```bash
kubectl create configmap monitoring-config --from-file=path/to/configs
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the base... |
Copy the local file ~/.config/kube to the remote pod web-app-pod-1 in the kube-proxy namespace, and place it in the /etc/kubernetes directory | Command:
```bash
kubectl cp ~/.config/kube kube-proxy/web-app-pod-1:/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 ... |
Forward the local port 5432 and IP 10.19.21.23 to the port 8088 within the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 5432:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cri... |
Retrieve the logs of the container named 'cdn-service-pod-1' in the deployment 'cache-cluster-deployment' | Command:
```bash
kubectl logs deployment/cache-cluster-deployment -c cdn-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"... |
Create a new config map named log-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap log-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/configurations/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... |
Copy the file named "foo" located in the "/tmp" directory of the "openfaas/message-broker-pod-15" pod to the "/tmp/bar_dir" directory on your local machine | Command:
```bash
kubectl cp openfaas/message-broker-pod-15:/tmp/foo /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, use the... |
Get output from lunar-launcher container in the database-pod | Command:
```bash
kubectl attach database-pod -c lunar-launcher
```
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, ... |
Return snapshot of previous terminated time-machine container logs from pod frontend-pod | Command:
```bash
kubectl logs -p -c time-machine 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", "sh... |
Copy the ~/.config/kube directory from the 'kube-node-lease/image-resizer-pod-20' pod to /tmp/bar on your local machine. | Command:
```bash
kubectl cp kube-node-lease/image-resizer-pod-20:~/.config/kube /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Retrieve the previous terminated logs of the 'quantum-quark' container from the 'api-service-pod' pod | Command:
```bash
kubectl logs -p -c quantum-quark api-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",... |
Add a taint with the key 'cpu-type' and value 'kube-master-9:PreferNoSchedule' to the nodes that have the label 'region=eu-west-2'. | Command:
```bash
kubectl taint node -l region=eu-west-2 cpu-type=kube-master-9:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Forward traffic between local port 8081 and pod port 6379 in the analytics-pod pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 8081 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Remove the label named 'bar' from the pod named 'security' | Command:
```bash
kubectl label pods security app-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true... |
Port forward local ports 5000 and 8081 to a pod selected by the deployment named "database-deployment" | Command:
```bash
kubectl port-forward deployment/database-deployment 5000 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 ... |
Forward traffic from local port 8080 to port 8080 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 8080: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... |
Switch to a raw terminal mode for the "cdn-service-pod" pod and connect to the "code-explorer" container | Command:
```bash
kubectl attach cdn-service-pod -c code-explorer -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Create an ingress called 'app-loadbalancer-ingress' with a rule that directs requests from foo.com/input to svc1:3001, and use the 'my-cert' tls secret. | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="foo.com/input=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 an ingress named 'myapp-ingress' with a rule that directs requests to the 'site.com/module' path to the 'svc1' service on port 8443, using the 'my-cert' TLS secret. | Command:
```bash
kubectl create ingress myapp-ingress --rule="site.com/module=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"... |
Set the custom TLS server name to "dev-cluster" for the "testing-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster testing-cluster --tls-server-name=dev-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] [--certifica... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.