prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Get output from running the 'elasticsearch' command in the 'astro-container' from the pod 'media-stream-pod' | Command:
```bash
kubectl exec media-stream-pod -c astro-container -- elasticsearch
```
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 ... |
Copy the directory '/tmp/foo_dir' from the 'metrics-exporter-pod-10' pod in the 'kube-dns' namespace to the '/tmp/bar' directory on your local machine. | Command:
```bash
kubectl cp kube-dns/metrics-exporter-pod-10:/tmp/foo_dir /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 t... |
Create a copy of the vpn-service-pod and name it debug-image-1, but with all container images replaced with the ubuntu image. | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-1 --set-image=*=ubuntu
```
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 re... |
Create an ingress named 'app-ingress' with the following configuration: | Command:
```bash
kubectl create ingress app-ingress --rule="foo.com/bar=svc1:8081,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": "Out... |
Embed the certificate authority data for the "sun-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/galaxy-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config se... |
Add a taint with the key 'hardware' and value 'web-node-8:PreferNoSchedule' on nodes that have the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 hardware=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": "... |
Forward local port 8000 to port 5000 in the pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Import specific keys from a config map into an environment variable. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/api-config deployment/notification-handler-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... |
Import the SMTP_SERVER key from the ui-config config map and set it as an environment variable for the notification-handler-deployment deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/ui-config deployment/notification-handler-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 debug container copy of mypod with the rocket-ranger container by running an interactive shell | Command:
```bash
kubectl debug mypod -it --copy-to=my-custom-dbg --container=rocket-ranger -- 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 default if ... |
Forward traffic from port 9090 on all addresses to port 8080 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-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 criteria, a pod wi... |
Get the output from running the 'mongod' command in warp-drive from the gateway-pod pod | Command:
```bash
kubectl exec gateway-pod -c warp-drive -- mongod
```
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 ... |
Import the 'SECRET_KEY' key from the 'api-config' config map and set it as an environment variable for the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/api-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 defin... |
Create a cluster role with NonResourceURL specified | Command:
```bash
kubectl create clusterrole "reader" --verb=proxy --non-resource-url=/debug/core
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "s... |
Update the compliance level annotation of the pod specified in the "config.json" file to "PCI-DSS". | Command:
```bash
kubectl annotate -f config.json 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 arb... |
Listen on a random port locally and forward traffic to port 8080 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod :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 automatica... |
Execute the 'mysqld' command in the first container of the 'payment-service' service and get the output. | Command:
```bash
kubectl exec svc/payment-service -- mysqld
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubect... |
Update the label of a pod with a specific value | Command:
```bash
kubectl label pods security tier=database
```
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":... |
Set the cluster field of the "testing-context" context to "star-cluster" | Command:
```bash
kubectl config set contexts.testing-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 you ... |
Embed the certificate authority data for the "galaxy-cluster" cluster entry | Command:
```bash
kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluste... |
Create a cluster role named "reader" with permissions to update configmaps with resource names "dev-database" and "mail-server" | Command:
```bash
kubectl create clusterrole reader --verb=update --resource=configmaps --resource-name=dev-database --resource-name=mail-server
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|clien... |
Create a new resource quota named network-policy-quota with a limit of 3 network policies. | Command:
```bash
kubectl create quota network-policy-quota --hard=networkpolicies=3
```
What it does:
Create a resource quota with the specified name, hard limits, and optional scopes.
Syntax:
`kubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]`
Helpful... |
Import specific keys from a config map into a deployment's environment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/namespace-config deployment/authentication-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 ... |
Create a php pod with specific labels | Command:
```bash
kubectl run hazelcast --image=php --labels="app=php,env=prod"
```
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:... |
Update the environment variable 'SMTP_HOST' in the deployment named 'proxy-service-deployment'. | Command:
```bash
kubectl set env deployment/proxy-service-deployment SMTP_HOST=smtp.example.com
```
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 po... |
Update the pod's description to 'Web server for marketing site' using the metadata specified in the "config.json" file. | Command:
```bash
kubectl annotate -f config.json description='Web server for marketing site'
```
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... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/gateway-rc pods/proxy-server-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 specific keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/env-vars 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 i... |
Forward local port 3000 to port 6379 in the web-app-pod | Command:
```bash
kubectl port-forward pod/web-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 be selected automa... |
Create a single ingress called 'api-ingress' that directs requests to foo.com/input to svc1:8084 using TLS secret "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="foo.com/input=svc1:8084,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Add a taint with the key 'environment' and the value 'storage-node-13:PreferNoSchedule' on nodes that have the label 'release=beta' | Command:
```bash
kubectl taint node -l release=beta environment=storage-node-13: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... |
Import specific keys from a config map into an environment variable for a deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/app-settings 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 d... |
Create a copy of the frontend pod, adding a debug container and changing container images | Command:
```bash
kubectl debug frontend-pod -it --copy-to=debug-image-memcached --image=debian --set-image=app=app:debug,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified ... |
Set a custom TLS server name for the data-cluster cluster entry | Command:
```bash
kubectl config set-cluster data-cluster --tls-server-name=cloud-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificat... |
Forward local traffic on port 8000 to the pod selected by the monitoring-stack-deployment deployment on port 8000. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8000 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 ... |
Change the service account of the deployment "monitoring-stack-deployment" to "kube-scheduler" | Command:
```bash
kubectl set serviceaccount deployment monitoring-stack-deployment kube-scheduler
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syn... |
Add a taint with the key 'datacenter' on nodes that have the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production datacenter=monitoring-node-15: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", "defaul... |
Use an alternative editor to edit a service resource | Command:
```bash
KUBE_EDITOR="notepad" kubectl edit svc/analytics-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment vari... |
Create a copy of the backend pod with all container images changed to postgres | Command:
```bash
kubectl debug backend-pod --copy-to=debug-image-app --set-image=*=postgres
```
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 re... |
Copy /tmp/foo file from local machine to /etc/kubernetes directory in the web-app-pod-1 pod running in the prometheus namespace | Command:
```bash
kubectl cp :/tmp/foo prometheus/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 the k... |
Forward the local port 8081 to the targetPort of the "https" port in a selected pod of the "database-service" service | Command:
```bash
kubectl port-forward service/database-service 8081:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selec... |
Create a new config map named monitoring-config with specific keys from files | Command:
```bash
kubectl create configmap monitoring-config --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/data/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... |
Forward traffic from port 8088 on localhost and IP address 10.19.21.23 to port 5000 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 8088: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 criter... |
Delete the context for the "edge-context" cluster | Command:
```bash
kubectl config delete-context edge-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
Retrieve the snapshot logs from the container 'user-management-deployment-1' of the deployment named 'mypod' | Command:
```bash
kubectl logs deployment/user-management-deployment -c mypod-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": "... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-secrets deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Check if you have permission to list the 'virus-scan-job' job in the 'logging' namespace | Command:
```bash
kubectl auth can-i list jobs.batch/virus-scan-job -n logging
```
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 tha... |
Create a service for the replication controller specified in the "alpine-controller.yaml" file, which serves on port 9091 and connects to the containers on port 8080. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=9091 --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... |
Copy the file /tmp/foo from the remote pod logging/backend-pod-13 to the local directory /tmp/bar. | Command:
```bash
kubectl cp logging/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 kubectl.kub... |
Remove the label named 'bar' from the 'api' pod if it exists. | Command:
```bash
kubectl label pods api env-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true, che... |
Create an ingress rule called 'app-loadbalancer-ingress' that directs requests for 'website.com/example' to the service 'svc1' on port '9091' with the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/example=svc1:9091,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", "defaul... |
create a job named log-collection using the python image, and execute the python --version command | Command:
```bash
kubectl create job log-collection --image=python -- python --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 ... |
Import the REDIS_HOST key from the api-config config map into the web-app-deployment deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/api-config deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
create a new config map named app-config-prod using the files file1.txt and file2.txt located at /path/to/configurations and /path/to/data respectively and assign specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-prod --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/data/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 ... |
Create a copy of the "database-pod" pod, adding a "debug" container and changing the container images | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-web --image=debian --set-image=app=app:debug,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 and name. ... |
Copy the contents of the `/var/run/secrets/kubernetes.io/serviceaccount/` directory from the pod named "openfaas/image-resizer-pod-20" to the local machine's `/tmp/bar` directory. | Command:
```bash
kubectl cp openfaas/image-resizer-pod-20:/var/run/secrets/kubernetes.io/serviceaccount/ /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": "Co... |
Setup autoscaling for the replication controller "cdn" with a target CPU utilization of 40%, allowing the number of pods to scale between 1 and 8. | Command:
```bash
kubectl autoscale rc cdn --max=8 --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... |
Start a jenkins pod with customized specifications provided as a partial JSON override | Command:
```bash
kubectl run nginx --image=jenkins --overrides='{ "apiVersion": "v1.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMA... |
Import the 'api_key' key from the 'log-config' config map and set it as an environment variable in the 'database-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --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 one... |
Create a new config map named 'app-name-config' from the environment file located at 'path/to/properties.env' | Command:
```bash
kubectl create configmap app-name-config --from-env-file=path/to/properties.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... |
Get output from the stardust-shuttle container in the gateway-pod | Command:
```bash
kubectl attach gateway-pod -c stardust-shuttle
```
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 service for a WordPress deployment that listens on port 8888 and connects to the containers on port 888800. | Command:
```bash
kubectl expose deployment wordpress --port=8888 --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 spec... |
Attach to the monitoring-pod in the rocket-ranger container, switch to raw terminal mode, and interact with the 'bash' command. | Command:
```bash
kubectl attach monitoring-pod -c rocket-ranger -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Attach to the 'mycontainer' container in the 'auth-service-pod' pod and get the output. | Command:
```bash
kubectl attach auth-service-pod -c mycontainer
```
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 'worker' that runs the 'redis' image and exposes port 27017 | Command:
```bash
kubectl create deployment worker --image=redis --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: j... |
Create an ingress called 'private-api-ingress' that directs requests to 'testing.com/example' to the service 'svc1' on port 8084, and use the TLS secret "my-cert". | Command:
```bash
kubectl create ingress private-api-ingress --rule="testing.com/example=svc1:8084,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Create a service for the 'centos' replica set, exposing it on port 3001 and connecting to the containers on port 700000. | Command:
```bash
kubectl expose rs centos --port=3001 --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 specified port.... |
Scale the deployment named app-v2-replicaset to 1 replica, if its current size is 7 | Command:
```bash
kubectl scale --current-replicas=7 --replicas=1 deployment/app-v2-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-v... |
Copy the local file /tmp/foo to the remote pod metrics-exporter-pod-10 in the kube-dns namespace, and save it as /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo kube-dns/metrics-exporter-pod-10:/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... |
Set the resource request to 50m CPU and 256Mi memory, and the resource limit to 200m CPU and 512Mi memory for all containers in the amazonlinux deployment. | Command:
```bash
kubectl set resources deployment amazonlinux --limits=cpu=200m,memory=512Mi --requests=cpu=50m,memory=256Mi
```
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 r... |
Delete pods and services named "monitoring" and "gateway" | Command:
```bash
kubectl delete pod,service monitoring 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 select... |
Create an ingress configuration called 'myapp-ingress' that maps requests from 'testing.com/bar' to 'svc1' service running on port 5001, using the 'my-cert' TLS secret. | Command:
```bash
kubectl create ingress myapp-ingress --rule="testing.com/bar=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"... |
Open the 'gateway-service' service for editing using the 'code' editor. | Command:
```bash
KUBE_EDITOR="code" kubectl edit svc/gateway-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables... |
Copy the directory /var/run/secrets/kubernetes.io/serviceaccount/ from the remote pod 'task-processor-pod-17' in the 'logging' namespace to the local directory /etc/kubernetes. | Command:
```bash
kubectl cp logging/task-processor-pod-17:/var/run/secrets/kubernetes.io/serviceaccount/ /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usag... |
Import the 'max_connections' key from the 'app-settings' ConfigMap and set it as an environment variable in the 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-settings 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 definitio... |
Set the service account of the deployment named api-server-deployment to kube-dns | Command:
```bash
kubectl set serviceaccount deployment api-server-deployment kube-dns
```
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:
`kubect... |
Copy the local file '/tmp/foo' to '/etc/kubernetes' in the remote pod 'task-processor-pod-17' in the 'monitoring' namespace. | Command:
```bash
kubectl cp /tmp/foo monitoring/task-processor-pod-17:/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... |
Import the REDIS_HOST key from the config map 'db-config' into the deployment 'monitoring-stack-deployment'. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/db-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 definiti... |
Copy the "~/.config/kube" file from the "logging/auth-service-pod-11" remote pod to the "/etc/kubernetes" directory locally. | Command:
```bash
kubectl cp logging/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, u... |
Copy the local file /tmp/foo to the remote pod's /tmp/bar directory in the argocd/monitoring-agent-pod-6 namespace | Command:
```bash
kubectl cp :/tmp/foo argocd/monitoring-agent-pod-6::/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... |
Return the snapshot logs from the container web-app-deployment-1 of the deployment named security-service-pod. | Command:
```bash
kubectl logs deployment/web-app-deployment -c security-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:
"f... |
Remove taints on a specific node. | Command:
```bash
kubectl taint nodes db-node-7 disktype-
```
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|na... |
create a service for the 'python' deployment, which serves on port 8082 and connects to the containers on port 9090 | Command:
```bash
kubectl expose deployment python --port=8082 --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 specifi... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-config-dev 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 var... |
Create a new secret named payment-gateway-secret with keys for each file in the folder called "bar" | Command:
```bash
kubectl create secret generic payment-gateway-secret --from-file=path/to/settings
```
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 basen... |
Set the resource request and limits for all containers in the 'centos' deployment | Command:
```bash
kubectl set resources deployment centos --limits=cpu=200m,memory=512Mi --requests=cpu=1,memory=128Mi
```
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 requeste... |
update the 'notification-handler-deployment' deployment in the current namespace and set the environment variable S3_BUCKET to 'my-s3-bucket' | Command:
```bash
kubectl set env deployment/notification-handler-deployment S3_BUCKET=my-s3-bucket
```
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... |
Create a cluster role named "default_role" that allows the user to list, create, and update pods. | Command:
```bash
kubectl create clusterrole default_role --verb=list,create,update --resource=pods
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", ... |
Apply a taint on nodes with the label 'tier=frontend' and set the taint key to 'zone' with the value 'dev-node-4:PreferNoSchedule' | Command:
```bash
kubectl taint node -l tier=frontend zone=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outpu... |
Edit the payment-service service using the micro editor instead of the default editor | Command:
```bash
KUBE_EDITOR="micro" kubectl edit svc/payment-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variable... |
Get the output from running the 'gem --version' command in the 'warp-drive' container of the 'security-service-pod' pod. | Command:
```bash
kubectl exec security-service-pod -c warp-drive -- gem --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 o... |
Create a copy of the gateway-pod and change the image of all containers to ``confluentinc/cp-kafka`` | Command:
```bash
kubectl debug gateway-pod --copy-to=debug-image-web --set-image=*=confluentinc/cp-kafka
```
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 def... |
Rename the context 'dev-context' to 'app-1-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context dev-context app-1-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will also be... |
Create a deployment named "worker" with 5 replicas, running the "postgres" image. | Command:
```bash
kubectl create deployment worker --image=postgres --replicas=5
```
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 new ExternalName service named external-dns-service and associate it with the external address sandbox-site.co. | Command:
```bash
kubectl create service externalname external-dns-service --external-name sandbox-site.co
```
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... |
Update the 'vpn' pod's annotation 'monitoring-tool' to 'Prometheus'. | Command:
```bash
kubectl annotate pods vpn monitoring-tool=Prometheus
```
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 arbitra... |
Add a taint to nodes in the region 'eu-west-2' with the key 'environment' and the value 'testing-node-11' to prevent new pods from being scheduled on those nodes. | Command:
```bash
kubectl taint node -l region=eu-west-2 environment=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": "", ... |
Forward traffic from port 8081 on all addresses to port 8000 in the pod named "mypod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8081: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 sel... |
Retrieve snapshot logs from container "email-service-pod-1" of the deployment named "web-app-deployment" | Command:
```bash
kubectl logs deployment/web-app-deployment -c email-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag... |
Monitor the status of the deployment with the name 'development' | Command:
```bash
kubectl rollout status deployment/development
```
What it does:
Show the status of the rollout.
By default 'rollout status' will watch the status of the latest rollout until it's done. If you don't want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.