prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward traffic from your local port 5000 to port 6379 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 5000: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 select... |
Create a job and run a command within it | Command:
```bash
kubectl create job audit-job --image=amazonlinux -- /bin/bash -c "echo 'Hello
```
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":... |
Scale the deployment "api-service-rs" to have 5 replicas, if its current size is 1. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=5 deployment/api-service-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-vers... |
List deployments in JSON output format, using the "legacy-1.0.0" version of the "beta-apps" API group | Command:
```bash
kubectl get deployments.legacy-1.0.0.beta-apps -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... |
Create an autoscaler for the replication controller "analytics" with a maximum of 6 pods and a target CPU utilization of 90% | Command:
```bash
kubectl autoscale rc analytics --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 us... |
Set the resource request and limits for all containers in the "postgres" deployment | Command:
```bash
kubectl set resources deployment postgres --limits=cpu=200m,memory=512Mi --requests=cpu=50m,memory=512Mi
```
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 requ... |
Create an ingress with TLS enabled using the default ingress certificate and different path types | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="site.com/=svc:https,tls" \
--rule="testing.com/path/subpath*=othersvc:8888"
```
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": "... |
Change the cluster field in the admin-context context to cluster-alpha | Command:
```bash
kubectl config set contexts.admin-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 w... |
Create an ingress called 'public-ingress' that directs requests from site.com/input to svc1:8084 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="site.com/input=svc1:8084,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
get the output of the 'apache2ctl -D FOREGROUND' command from the nano-bot container in the cdn-service-pod pod | Command:
```bash
kubectl exec cdn-service-pod -c nano-bot -- apache2ctl -D FOREGROUND
```
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. ... |
Start a pod named 'nginx' using the 'alpine' image | Command:
```bash
kubectl run nginx --image=alpine
```
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": "--filename", "short... |
Forward port 8000 locally to port 5432 in the pod | Command:
```bash
kubectl port-forward pod/web-app-pod 8000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a priority class named 'low-priority' with a value of 10 and a description of "Minimal resource allocation, lowest priority" | Command:
```bash
kubectl create priorityclass low-priority --value=10 --description="Minimal resource allocation, lowest priority" --preemption-policy="Never"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VAL... |
Import environment variables from a config map with a specific prefix | Command:
```bash
kubectl set env --from=configmap/log-config --prefix=MYSQL_ 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 defin... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-secrets 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 defin... |
Set the resource request and limits for all containers in the php deployment | Command:
```bash
kubectl set resources deployment php --limits=cpu=200m,memory=512Mi --requests=cpu=1,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, bu... |
Get output from running the 'mongo' command from the first container of the first pod of the deployment scheduler-app-deployment | Command:
```bash
kubectl exec deploy/scheduler-app-deployment -- 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... |
Set a custom TLS server name for the web-cluster cluster configuration. | Command:
```bash
kubectl config set-cluster web-cluster --tls-server-name=cluster-beta
```
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-... |
Import the keys 'config_file_path' from the config map 'kube-system-config' into the deployment 'order-processing-deployment'. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/kube-system-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment va... |
Display the current context configuration | Command:
```bash
kubectl config current-context
```
What it does:
Display the current-context.
Syntax:
`kubectl config current-context` |
Create a deployment of an API using the PHP image and running the composer command with a specific version. | Command:
```bash
kubectl create deployment api --image=php -- composer --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 format. One o... |
Set a custom TLS server name for the galaxy-cluster cluster entry | Command:
```bash
kubectl config set-cluster galaxy-cluster --tls-server-name=cloud-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certific... |
Attach to the 'astro-container' inside the 'security-service-pod' and switch to raw terminal mode, so that you can interact with the 'bash' shell inside the container and receive the output on your client | Command:
```bash
kubectl attach security-service-pod -c astro-container -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 nam... |
Import the 'redis_host' key from the 'env-vars' config map into the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/env-vars deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Copy the local file `/tmp/foo_dir` to the remote pod `load-balancer-pod-9` in the `kube-public` namespace, and place it in the `/tmp/bar_dir` directory. | Command:
```bash
kubectl cp /tmp/foo_dir kube-public/load-balancer-pod-9:/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, us... |
Create a debug container from an existing pod, making a copy of the analytics-pod and changing the command to `sh` in the new container | Command:
```bash
kubectl debug analytics-pod -it --copy-to=dgb-img --container=nebula-navigator -- 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 defaul... |
Create a debug container named 'debug-image-api' with the same configuration as 'e-commerce-pod', but with all container images changed to 'postgres' | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-api --set-image=*=postgres
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no... |
Create a deployment named "wordpress" using the specified image | Command:
```bash
kubectl create deployment wordpress --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-sdks
```
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", "defa... |
Create a cluster role named "foo" with ResourceName specified for the resources "configmaps" and "notification-service" | Command:
```bash
kubectl create clusterrole foo --verb=create --resource=configmaps --resource-name=notification-service --resource-name=machine-learning
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=se... |
Get the output from running the 'mysqld' command in the 'code-explorer' container from the 'payment-gateway-pod' pod. | Command:
```bash
kubectl exec payment-gateway-pod -c code-explorer -- mysqld
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Delete the pods and services named "database" and "foo" | Command:
```bash
kubectl delete pod,service database foo
```
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.
So... |
Set the service account of the 'scheduler-app-deployment' deployment to 'istio'. | Command:
```bash
kubectl set serviceaccount deployment scheduler-app-deployment istio
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kubect... |
Forward traffic from a local port to a specific port in a pod. | Command:
```bash
kubectl port-forward pod/api-service-pod :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... |
Create a new deployment named "api" with the "ruby" image, and specify the command to run as "ruby --version". | Command:
```bash
kubectl create deployment api --image=ruby -- ruby --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 format. One of: ... |
Listen on port 8081 on all addresses and forward traffic to port 8081 in the pod named 'proxy-server-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-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 ... |
scale the deployment named web from 3 replicas to 5 replicas | Command:
```bash
kubectl scale --current-replicas=3 --replicas=5 deployment/web
```
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 spec... |
Add a taint with key 'zone' on nodes having label feature=feature-xyz | Command:
```bash
kubectl taint node -l feature=feature-xyz zone=k8s-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": ... |
Taint the nodes in the eu-west-2 region with the key 'hardware' and value 'k8s-node-1:PreferNoSchedule' | Command:
```bash
kubectl taint node -l region=eu-west-2 hardware=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Create a single ingress called 'api-v1-ingress' that directs requests to foo.com/module to the svc1 service on port 9000, with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.com/module=svc1:9000,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 new config map with specific keys instead of file basenames by providing the file paths | Command:
```bash
kubectl create configmap db-config --from-file=properties=/path/to/settings/file1.txt --from-file=key1=/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 job named 'image-build-job' using the 'postgres' image, and run the 'pg_dump --version' command inside the job. | Command:
```bash
kubectl create job image-build-job --image=postgres -- pg_dump --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Import the 'debug_mode' key from the 'db-config' config map into the 'authentication-service-deployment' deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/db-config deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Add a taint with the key 'cpu-type' and the value 'monitoring-node-15:PreferNoSchedule' on nodes having the label 'feature=feature-xyz' | Command:
```bash
kubectl taint node -l feature=feature-xyz cpu-type=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": "... |
Add a taint with key 'special' on nodes having label service=auth, set the taint 'PreferNoSchedule' on node-1. | Command:
```bash
kubectl taint node -l service=auth special=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 ... |
Get the information about the replication controller named "web", the service named "database-rc", the pods named "gateway-pod" | Command:
```bash
kubectl get rc/web service/database-rc pods/gateway-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced yo... |
Create a single ingress called 'www-ingress' with a rule that directs requests to 'site.com/bar' to the service 'svc1:5001' | Command:
```bash
kubectl create ingress www-ingress --rule="site.com/bar=svc1:5001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Create a pod disruption budget named 'cache-cluster-pdb' that will select all pods with the label 'role=worker' and require a minimum of 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=role=worker --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Create a cluster role named "bar" with the verbs "watch" and resource "configmaps" | Command:
```bash
kubectl create clusterrole bar --verb=watch --resource=configmaps --resource-name=search-elasticsearch --resource-name=log-aggregator
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=serve... |
Scale the deployment named webapp-replicaset to 1 replica if its current size is 1 | Command:
```bash
kubectl scale --current-replicas=1 --replicas=1 deployment/webapp-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-v... |
Create a pod disruption budget named auth-service-pdb that will select all pods with the version=v2 label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget auth-service-pdb --selector=version=v2 --min-available=4
```
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 [-... |
Forward local port 8000 to port 8080 in the pod "proxy-server-pod" using the command "kubectl port-forward" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 8000: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 cr... |
Forward local port 8888 to port 8888 in the pod "mypod" | Command:
```bash
kubectl port-forward pod/mypod 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 automaticall... |
Forward traffic from port 5000 on all addresses to port 5432 in the pod named web-app-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 5000: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 ... |
Copy a file from a remote pod to a local directory | Command:
```bash
kubectl cp ingress-nginx/cache-pod-5:/tmp/foo /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
Create a debug copy of the chat-app pod by changing all container images to Ubuntu | Command:
```bash
kubectl debug chat-app-pod --copy-to=debug-image-1 --set-image=*=ubuntu
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resou... |
Mark node "node-1" as unschedulable | Command:
```bash
kubectl cordon node-1
```
What it does:
Mark node as unschedulable.
Syntax:
`kubectl cordon NODE`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selector (label query) to filter on " |
Get the logs of the previous terminated time-machine container from the pod named api-service-pod. | Command:
```bash
kubectl logs -p -c time-machine api-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", ... |
Import the DATABASE_URL key from the app-config-prod config map and set it as an environment variable in the web-app-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config-prod 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 definitio... |
Create an ingress resource called 'private-ingress' with a rule that directs requests for 'site.com/module' to the service 'svc1:5000' and uses the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress private-ingress --rule="site.com/module=svc1:5000,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... |
Copy the /tmp/foo_dir directory from the web-app-pod-1 pod to the local /tmp/bar directory | Command:
```bash
kubectl cp kube-proxy/web-app-pod-1:/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 the kubec... |
Forward port 5000 on all addresses to port 9090 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-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 criteria, a pod wil... |
Output the modified deployment "mydeployment" in YAML format with the environment variable S3_BUCKET set to "my-s3-bucket" | Command:
```bash
kubectl set env deployment/mydeployment S3_BUCKET=my-s3-bucket -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 templa... |
Execute the command "go run hello.go" within the container named "nebula-navigator" in the pod named "web-app-pod" and retrieve the output. | Command:
```bash
kubectl exec web-app-pod -c nebula-navigator -- go run hello.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 om... |
import the 'max_connections' key from the 'db-config' config map to the 'frontend-deployment' deployment | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/db-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... |
Create a LoadBalancer service with the name 'analytics-lb' that will map the external TCP port 6379 to the internal port 8088. | Command:
```bash
kubectl create service loadbalancer analytics-lb --tcp=6379:8088
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "defau... |
Update the cpu limit of the kafka container in the deployment named 'kafka' to "200m" and the memory limit to "4Gi" | Command:
```bash
kubectl set resources deployment kafka -c=nginx --limits=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 requested, but may burst up to i... |
Create an ingress resource called 'api-v1-ingress' that directs requests to the URL 'website.com/example' to the service 'svc1' on port '6379' | Command:
```bash
kubectl create ingress api-v1-ingress --rule="website.com/example=svc1:6379,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Forward data between local ports 5000 and 6000 and ports 5432 and 6000 in a specific pod selected by the deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 5000 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 wil... |
Drain a node gracefully with a 5-minute grace period, but abort if there are any unmanaged pods. | Command:
```bash
kubectl drain foo --grace-period=300
```
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 pod disruption budget named payment-gateway-pdb that will select all pods with the tier=frontend label and require a minimum of one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=tier=frontend --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-availabl... |
Import specific keys from a config map to set environment variables for a deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/api-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 defin... |
Add a taint with key 'special' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta special=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": "", "usag... |
Retrieve the logs from the container named chat-app-pod-1 of the deployment named payment-processor-deployment. | Command:
```bash
kubectl logs deployment/payment-processor-deployment -c chat-app-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
... |
Create a Pod Disruption Budget (PDB) named "ingress-controller-pdb" that selects all pods with the label "role=worker" and requires a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=role=worker --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-availab... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/global-config deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
List deployments in the "v1.0.0" version of the "apps" API group in YAML output format. | Command:
```bash
kubectl get deployments.v1.0.0.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 will only ... |
Create a copy of a pod and change all container images to use the Ubuntu image. | Command:
```bash
kubectl debug mypod --copy-to=debug-image-app --set-image=*=ubuntu
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resource i... |
Update the 'cdn' pod's annotation 'last-deployment' with the value '2023-03-15', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods cdn last-deployment='2023-03-15'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and i... |
Import the `config_file_path` keys from the config map and apply them to the `web-app-deployment` deployment. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/env-vars 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 ... |
Remove the "exec-auth" plugin environment variable for the "saas-admin" entry | Command:
```bash
kubectl config set-credentials saas-admin --exec-env=var-to-remove-
```
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 flags... |
Set the resource limits and requests for all containers in the 'mysql' deployment to CPU limit of 200m and memory limit of 512Mi, and CPU request of 100m and memory request of 256Mi. | Command:
```bash
kubectl set resources deployment mysql --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource reques... |
Create a new ExternalName service named 'external-dns-service' with the external name 'blog-test.blog' | Command:
```bash
kubectl create service externalname external-dns-service --external-name blog-test.blog
```
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 ... |
Create a new ClusterIP service named ldap-service-clusterip by mapping port 8080 on the cluster to port 9090 on the service. | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=8080:9090
```
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", "... |
Execute the command 'npm --version' inside the astro-container from the pod api-service-pod. | Command:
```bash
kubectl exec api-service-pod -c astro-container -- 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 o... |
Unset the namespace in the app-1-context context | Command:
```bash
kubectl config unset contexts.app-1-context.namespace
```
What it does:
Unset 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.
Syntax:
`kubectl config unset PROPERTY_NAME` |
Import the 'my-example-key' key from the 'db-config' config map into the 'load-balancer-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/db-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Forward port 8000 locally to the targetPort of the "https" service port in a selected pod by the "user-service" service. | Command:
```bash
kubectl port-forward service/user-service 8000: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 ... |
Forward traffic from port 8088 on localhost and IP address 10.19.21.23 to port 9090 in the pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 p... |
Create a pod disruption budget with the name "api-service-pdb" that selects all pods with the label "region=us-east" and requires a minimum of 9 pods to be available at any given time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=region=us-east --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... |
Update node 'app-node-6' by adding a taint with key 'zone', value 'us-west-1a', and effect 'PreferNoSchedule' | Command:
```bash
kubectl taint nodes app-node-6 zone=us-west-1a: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... |
Copy the local file "/tmp/foo" to the remote pod "velero/api-server-pod-3" in the "/tmp/bar_dir" directory. | Command:
```bash
kubectl cp :/tmp/foo velero/api-server-pod-3:/tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubec... |
Scale the deployment named "monitoring" with a minimum of 4 pods and a maximum of 9 pods | Command:
```bash
kubectl autoscale deployment monitoring --min=4 --max=9
```
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... |
Patch the specified resource using a merge patch from a file using a strategic-merge-patch strategy | Command:
```bash
kubectl patch -f containerd-config.toml -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 FIL... |
Create a pod using the python image, but customize the pod's specifications using a JSON file. | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "beta-1.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMM... |
Check if the current user has permission to list the job named "batch-processing-job" in the "logging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/batch-processing-job -n logging
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial U... |
Create a role named "custom_role" that allows a user to perform "list", "create", and "update" operations on pods. | Command:
```bash
kubectl create role custom_role --verb=list --verb=create --verb=update --resource=pods
```
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|client|none]`
Helpful flags:
... |
Add the label 'env=development' to the pod named 'api' | Command:
```bash
kubectl label pods api env=development
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "I... |
Set the cluster for a specific context to a new value | Command:
```bash
kubectl config set contexts.prod-context.cluster web-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 want... |
Create an ingress named 'private-service-ingress' that maps requests for 'testing.com/module' to the 'svc1' service on port 8080 | Command:
```bash
kubectl create ingress private-service-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"... |
Add a taint to the node 'k8s-node-1' with the key 'disktype' and no value | Command:
```bash
kubectl taint nodes k8s-node-1 disktype: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: j... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.