prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward traffic from local port 9090 to port 8088 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward pod/web-app-pod 9090: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 automa... |
Autoscale the "chat-app" deployment with a minimum of 4 pods and a maximum of 12 pods. | Command:
```bash
kubectl autoscale deployment chat-app --min=4 --max=12
```
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 job named "database-seeding-job" using the "amazonlinux" image to install the "aws-cli" package using the "yum" package manager. | Command:
```bash
kubectl create job database-seeding-job --image=amazonlinux -- yum install -y aws-cli
```
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": "", ... |
Scale a resource to 1 based on the configuration specified in "preferences.yaml" file | Command:
```bash
kubectl scale --replicas=1 -f preferences.yaml
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is val... |
Open a forwarding tunnel that listens on port 8000 on localhost and IP address 10.19.21.23, and forwards the traffic to port 9090 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 8000: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 th... |
Taint nodes with label 'feature=feature-xyz' using the 'workload' key and value 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l feature=feature-xyz workload=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": "", ... |
Interact with a specific container in a pod in raw terminal mode | Command:
```bash
kubectl attach analytics-pod -c nebula-navigator -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 deployment named 'loadbalancer' with the image 'python' and set the command as 'python --version' | Command:
```bash
kubectl create deployment loadbalancer --image=python -- python --version
```
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 for... |
Create a cron job named "daily-report" using the image "redis", running the command "redis-cli", with a schedule of running every minute, using the kubectl create cronjob command. | Command:
```bash
kubectl create cronjob daily-report --image=redis --schedule="*/1 * * * *" -- redis-cli
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "... |
Create an ingress called 'api-ingress' that directs requests to 'website.com/example' to 'svc1:5432' with a TLS secret "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="website.com/example=svc1:5432,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... |
Forward traffic on local ports 8888 and 6000 to ports 8088 and 6000, respectively, in a pod selected by the web-app-deployment deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 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 criteria, a pod will be s... |
Start streaming the logs of the lunar-launcher container in the e-commerce-pod pod | Command:
```bash
kubectl logs -f -c lunar-launcher 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",... |
List all allowed actions in the "namespace-1" namespace | Command:
```bash
kubectl auth can-i --list --namespace=namespace-1
```
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 that starts wi... |
Get the output from running the 'mongod' command in the 'rocket-ranger' container from the 'proxy-service-pod' pod. | Command:
```bash
kubectl exec proxy-service-pod -c rocket-ranger -- 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,... |
Forward local port 5432 to port 8888 in the pod named "proxy-server-pod". | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5432: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 a... |
Create a new config map named 'app-config-prod' using the parameters from the 'path/to/parameters' folder | Command:
```bash
kubectl create configmap app-config-prod --from-file=path/to/parameters
```
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 bas... |
Create a copy of the 'frontend-pod' pod and change all container images to 'redis'. Name the new pod 'debug-image-api'. | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-api --set-image=*=redis
```
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 reso... |
Forward local traffic on port 6379 to port 8080 in the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward pod/e-commerce-pod 6379 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Get the output from running the 'go' command inside the monitoring-pod container. | Command:
```bash
kubectl exec monitoring-pod -- go
```
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 kubectl.kuberne... |
Load the kubectl completion code into the current shell for zsh | Command:
```bash
source <(kubectl completion zsh)
```
What it does:
Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .bash_profile.
Detailed instructions on how to do thi... |
Automatically scale the 'foo' deployment, with the number of pods ranging from 4 to 10. | Command:
```bash
kubectl autoscale deployment foo --min=4 --max=10
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Forward port 6379 on localhost and IP 10.19.21.23 to port 5432 in the pod named 'security-service-pod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 6379: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 th... |
Forward traffic from local port 8000 to the pod/api-service-pod's port 8000 | Command:
```bash
kubectl port-forward pod/api-service-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 au... |
Create a job called security-scan-job that uses the dotnet/core/runtime image and runs the command "dotnet --list-runtimes" | Command:
```bash
kubectl create job security-scan-job --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-runtimes
```
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"... |
Set the service account for a deployment to "vault" | Command:
```bash
kubectl set serviceaccount deployment mydeployment vault
```
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 servic... |
Listen locally on port 9090 and forward traffic to/from port 8081 in a pod selected by the mydeployment deployment. | Command:
```bash
kubectl port-forward deployment/mydeployment 9090 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 selecte... |
Create a new config map named 'app-name-config' with the specified keys and files | Command:
```bash
kubectl create configmap app-name-config --from-file=properties=/path/to/data/file1.txt --from-file=key1=/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... |
List the pod specified in the "params.yaml" file using JSON output format. | Command:
```bash
kubectl get -f params.yaml -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 only see resul... |
Create a new config map named "app-name-config" with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a conf... |
Forward the local port 3000 to the pod's port 3000 in the 'log-aggregator-pod' pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 3000: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... |
List the resources of different types by their names | Command:
```bash
kubectl get rc/web service/gateway-rc pods/vpn-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 namespaced... |
Delete all pods and services with the label app=web-app | Command:
```bash
kubectl delete pods,services -l app=web-app
```
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... |
Update the label of the pod 'web' with the value 'v2.0' for the label 'release' | Command:
```bash
kubectl label pods web release=v2.0
```
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 t... |
Expose the replicated ruby service on port 9090, connecting to the containers on port 8888 | Command:
```bash
kubectl expose rc ruby --port=9090 --target-port=888800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Copy a file from a remote pod to the local machine. | Command:
```bash
kubectl cp argocd/load-balancer-pod-9:/tmp/foo :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubect... |
Autoscale the replication controller "backend" with a target CPU utilization of 90% and a maximum of 6 pods. | Command:
```bash
kubectl autoscale rc backend --max=6 --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 uses... |
Import specific keys from a config map into the deployment's environment variables. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config-prod 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 varia... |
Forward local port 6379 to port 8081 in a pod selected by the log-aggregator-deployment deployment. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 6379 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 wi... |
Create an ingress resource called 'public-service-ingress' with a rule that directs requests for 'testing.com/input' to the service 'svc1' on port 7000, using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.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": ... |
Add a taint with the key 'dedicated' and value 'web-node-8:PreferNoSchedule' on nodes having the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app dedicated=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": "Ou... |
import the "max_connections" key from the "global-config" ConfigMap into the "payment-processor-deployment" Deployment | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/global-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 variabl... |
Create a cluster role named "foo" with the following parameters: | Command:
```bash
kubectl create clusterrole foo --verb=connect --resource=services --resource-name=image-processor --resource-name=nginx-proxy
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client... |
Partially update a node using a strategic merge patch by specifying the patch as JSON. | Command:
```bash
kubectl patch node dev-node-4 -p '{"stringData":{"password":"new-password"}'
```
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... |
Import the 'smtp_server' key from the 'app-config' ConfigMap and update the 'proxy-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-config deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Roll back to a previous revision of a daemonset | Command:
```bash
kubectl rollout undo daemonset/app-v2 --to-revision=7
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the ... |
Create a service to expose the replicated hazelcast with a service port of 8010, which will connect to the containers on port 808800. | Command:
```bash
kubectl expose rc hazelcast --port=8010 --target-port=808800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Add a taint with key 'workload' and value 'storage-node-13:PreferNoSchedule' on nodes having the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production workload=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": "... |
Forward all traffic from port 5432 on all addresses to the backend-pod's port 5432 | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5432: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 ... |
Import the specific keys "config_file_path" from the config map "env-vars" into the deployment "search-engine-deployment" using the command "kubectl set env --keys=config_file_path --from=configmap/env-vars deployment/search-engine-deployment" | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/env-vars 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 defini... |
Create a new config map named app-settings with the specified keys using the provided files | Command:
```bash
kubectl create configmap app-settings --from-file=properties=/path/to/preferences/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 creating ... |
Add a taint with key 'app' on nodes having label cluster=my-cluster | Command:
```bash
kubectl taint node -l cluster=my-cluster app=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": "... |
Create a job named "report-generation-job" that uses the "jenkins" image and runs the command "java -jar /usr/share/jenkins/jenkins.war" | Command:
```bash
kubectl create job report-generation-job --image=jenkins -- java -jar /usr/share/jenkins/jenkins.war
```
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", ... |
Create a pod disruption budget named messaging-pdb that selects pods with the version=v2 label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget messaging-pdb --selector=version=v2 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dr... |
Get the output from running the 'redis-cli' command in the 'mycontainer' container from the 'payment-gateway-pod' pod | Command:
```bash
kubectl exec payment-gateway-pod -c mycontainer -- redis-cli
```
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 omitt... |
Start port forwarding between local port 8088 and pod port 8088 for the cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8088 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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/log-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 definit... |
Update the CPU limit of the container named 'container-name' in the 'prod-node-5' node using a strategic merge patch | Command:
```bash
kubectl patch node prod-node-5 -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 ... |
Create a job named "certificate-renewal" using the "node" image with the command "node" | Command:
```bash
kubectl create job certificate-renewal --image=node -- node
```
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 format. O... |
Update a specific node by setting the "unschedulable" property to true using a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node testing-node-11 -p '{"spec":{"unschedulable":true}}'
```
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]`
H... |
Create a new config map named app-secrets with the keys conf and data, using files /path/to/configs/file1.txt and /path/to/properties/file2.txt respectively. | Command:
```bash
kubectl create configmap app-secrets --from-file=conf=/path/to/configs/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 a con... |
Update the status label of a pod specified in the "parameters.yaml" file to "unhealthy" | Command:
```bash
kubectl label -f parameters.yaml status=unhealthy
```
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", ... |
Run the 'nginx' command in the "cosmic-container" from the pod "vpn-service-pod" and get the output | Command:
```bash
kubectl exec vpn-service-pod -c cosmic-container -- nginx
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a job named data-migration-job using the centos image and executing the command "yum install -y wget" | Command:
```bash
kubectl create job data-migration-job --image=centos -- yum install -y wget
```
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": "... |
Create an ingress called 'public-api-ingress' that routes requests from foo.com/module to svc1:3000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress public-api-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": "", "us... |
Listen on port 8080 on your local machine and forward the traffic to port 8888 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
Execute the command "jenkins --version" in the pod "analytics-pod" with the container "stardust-shuttle" and get the output. | Command:
```bash
kubectl exec analytics-pod -c stardust-shuttle -- jenkins --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
Add a taint with key 'hardware' on nodes having label feature=feature-xyz to prefer no scheduling | Command:
```bash
kubectl taint node -l feature=feature-xyz hardware=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": "", "u... |
Create a Pod Disruption Budget named api-service-pdb that ensures at least one pod with the label env=production is available at all times. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=env=production --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... |
Update the deployment 'cache-cluster-deployment' by adding a new environment variable | Command:
```bash
kubectl set env deployment/cache-cluster-deployment QUEUE_NAME=task-queue
```
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 tem... |
Forward traffic from your local machine's ports 6379 and 6000 to ports 6379 and 6000 respectively of the pod selected by the authentication-service-deployment deployment. | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 6379 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, ... |
Listen on ports 8888 locally, forwarding data to/from port 5000 in the pod "web-app-pod" | Command:
```bash
kubectl port-forward pod/web-app-pod 8888 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a new config map named monitoring-config using the files file1.txt and file2.txt | Command:
```bash
kubectl create configmap monitoring-config --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/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... |
Add a taint with the key 'app' on nodes that have the label 'release=beta' | Command:
```bash
kubectl taint node -l release=beta app=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output form... |
Start a MySQL pod and expose port 8181 | Command:
```bash
kubectl run hazelcast --image=mysql --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... |
Create a cron job with a scheduled system health check command | Command:
```bash
kubectl create cronjob system-health-check --image=python --schedule="*/1 * * * *" -- pip --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "sho... |
Create a new config map named monitoring-config and populate it with the specified key-value pairs | Command:
```bash
kubectl create configmap monitoring-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/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 con... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/api-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 def... |
Run a proxy to the Kubernetes API server on a random local port | Command:
```bash
kubectl proxy --port=0
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote Kubernetes API server... |
Create a copy of the 'e-commerce-pod' and change all container images to 'mysql'. The copy should be named 'debug-image-api'. | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-api --set-image=*=mysql
```
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 a service for the replicated wordpress using the replica set 'wordpress', which serves on port 9090 and connects to the containers on port 300000 | Command:
```bash
kubectl expose rs wordpress --port=9090 --target-port=300000
```
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... |
Create a cluster role named "admin_role" with the following permissions: | Command:
```bash
kubectl create clusterrole admin_role --verb=proxy --resource=configmaps --resource-name=billing-service --resource-name=payment-processor
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=... |
Forward local traffic on port 8080 to the pod's port 8888, and listen on both localhost and IP address 10.19.21.23 for the backend-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-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 criteri... |
Attach to the pod 'security-service-pod' and switch to raw terminal mode. | Command:
```bash
kubectl attach security-service-pod -c nebula-navigator -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 na... |
Forward traffic from port 8088 on all addresses to port 8080 in the pod "chat-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 8088: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... |
Create a single ingress called 'public-service-ingress' that directs requests to website.com/module to svc # svc1:9092 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/module=svc1:9092,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":... |
Retrieve the previous terminated logs of the 'astro-container' container from the 'vpn-service-pod' pod. | Command:
```bash
kubectl logs -p -c astro-container 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... |
Set the CPU limit to "100m" and memory limit to "2Gi" for the Jenkins container in the deployment named "jenkins". | Command:
```bash
kubectl set resources deployment jenkins -c=nginx --limits=cpu=100m,memory=2Gi
```
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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/log-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 in o... |
Embed the certificate authority data for the prod-cluster cluster entry by running the command: | Command:
```bash
kubectl config set-cluster prod-cluster --embed-certs --certificate-authority=~/.kube/my-k8s-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 s... |
Set the cluster field in the prod-context context to cluster-alpha | Command:
```bash
kubectl config set contexts.prod-context.cluster cluster-alpha
```
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... |
Scale the replication controller "backend" to automatically adjust the number of pods between 1 and 5, based on the target CPU utilization of 81%. | Command:
```bash
kubectl autoscale rc backend --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 uses... |
Forward traffic from port 8081 on all addresses to port 8080 in the e-commerce-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8081: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... |
Create a deployment named "auth" with the image "mysql" and label it as "mysql". | Command:
```bash
kubectl create deployment auth --image=mysql -- mysql
```
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|ya... |
Execute the 'nginx' command in the first container of the 'email-service' service's first pod and retrieve the output. | Command:
```bash
kubectl exec svc/email-service -- nginx
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.k... |
Import the 'debug_mode' key from the 'ui-config' config map into the 'database-deployment' deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/ui-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 o... |
Update the image of all containers in the daemonset 'nginx' to 'wordpress:5.8.1' | Command:
```bash
kubectl set image daemonset nginx *=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), replicaset (rs)
Syntax:
`ku... |
Execute the command 'elasticsearch --version' in the 'cyber-sleuth' container of the 'api-service-pod' pod to get the output. | Command:
```bash
kubectl exec api-service-pod -c cyber-sleuth -- elasticsearch --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 nam... |
Create a debug session for e-commerce-pod and copy it to debug-image-web with the container name lunar-launcher | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=debug-image-web --container=lunar-launcher -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by... |
Import the DEBUG_MODE key from the app-secrets config map and set it as an environment variable for the scheduler-app-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-secrets deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/monitoring-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 def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.