prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward all traffic from port 8000 on all addresses to port 8088 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8000: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 criteria, a pod will ... |
Create a new ExternalName service with the name "external-email-service" and set the external name to "bar.com" | Command:
```bash
kubectl create service externalname external-email-service --external-name bar.com
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference services that ... |
Set the environment variables on a deployment based on the local shell environment variables that start with "RAILS_". | Command:
```bash
env | grep RAILS_ | kubectl set env -e - deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more ... |
Import the REDIS_HOST key from the global-config ConfigMap into the environment variables of the frontend-deployment deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/global-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 ... |
Forward traffic from localhost port 8888 to port 3000 in the pod named "proxy-server-pod". | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8888:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Copy the local file ~/.config/kube to the directory /tmp/bar_dir in the remote pod ingress-controller-pod-8 in the kube-dns namespace. | Command:
```bash
kubectl cp ~/.config/kube kube-dns/ingress-controller-pod-8:/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... |
Set the container image for the busybox container in the amazonlinux deployment to 'busybox', and set the container image for the amazonlinux:2 container in the same deployment to 'amazonlinux:2'. | Command:
```bash
kubectl set image deployment/amazonlinux busybox=busybox amazonlinux=amazonlinux:2
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj... |
Create a copy of the 'analytics-pod' and change all container images to 'jenkins' | Command:
```bash
kubectl debug analytics-pod --copy-to=my-debugger --set-image=*=jenkins
```
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 resou... |
Import the 'secret_key' key from the 'app-secrets' config map and set it as an environment variable in the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-secrets 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 variable ... |
Set the custom TLS server name to "e2e" for the cluster-beta cluster entry. | Command:
```bash
kubectl config set-cluster cluster-beta --tls-server-name=e2e
```
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-authorit... |
Forward traffic from port 5000 on localhost and IP 10.19.21.23 to port 9090 in the proxy-server-pod pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 5000:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cr... |
Create a new secret named docker-registry-secret with a key for the preferences file located at path/to/preferences | Command:
```bash
kubectl create secret generic docker-registry-secret --from-file=path/to/preferences
```
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 ba... |
Execute the command '/bin/bash -c "echo 'Hello, Amazon Linux'"' in the nebula-navigator container of the e-commerce-pod pod and retrieve the output. | Command:
```bash
kubectl exec e-commerce-pod -c nebula-navigator -- /bin/bash -c "echo 'Hello, Amazon Linux'"
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "u... |
Return the logs of the previous terminated "code-explorer" container from the pod "proxy-service-pod" | Command:
```bash
kubectl logs -p -c code-explorer proxy-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container... |
Set the cluster field in the my-context context to sun-cluster | Command:
```bash
kubectl config set contexts.user-b-context.cluster sun-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you wa... |
Forward port 6379 in the pod named "web-app-pod" to port 9090 locally | Command:
```bash
kubectl port-forward pod/web-app-pod 9090: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... |
Update the specified node by applying a strategic merge patch using the information provided in the "node.json" file | Command:
```bash
kubectl patch -f node.json -p '{"spec":{"containers":[{"name":"container-name", "resources":{"limits":{"cpu":"200m"}}}]}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILE... |
Forward local port 8081 to port 3000 in the pod named mypod | Command:
```bash
kubectl port-forward pod/mypod 8081 3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Execute the 'dotnet' command in the nebula-navigator container of the payment-gateway-pod pod and retrieve the output. | Command:
```bash
kubectl exec payment-gateway-pod -c nebula-navigator -- dotnet
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Run the 'java -jar /usr/share/jenkins/jenkins.war' command in the nano-bot container of the payment-gateway-pod pod and retrieve the output. | Command:
```bash
kubectl exec payment-gateway-pod -c nano-bot -- java -jar /usr/share/jenkins/jenkins.war
```
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... |
Create a service for the replication controller specified in the "wordpress-controller.yaml" file, which serves on port 8888 and connects to the containers on port 888800 | Command:
```bash
kubectl expose -f wordpress-controller.yaml --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 ... |
Start a ruby pod with the name 'hazelcast', using the 'ruby' image and exposing port 8082. | Command:
```bash
kubectl run hazelcast --image=ruby --port=8082
```
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": "--fil... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/database-rc pods/media-stream-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 namespac... |
List all deployments in the "alpha-2.0" version of the "api-v1" API group, and output the result in YAML format. | Command:
```bash
kubectl get deployments.alpha-2.0.api-v1 -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 you will ... |
Create a new config map named 'app-config-prod' using the environment variables from the file 'path/to/preferences.env' | Command:
```bash
kubectl create configmap app-config-prod --from-env-file=path/to/preferences.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 t... |
Forward local port 8080 to targetPort of the "https" service port in the selected pod of the "user-service" service | Command:
```bash
kubectl port-forward service/user-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 selected ... |
Output the modified deployment in YAML format without making changes to the server object. | Command:
```bash
kubectl set env deployment/proxy-service-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 one or... |
Create a new ClusterIP service named inventory-service-clusterip that maps TCP port 8888 on the service to port 8083 on the backend | Command:
```bash
kubectl create service clusterip inventory-service-clusterip --tcp=8888:8083
```
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": "-... |
Create an ingress resource named 'public-ingress' that directs requests for foo.com/input to the service svc1 on port 7000, and use the tls secret named "my-cert" for secure communication. | Command:
```bash
kubectl create ingress public-ingress --rule="foo.com/input=svc1:7000,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":... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/db-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in on... |
Forward port 8888 on localhost and IP 10.19.21.23 to port 8088 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 8888: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 criter... |
Add a taint with the key 'special' on nodes that have the label team=devops | Command:
```bash
kubectl taint node -l team=devops special=web-node-8:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Update the pod named 'vpn' by adding the label 'tier' with the value 'database' | Command:
```bash
kubectl label pods vpn 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": "If ... |
Retrieve the logs from the container 'frontend-pod-1' of the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl logs deployment/notification-handler-deployment -c frontend-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 flag... |
Forward traffic from local port 8888 to port 8888 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8888: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 au... |
Create an ingress that directs requests from foo.com/bar to a service called svc1:8010 using a TLS secret called "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="foo.com/bar=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": "", "usag... |
Update the container images for the deployment named 'wordpress' | Command:
```bash
kubectl set image deployment/wordpress busybox=busybox wordpress=wordpress:5.8.1
```
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),... |
create a service for the replicated ubuntu deployment, with the service serving on port 3000 and connecting to the containers on port 330600 | Command:
```bash
kubectl expose rc ubuntu --port=3000 --target-port=330600
```
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.... |
Wait for the pod named "chat-app-pod" to be in the "Ready" state. | Command:
```bash
kubectl wait --for=condition=Ready pod/chat-app-pod
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.
Alternatively, the command can w... |
Create a new config map named ui-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=properties=/path/to/options/file1.txt --from-file=key1=/path/to/preferences/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 ... |
Update the cluster field of a specific context to a new value. | Command:
```bash
kubectl config set contexts.on-prem-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 ... |
Start a pod named 'hazelcast' using the 'confluentinc/cp-kafka' image and have the container expose port 6379 | Command:
```bash
kubectl run hazelcast --image=confluentinc/cp-kafka --port=6379
```
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 flag... |
Import environment variables from the 'azure-storage-secret' secret into the 'web-app-deployment' deployment | Command:
```bash
kubectl set env --from=secret/azure-storage-secret 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 one or more ... |
Forward local port 3000 to port 8081 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 3000:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Retrieve the output from executing the 'dotnet --list-runtimes' command in the 'code-explorer' container within the 'monitoring-pod' pod. | Command:
```bash
kubectl exec monitoring-pod -c code-explorer -- dotnet --list-runtimes
```
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... |
Forward local port 8080 to port 8888 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward pod/chat-app-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 autom... |
List deployments in JSON output format, using the specified version and API group | Command:
```bash
kubectl get deployments.v1.0.0.api-v2 -o json
```
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 onl... |
Add a taint with key 'hardware' on nodes having label role=database, with the value 'worker-node-3:PreferNoSchedule' | Command:
```bash
kubectl taint node -l role=database hardware=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Forward traffic from port 5432 of your local machine to port 6379 in the web-app-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 5432:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Update pod 'proxy' with label 'unhealthy' and value 'true' | Command:
```bash
kubectl label pods proxy unhealthy=true
```
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": "... |
Delete the pods and services named "email" and "database" | Command:
```bash
kubectl delete pod,service email database
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
... |
Create a pod disruption budget named 'logging-pdb' that will select all pods with the 'release=1.0.0' label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=release=1.0.0 --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... |
Retrieve the deployments in YAML output format from the "v1.1.0" version of the "testing-apps" API group | Command:
```bash
kubectl get deployments.v1.1.0.testing-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 you wi... |
Create a new config map named monitoring-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/configs/file1.txt --from-file=key2=/path/to/properties/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When crea... |
Forward local ports 8000 and 6000 to ports 8000 and 6000 in the pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 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 will be selected autom... |
Set the cluster field in the prod-context context to staging-cluster | Command:
```bash
kubectl config set contexts.prod-context.cluster staging-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you ... |
Forward all traffic from local port 8080 to the pod selected by the 'web-app-deployment' deployment on port 3000 | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8080 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 s... |
Create a new config map named 'app-config-prod' using the files 'file1.txt' and 'file2.txt' as the values for keys 'settings' and 'key2' respectively. | Command:
```bash
kubectl create configmap app-config-prod --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Scale the deployment named frontend-rs to 3 replicas, if its current size is 5 | Command:
```bash
kubectl scale --current-replicas=5 --replicas=3 deployment/frontend-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... |
Add a taint with the key 'disktype' and the value 'worker-node-3:PreferNoSchedule' on nodes that have the label 'version=v1.0.0' | Command:
```bash
kubectl taint node -l version=v1.0.0 disktype=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Apply a taint on nodes that have the label 'team=devops' with the key 'zone' and value 'web-node-8' having an effect of 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l team=devops zone=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": "Output ... |
Start streaming the logs of the lunar-launcher container in the mypod pod | Command:
```bash
kubectl logs -f -c lunar-launcher 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":... |
Create a new secret named docker-registry-secret with keys for each file in folder bar | Command:
```bash
kubectl create secret generic docker-registry-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... |
Set the cluster field in the my-context context to data-cluster | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster data-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 yo... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/kube-system-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 definit... |
Expose a replicated ruby controller as a service on port 9090, connecting to the containers on port 8080 | Command:
```bash
kubectl expose rc ruby --port=9090 --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 specified port. A... |
Import the 'SECRET_KEY' key from the 'global-config' config map and set it as an environment variable in the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/global-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 variable defi... |
Set the service account of the deployment 'mydeployment' to 'argocd' | Command:
```bash
kubectl set serviceaccount deployment mydeployment argocd
```
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:
`kubectl set servi... |
Create a deployment named gateway with 3 replicas running the amazonlinux image | Command:
```bash
kubectl create deployment gateway --image=amazonlinux --replicas=3
```
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. On... |
Import the config_file_path key from the global-config config map and set it as an environment variable in the mydeployment deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/global-config 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 i... |
List the web ReplicaController, cdn-service-rc Service, and e-commerce-pod Pods. | Command:
```bash
kubectl get rc/web service/cdn-service-rc pods/e-commerce-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 namespa... |
Create an ingress with multiple hosts and the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:6379" \
--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 traffic from port 8888 on localhost and IP 10.19.21.23 to port 5432 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 8888:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the crite... |
Import the 'max_connections' key from the 'app-secrets' config map into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-secrets 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... |
Get the output from running the 'mysql --version' command in the lunar-launcher container of the monitoring-pod pod | Command:
```bash
kubectl exec monitoring-pod -c lunar-launcher -- 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 o... |
Create a service to expose the 'hazelcast' ReplicaSet on port 9091, which connects to the containers on port 543200. | Command:
```bash
kubectl expose rs hazelcast --port=9091 --target-port=543200
```
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 po... |
Attach to a specific pod and interact with it in raw terminal mode | Command:
```bash
kubectl attach media-stream-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 ... |
Create a service for the replication controller specified in the "ubuntu-controller.yaml" file | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=6379 --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... |
Get the output from the stardust-shuttle container in the chat-app-pod | Command:
```bash
kubectl attach chat-app-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... |
Import the specified keys from the 'env-vars' ConfigMap into the environment variables of the 'authentication-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/env-vars 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 variab... |
Import specific keys from a config map for a deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-config 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 definitions i... |
Execute the 'postgres' command in the 'code-explorer' container of the 'e-commerce-pod' pod | Command:
```bash
kubectl exec e-commerce-pod -c code-explorer -- postgres
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Stream the logs of the "lunar-launcher" container in the "proxy-service-pod" pod. | Command:
```bash
kubectl logs -f -c lunar-launcher proxy-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... |
Drain the 'foo' node gracefully, aborting if there are any pods not managed by a replication controller, replica set, job, daemon set, or stateful set | Command:
```bash
kubectl drain foo --grace-period=900
```
What it does:
Drain node in preparation for maintenance.
The given node will be marked unschedulable to prevent new pods from arriving. 'drain' evicts the pods if the API server supports https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ . Otherwis... |
Create a copy of the chat-app-pod pod, adding a debug container and changing container images | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=debug-image-app --image=debian --set-image=cache=redis:alpine,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resourc... |
Update the contact email for a specific pod in the "docker-registry.yaml" file. | Command:
```bash
kubectl annotate -f docker-registry.yaml contact-email=support@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 labe... |
Forward port 8081 from all addresses to port 5432 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8081: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... |
Create an ingress named 'ingtls' with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="website.com/=svc:https,tls" \
--rule="testing.com/path/subpath*=othersvc:8000"
```
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"... |
Check if you have permission to list the "backup-job" job in the "kube-system" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/backup-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 partial URL tha... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/my-secret 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 definitions in one or more pod t... |
Embed certificate authority data for the kube-cluster-2 cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-2 --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 new config map named app-config using the contents of the specified files, where the key for the first file is "settings" and the key for the second file is "key2". | Command:
```bash
kubectl create configmap app-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config... |
Remove all taints with the key 'cpu-type' from the node 'monitoring-node-15' | Command:
```bash
kubectl taint nodes monitoring-node-15 cpu-type-
```
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: jso... |
Set the annotation 'compliance-level' to 'PCI-DSS' for the pod named 'foo' | Command:
```bash
kubectl annotate pods foo 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... |
list the replication controller with the name "web", the service with the name "payment-gateway" and the pod with the name "payment-gateway-pod" | Command:
```bash
kubectl get rc/web service/payment-gateway-rc pods/payment-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 i... |
Create a copy of the pod "api-service-pod" by adding a debug container and changing the container images | Command:
```bash
kubectl debug api-service-pod -it --copy-to=debug-image-api --image=debian --set-image=mailer=mailer:latest,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified... |
Retrieve the snapshot logs from the container named "api-service-pod-1" in the deployment "gateway-deployment". | Command:
```bash
kubectl logs deployment/gateway-deployment -c api-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":... |
Create a debug copy of the 'monitoring-pod' and replace all container images with the 'node' image | Command:
```bash
kubectl debug monitoring-pod --copy-to=debug-image-memcached --set-image=*=node
```
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 8000 on all addresses to port 8081 in the pod named "mypod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8000: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 sel... |
Add a taint with key 'zone' on nodes having label team=devops | Command:
```bash
kubectl taint node -l team=devops zone=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": "Output... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.