prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward traffic from port 3000 on localhost and IP address 10.19.21.23 to port 8088 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 3000: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 ... |
Run a command inside a pod in the frontend-service service to execute the 'nginx -g "daemon off;"' command and get the output. | Command:
```bash
kubectl exec svc/frontend-service -- nginx -g "daemon off;"
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
create a service for an nginx replica set | Command:
```bash
kubectl expose rs nginx --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 specified port. ... |
Forward traffic from port 8081 on localhost and IP 10.19.21.23 to port 8088 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 8081: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 criteri... |
Import the specific keys 'CONFIG_FILE_PATH' from the 'namespace-config' config map and apply them to the 'gateway-deployment' deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/namespace-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 defi... |
Copy the directory "/tmp/foo_dir" from the remote pod "security-scanner-pod-18" in the "kube-dns" namespace to the local directory "/tmp/bar". | Command:
```bash
kubectl cp kube-dns/security-scanner-pod-18:/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 ... |
Create a service for the replicated alpine container which serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose rc alpine --port=8000 --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.... |
Execute the 'npm --version' command in the payment-gateway-pod pod and display the output | Command:
```bash
kubectl exec payment-gateway-pod -- npm --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... |
Create a new config map named 'log-config' using the key=value pairs from the file located at 'path/to/settings' | Command:
```bash
kubectl create configmap log-config --from-file=path/to/settings
```
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 basename o... |
Create a new config map named app-name-config with the specified keys from the provided files | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/profiles/file1.txt --from-file=data=/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 creating ... |
Create a new config map named env-vars using specific keys from files on disk | Command:
```bash
kubectl create configmap env-vars --from-file=settings=/path/to/configurations/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... |
Forward local port 8888 to port 8888 in a pod selected by the 'mydeployment' deployment. | Command:
```bash
kubectl port-forward deployment/mydeployment 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 selecte... |
Create an ingress called 'api-v2-ingress' that directs requests from foo.com/input to a service named svc1 on port 8081 | Command:
```bash
kubectl create ingress api-v2-ingress --rule="foo.com/input=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":... |
Display the replication controller named "web", the service named "payment-gateway-rc", and the pod named "proxy-service-pod" | Command:
```bash
kubectl get rc/web service/payment-gateway-rc pods/proxy-service-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 ... |
Execute the 'redis-server' command on the first pod of the 'api-server-deployment' deployment. | Command:
```bash
kubectl exec deploy/api-server-deployment -- redis-server
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a copy of the frontend-pod named debug-image-app, replacing all container images with confluentinc/cp-kafka. | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-app --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 de... |
Forward local port 8088 to port 9090 in the pod named api-service-pod | Command:
```bash
kubectl port-forward pod/api-service-pod 8088:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
create a config map named api-config with specified keys from file paths | Command:
```bash
kubectl create configmap api-config --from-file=conf=/path/to/data/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 a con... |
Expose an alpine replicaset as a service, serving on port 80 and connecting to the containers on port 8000 | Command:
```bash
kubectl expose rc alpine --port=5000 --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.... |
Set the client-key field for the operator entry | Command:
```bash
kubectl config set-credentials operator --client-key=~/.kube/admin.key
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token fl... |
Forward local port 5000 to port 8088 in the pod | Command:
```bash
kubectl port-forward pod/api-service-pod 5000: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 be selected au... |
Add a taint with the key 'cpu-type' and the value 'prod-node-5:PreferNoSchedule' on all nodes that have the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 cpu-type=prod-node-5: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": ... |
Add a taint with key 'app' on nodes having label role=database | Command:
```bash
kubectl taint node -l role=database app=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": "", "usage": "Out... |
Forward port from local machine to pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8080 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 au... |
Create a secret named password-secret and include keys for each file in the folder bar. | Command:
```bash
kubectl create secret generic password-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 basena... |
Autoscale the replication controller "security" with CPU utilization target at 81% and a maximum of 5 pods. | Command:
```bash
kubectl autoscale rc security --max=5 --cpu-percent=81
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
create a deployment named mattermost with the wordpress image | Command:
```bash
kubectl create deployment mattermost --image=wordpress
```
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: json|y... |
Remove a taint from a specific node | Command:
```bash
kubectl taint nodes web-node-8 datacenter:NoExecute-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Create a secret named 'app-config-secret' using values from an environment file, 'parameters.env' | Command:
```bash
kubectl create secret generic app-config-secret --from-env-file=path/to/parameters.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the ... |
Forward local port 3000 to port 8080 in a pod selected by the web-app-deployment deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 3000 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 s... |
Remove a taint from a specific node | Command:
```bash
kubectl taint nodes gpu-node-12 dedicated: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... |
Partially update a node by applying a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node worker-node-3 -p '{"spec":{"someField":"newValue"}'
```
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]`
He... |
List all deployments in the "rc-1.1.0" version of the "internal-apps" API group in YAML output format. | Command:
```bash
kubectl get deployments.rc-1.1.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 you... |
Change the service account of the deployment named 'api-server-deployment' to 'tekton'. | Command:
```bash
kubectl set serviceaccount deployment api-server-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:
`kubectl ... |
Add a taint with the key 'dedicated' and the value 'dev-node-4:PreferNoSchedule' on nodes that have the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production dedicated=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": "", "... |
Set the cluster field in the dev-context context to on-prem-cluster. | Command:
```bash
kubectl config set contexts.dev-context.cluster on-prem-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 w... |
Retrieve information about a specific replication controller named "payment-gateway-rc" | Command:
```bash
kubectl get replicationcontroller payment-gateway-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 w... |
Create a secret named monitoring-credentials-secret from specified keys on disk | Command:
```bash
kubectl create secret generic monitoring-credentials-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
```
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 cre... |
Create a new resource quota named cpu-mem-quota with a hard limit of 2 CPU and 2GB of memory. | Command:
```bash
kubectl create quota cpu-mem-quota --hard=cpu=2,memory=2G
```
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 flags:
"... |
Create an ingress resource with the name 'website-ingress' that routes requests from testing.com/module to a service named 'svc1' on port 8080 inside the cluster | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/module=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Delete the pods and services with the names "monitoring" and "email" | Command:
```bash
kubectl delete pod,service monitoring email
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector... |
Import the DATABASE_URL key from the app-name-config config map into the payment-processor-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-name-config 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... |
Create a new config map named api-config with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap api-config --from-file=conf=/path/to/configurations/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 crea... |
Create a copy of the 'analytics-pod' pod and start a debug session using the 'debug-image-api' pod | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-api --container=warp-drive -- 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... |
Get the output from running the 'mongo --version' command in the 'nebula-navigator' container from the 'monitoring-pod' pod | Command:
```bash
kubectl exec monitoring-pod -c nebula-navigator -- mongo --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Set the custom TLS server name to use for validation for the galaxy-cluster cluster entry. | Command:
```bash
kubectl config set-cluster galaxy-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] [--certifica... |
Add a taint with key 'special' and no value to the node 'monitoring-node-15' | Command:
```bash
kubectl taint nodes monitoring-node-15 special: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. On... |
Create a role named "foo" with the ability to list pods and access specific resources named "machine-learning" and "backup-service" | Command:
```bash
kubectl create role foo --verb=list --resource=pods --resource-name=machine-learning --resource-name=backup-service
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|cl... |
Get the output from the 'mongo --version' command running in the first pod of the 'scheduler-service' service. | Command:
```bash
kubectl exec svc/scheduler-service -- mongo --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Create and start a pod using the `ethereum/client-go` image, and expose port 8089 for the container. | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --port=8089
```
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:
... |
Listen on port 5000 locally and forward the traffic to the 'https' targetPort of the 'backend-service' service in the pod selected by the service. | Command:
```bash
kubectl port-forward service/backend-service 5000: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 select... |
Set the CPU limits of the container in the "node" deployment to "2" and memory limits to "64Mi" | Command:
```bash
kubectl set resources deployment node -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 its ... |
Create a new ClusterIP service called 'order-service-clusterip' and map port 3001 on the service to port 3001 on the pods | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=3001:3001
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", ... |
Remove the taint with key 'dedicated' and effect 'NoSchedule' from the node 'db-node-7' if it exists. | Command:
```bash
kubectl taint nodes db-node-7 dedicated: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: ... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/monitoring-credentials-secret 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 ... |
Forward local port 8081 to the pod's port 6379 for the pod named 'api-service-pod' | Command:
```bash
kubectl port-forward pod/api-service-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 au... |
Listen on port 8080 locally and forward the traffic to port 9090 in the backend-pod. | Command:
```bash
kubectl port-forward pod/backend-pod 8080:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Add a taint with the key 'environment' on nodes that have the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend environment=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", "default": "", ... |
Auto scale the replication controller "security" with a target CPU utilization of 90%, ensuring that the number of pods remains between 1 and 5. | Command:
```bash
kubectl autoscale rc security --max=5 --cpu-percent=90
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
Set up auto scaling for the deployment "analytics" with the number of pods ranging from 7 to 11. | Command:
```bash
kubectl autoscale deployment analytics --min=7 --max=11
```
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 us... |
Create a pod disruption budget named monitoring-pdb that will select all pods with the version=v2 label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget monitoring-pdb --selector=version=v2 --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... |
Access the container called "mycontainer" running in the pod named "auth-service-pod" and execute the "irb" command. | Command:
```bash
kubectl exec auth-service-pod -c mycontainer -- irb
```
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 t... |
Create a new config map named "app-name-config" with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/options/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creati... |
Import environment variables from the jwt-secret secret and set them for the backend-microservice-deployment deployment | Command:
```bash
kubectl set env --from=secret/jwt-secret deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or mo... |
Import specific keys from a config map to a deployment's environment variables. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-settings 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... |
Add a taint with the key 'disktype' and value 'worker-node-3:PreferNoSchedule' on nodes that have the label release=beta. | Command:
```bash
kubectl taint node -l release=beta 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": ... |
Create a pod named 'hazelcast' using the 'nginx' image and expose port 8181. | Command:
```bash
kubectl run hazelcast --image=nginx --port=8181
```
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... |
List the users that kubectl is configured with | Command:
```bash
kubectl config get-users
```
What it does:
Display users defined in the kubeconfig.
Syntax:
`kubectl config get-users` |
Set the service account of the 'frontend-deployment' deployment to 'tiller' | Command:
```bash
kubectl set serviceaccount deployment frontend-deployment tiller
```
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 se... |
Run the 'mongo' command in the 'time-machine' container of the 'web-app-pod' pod and retrieve the output. | Command:
```bash
kubectl exec web-app-pod -c time-machine -- mongo
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Import the 'debug_mode' 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=debug_mode --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 defi... |
Create a new ClusterIP service named inventory-service-clusterip that maps port 9091 on the cluster to port 8081 on the service. | Command:
```bash
kubectl create service clusterip inventory-service-clusterip --tcp=9091:8081
```
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 named 'api-v1-ingress' with a rule that directs requests for 'testing.com/input' to the 'svc1:3000' service | Command:
```bash
kubectl create ingress api-v1-ingress --rule="testing.com/input=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Create an ingress called 'api-v2-ingress' that directs requests to 'foo.com/module' to the service named 'svc1' running on port 3000 | Command:
```bash
kubectl create ingress api-v2-ingress --rule="foo.com/module=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Create a Pod Disruption Budget named critical-services-pdb that will select all pods with the component=web label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=component=web --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-availa... |
Autoscale the deployment "cdn" with the number of pods ranging from 4 to 8. | Command:
```bash
kubectl autoscale deployment cdn --min=4 --max=8
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the ... |
Import the environment variables from the secret named "my-secret" into the "user-management-deployment" deployment. | Command:
```bash
kubectl set env --from=secret/my-secret deployment/user-management-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... |
Retrieve the previous terminated logs from a specific container in a pod | Command:
```bash
kubectl logs -p -c warp-drive e-commerce-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... |
Import environment variables from a config map with a specific prefix | Command:
```bash
kubectl set env --from=configmap/namespace-config --prefix=MYSQL_ deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Set the cluster field in a specific context to a specific cluster | Command:
```bash
kubectl config set contexts.cluster-2-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 yo... |
Remove the taint with key 'zone' and effect 'PreferNoSchedule' from the node 'db-node-7' if it exists. | Command:
```bash
kubectl taint nodes db-node-7 zone: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 format. One of:... |
Create an Ingress resource called 'external-ingress' that directs requests to the path '/bar' on the domain 'testing.com' to the service 'svc1' on port '8088' | Command:
```bash
kubectl create ingress external-ingress --rule="testing.com/bar=svc1:8088,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Retrieve the logs from a previously terminated Ruby container in the Gateway pod. | Command:
```bash
kubectl logs -p -c ruby gateway-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", "short": "-c... |
view and modify the environment variables of a deployment in YAML format without making changes on the server | Command:
```bash
kubectl set env deployment/mydeployment DB_USER=username -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (w... |
Update the container images of a deployment | Command:
```bash
kubectl set image deployment/ruby busybox=busybox ruby=ruby:3.0.2
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs... |
Retrieve logs from container authentication-service-deployment-1 in deployment mypod | Command:
```bash
kubectl logs deployment/authentication-service-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:
"f... |
Display only the most recent 3 lines of output from the logs of the vpn-service-pod pod. | Command:
```bash
kubectl logs --tail=3 vpn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "... |
Copy the local file /tmp/foo to the remote pod front-end-pod-12 in the kubeapps namespace at path /tmp/bar | Command:
```bash
kubectl cp :/tmp/foo kubeapps/front-end-pod-12:/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... |
Create a single ingress called 'external-ingress' that directs requests to website.com/input to svc # svc1:8084 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="website.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": "", "u... |
Set the resource request and limits for all containers in the mongo deployment | Command:
```bash
kubectl set resources deployment mongo --limits=cpu=200m,memory=512Mi --requests=cpu=200m,memory=4Gi
```
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... |
Create a new ExternalName service named "external-third-party-api-service" that points to "sample-domain.net" | Command:
```bash
kubectl create service externalname external-third-party-api-service --external-name sample-domain.net
```
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 refe... |
create an ingress named 'myapp-ingress' that redirects requests from 'website.com/input' to 'svc1:9091' using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress myapp-ingress --rule="website.com/input=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", "default": "", "usag... |
Create an ingress named 'app2-ingress' that maps requests from "website.com/example" to a service named "svc1:3306" with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app2-ingress --rule="website.com/example=svc1:3306,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Retrieve the snapshot logs from the container monitoring-stack-deployment-1 of the deployment named analytics-pod | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c analytics-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:
... |
Forward local port 8081 to port 8081 in the pod named backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 8081 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 automa... |
Start streaming the logs of the 'ruby' container in the 'web-app-pod' pod. | Command:
```bash
kubectl logs -f -c ruby web-app-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", "short": "-c... |
Forward local ports to a pod's ports | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 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, ... |
Retrieve the output of the command 'redis-server --version' from the first container of the first pod in the order-service service. | Command:
```bash
kubectl exec svc/order-service -- redis-server --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, ... |
Update the environment variable 'GOOGLE_API_KEY' with 'your-google-api-key' for the 'notification-handler-deployment' deployment and display the modified deployment in YAML format without making any changes to the object on the server. | Command:
```bash
kubectl set env deployment/notification-handler-deployment GOOGLE_API_KEY=your-google-api-key -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 defini... |
Forward local port 8088 to the targetPort of the "https" service port in a pod selected by the "gateway-service" service. | Command:
```bash
kubectl port-forward service/gateway-service 8088: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 select... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.