prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a deployment called 'mattermost' using the 'nginx' image and set the number of replicas to 5. | Command:
```bash
kubectl create deployment mattermost --image=nginx --replicas=5
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One o... |
Create a pod disruption budget named "notification-service-pdb" that selects all pods with the label "component=web" and requires at least one of them to be available at any time. | Command:
```bash
kubectl create poddisruptionbudget notification-service-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-ava... |
Create an ingress called 'private-service-ingress' with a rule that routes requests from foo.com/example to svc1:9090, using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="foo.com/example=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Create a copy of the database-pod, changing the command of the quantum-quark container, and enter into an interactive shell session | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-web --container=quantum-quark -- 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 de... |
Execute the command 'apache2ctl -D FOREGROUND' inside the first container of the 'analytics-platform-deployment' deployment and get the output. | Command:
```bash
kubectl exec deploy/analytics-platform-deployment -- 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": "Contain... |
Create an ingress named 'api-gateway-ingress' with a rule that directs requests for 'site.com/bar' to service 'svc1' on port '8010', and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/bar=svc1:8010,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Create a new config map named app-config with the following keys and file paths: settings=/path/to/parameters/file1.txt and key2=/path/to/configurations/file2.txt | Command:
```bash
kubectl create configmap app-config --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/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... |
Forward traffic from a randomly assigned local port to port 9090 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod :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... |
Create a copy of the frontend-pod with a debug container and change the container images to debian for the debug container and nginx:1.21 for the proxy container and nginx:latest for the web container. | Command:
```bash
kubectl debug frontend-pod -it --copy-to=dgb-img --image=debian --set-image=proxy=nginx:1.21,web=nginx:latest
```
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. Po... |
Set up port forwarding to a pod to listen on a local port and forward data to/from a specific port in the pod. | Command:
```bash
kubectl port-forward pod/cdn-service-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 be selected au... |
List the replication controller 'web', the service 'gateway-rc', and the pod 'security-service-pod' | Command:
```bash
kubectl get rc/web service/gateway-rc pods/security-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 names... |
Import environment from secret to a deployment | Command:
```bash
kubectl set env --from=secret/api-secret-key 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 in one or more pod t... |
Forward traffic from a local port to a port in the specified pod | Command:
```bash
kubectl port-forward pod/analytics-pod :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 automati... |
Add a taint with the key 'special' and value 'kube-master-9:PreferNoSchedule' on nodes that have the label 'component=proxy'. | Command:
```bash
kubectl taint node -l component=proxy special=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"... |
Remove the label 'bar' from the pod 'web' | Command:
```bash
kubectl label pods web role-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true, ch... |
Forward traffic from local port 3000 to port 8888 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 3000 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Open the proxy-service service definition file for editing using the "code" editor | Command:
```bash
KUBE_EDITOR="code" kubectl edit svc/proxy-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, ... |
Create an ingress called 'web-ingress' with a rule that directs requests from site.com/bar to svc1 on port 3306, using the tls secret named "my-cert". | Command:
```bash
kubectl create ingress web-ingress --rule="site.com/bar=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": "", "usage": "Ou... |
Specify new exec auth plugin arguments for the "john.doe" entry | Command:
```bash
kubectl config set-credentials john.doe --exec-arg=arg1 --exec-arg=arg2
```
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 f... |
Display the logs from the email-service-pod that were written in the past hour. | Command:
```bash
kubectl logs --since=1h email-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... |
Import the environment variables from the aws-credentials-secret secret and set them for the proxy-service-deployment deployment. | Command:
```bash
kubectl set env --from=secret/aws-credentials-secret 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 definitions in one ... |
Update the 'monitoring-stack-deployment' deployment by setting the environment variable JWT_SECRET to 'your-jwt-secret'. | Command:
```bash
kubectl set env deployment/monitoring-stack-deployment JWT_SECRET=your-jwt-secret
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more... |
Forward local port 5432 to port 6379 of the pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5432 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Create a new secret named private-key-secret from an env file | Command:
```bash
kubectl create secret generic private-key-secret --from-env-file=path/to/configs.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 ba... |
Create a copy of a pod named web-app-pod and add a debug container, changing the container images to debian for the debug container and nginx:latest for the web container | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-memcached --image=debian --set-image=app=app:debug,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource an... |
Forward port 6379 on all addresses to port 3000 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 6379: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 po... |
Update the annotations of a pod identified in the "params.json" file, specifically adding the annotation "alert-email" with the value "alerts@example.com" | Command:
```bash
kubectl annotate -f params.json alert-email=alerts@example.com
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and inclu... |
Partially update a node by applying a strategic merge patch using a JSON file. | Command:
```bash
kubectl patch node backup-node-14 -p '{"spec":{"type":"LoadBalancer"}'
```
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... |
Update the password field of a specific node by providing a strategic merge patch in JSON format | Command:
```bash
kubectl patch node db-node-7 -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]... |
Forward traffic from local port 8080 to port 8080 on the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 8080: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 auto... |
Get the output from running the 'go version' command in the first container of the first pod of the 'proxy-service' service. | Command:
```bash
kubectl exec svc/proxy-service -- go 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 kube... |
Create a new config map named ui-config with specified keys from files | Command:
```bash
kubectl create configmap ui-config --from-file=conf=/path/to/properties/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 ... |
Create a new config map named 'app-secrets' using the 'properties' key and file '/path/to/preferences/file1.txt' and the 'key1' key and file '/path/to/profiles/file2.txt' instead of file basenames on disk. | Command:
```bash
kubectl create configmap app-secrets --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/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 creati... |
Forward traffic from port 9090 on localhost and IP address 10.19.21.23 to port 6379 in the backend-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 9090:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Stream the logs of the 'stardust-shuttle' container in the 'analytics-pod' pod | Command:
```bash
kubectl logs -f -c stardust-shuttle analytics-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 specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/env-vars 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 ... |
Set the CPU limits of the nginx container in the deployment to "3" and the memory limits to "4Gi" | Command:
```bash
kubectl set resources deployment nginx -c=nginx --limits=cpu=3,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 its ... |
Execute 'mongo' command inside the first container of the first pod of the 'web-app-deployment' deployment. | Command:
```bash
kubectl exec deploy/web-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 the k... |
Forward all traffic coming to port 5432 on any address to port 8081 inside the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 5432: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... |
Scale the deployment named "frontend-rs" to 5 replicas, assuming the current size is 3. | Command:
```bash
kubectl scale --current-replicas=3 --replicas=5 deployment/frontend-rs
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version... |
Return the logs from the container 'web-app-pod-1' of the 'frontend-deployment' deployment | Command:
```bash
kubectl logs deployment/frontend-deployment -c web-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:
"flag": "-... |
import environment variables from a config map with a specific prefix for a deployment | Command:
```bash
kubectl set env --from=configmap/api-config --prefix=MYSQL_ 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 definiti... |
Forward local ports 8088 and 6000 to a pod selected by the deployment "analytics-platform-deployment", where the data will be forwarded to/from ports 8080 and 6000. | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 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 po... |
Create a copy of the 'database-pod' with all container images changed to 'mysql', renaming the copy to 'debug-image-api' | Command:
```bash
kubectl debug database-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 reso... |
Create a single ingress called 'internal-ingress' that directs requests to website.com/module to the service 'svc1' on port 5001, and use the TLS secret "my-cert". | Command:
```bash
kubectl create ingress internal-ingress --rule="website.com/module=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": "", "... |
Forward all traffic from port 8081 on all addresses to port 8888 in the web-app-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8081: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 ... |
Check if the current user is authorized to list the 'backup-job' job in the 'kube-node-lease' namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/backup-job -n kube-node-lease
```
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... |
Create a debug container in web-app-pod with a custom image and change the image of the worker container | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-api --image=debian --set-image=worker=my-custom-worker:1.2.3,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects id... |
Scale the deployment named db-migration-replicaset's replica size to 1 if the current size is 3 | Command:
```bash
kubectl scale --current-replicas=3 --replicas=1 deployment/db-migration-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 --reso... |
Listen for traffic on port 8888 on both localhost and IP 10.19.21.23, and forward it to port 9090 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888: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... |
Update the service account for the 'web-app-deployment' deployment to 'metrics-server' | Command:
```bash
kubectl set serviceaccount deployment web-app-deployment metrics-server
```
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:
`kub... |
Import the `SECRET_KEY` key from the `api-config` ConfigMap to the `monitoring-stack-deployment` deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/api-config deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Copy the '/tmp/foo_dir' directory from the remote pod 'kube-server/security-scanner-pod-18' to the local directory '/etc/kubernetes'. | Command:
```bash
kubectl cp kube-server/security-scanner-pod-18:/tmp/foo_dir /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 omit... |
Set up autoscaling for the "web" deployment, with a minimum of 2 pods and a maximum of 12 pods | Command:
```bash
kubectl autoscale deployment web --min=2 --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 uses the... |
Set the resource request and limits for all containers in the Kafka deployment. | Command:
```bash
kubectl set resources deployment kafka --limits=cpu=200m,memory=512Mi --requests=cpu=500m,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 request... |
Import specific keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/monitoring-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... |
Delete the pods and services with the names "auth" and "backend" | Command:
```bash
kubectl delete pod,service auth backend
```
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 resource request and limits for all containers in the alpine deployment | Command:
```bash
kubectl set resources deployment alpine --limits=cpu=200m,memory=512Mi --requests=cpu=3,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,... |
Retrieve the output of the command 'node --version' executed in the nano-bot container of the pod gateway-pod. | Command:
```bash
kubectl exec gateway-pod -c nano-bot -- node --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, us... |
List the replication controller 'web', the service 'vpn-service-rc', and the pod 'media-stream-pod' | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/media-stream-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is names... |
Import the 'redis_host' key from the 'namespace-config' ConfigMap and set it as an environment variable for the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/namespace-config deployment/analytics-platform-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Create an ingress called 'website-ingress' that routes requests from foo.com/input to the service named svc1 running on port 7000 | Command:
```bash
kubectl create ingress website-ingress --rule="foo.com/input=svc1:7000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
create a new ExternalName service named external-identity-provider-service with the external name "illustration-shop.shop" | Command:
```bash
kubectl create service externalname external-identity-provider-service --external-name illustration-shop.shop
```
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 ... |
Add a taint with key 'cpu-type' on nodes having the label cluster=my-cluster | Command:
```bash
kubectl taint node -l cluster=my-cluster cpu-type=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": "", "... |
Roll back to a specific revision of a daemonset. | Command:
```bash
kubectl rollout undo daemonset/services --to-revision=3
```
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 th... |
Forward local traffic from port 5000 to port 8080 in a pod named e-commerce-pod. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 5000: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... |
Add the label 'component=worker' to the pod 'vpn' | Command:
```bash
kubectl label pods vpn component=worker
```
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": "... |
List the replication controller with the name "web", the service with the name "log-aggregator-rc", and the pod with the name "cdn-service-pod" | Command:
```bash
kubectl get rc/web service/log-aggregator-rc pods/cdn-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 nam... |
Retrieve the output from running the 'elasticsearch' command in the first pod of the 'user-management-deployment' deployment. | Command:
```bash
kubectl exec deploy/user-management-deployment -- elasticsearch
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Create a pod disruption budget named critical-services-pdb that selects all pods with the role=worker label and ensures that a minimum of four of them are available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=role=worker --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-availabl... |
Add a taint on nodes labeled with 'team=devops' and key 'disktype' with the value 'node-2:PreferNoSchedule' | Command:
```bash
kubectl taint node -l team=devops disktype=node-2: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 ... |
Copy the local file /tmp/foo to the remote pod metrics-exporter-pod-10 in the container auth-service, and place it at /tmp/bar. | Command:
```bash
kubectl cp :/tmp/foo metrics-exporter-pod-10::/tmp/bar -c auth-service
```
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, ... |
Listen on port 8088 locally, forwarding data to/from port 9090 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-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 a... |
Create a job named 'database-seeding-job' with the 'mongo' image, running the 'mongod' command. | Command:
```bash
kubectl create job database-seeding-job --image=mongo -- mongod
```
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 forma... |
Create a pod named 'hazelcast' running the 'nginx' image and expose port 8089. | Command:
```bash
kubectl run hazelcast --image=nginx --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:
"flag": "--fi... |
Add a taint with key 'environment' on nodes having label tier=frontend | Command:
```bash
kubectl taint node -l tier=frontend environment=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 copy of the 'vpn-service-pod' pod, changing the command of the 'lunar-launcher' container to 'sh'. | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=debug-image-memcached --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 ... |
Return snapshot logs from container chat-app-pod-1 of a deployment named api-server-deployment. | Command:
```bash
kubectl logs deployment/api-server-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:
"flag":... |
List deployments in YAML output format using the "custom-version" version of the "beta-apps" API group. | Command:
```bash
kubectl get deployments.custom-version.beta-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 y... |
Get the output of the command 'nginx -t' running inside the 'stardust-shuttle' container from the 'e-commerce-pod' pod | Command:
```bash
kubectl exec e-commerce-pod -c stardust-shuttle -- nginx -t
```
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... |
Get the version of a gem in a specific deployment | Command:
```bash
kubectl exec deploy/order-processing-deployment -- gem --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Create an ingress named 'app-loadbalancer-ingress' that routes requests to 'site.com/input' to service 'svc1' on port '8089', with a TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="site.com/input=svc1:8089,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Create an ingress called 'default-ingress' with a rule that directs requests to testing.com/input to svc1:5000, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="testing.com/input=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": "", "us... |
Create a cron job named "alerts-cleanup" with a centos image that runs the command "sleep 3600" every minute. | Command:
```bash
kubectl create cronjob alerts-cleanup --image=centos --schedule="*/1 * * * *" -- sleep 3600
```
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 a deployment named "logging" with the image "wordpress" and expose port 5001. | Command:
```bash
kubectl create deployment logging --image=wordpress --port=5001
```
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... |
Create an ingress called 'app-ingress' with a rule that directs requests from testing.com/example to svc1:9091, using the tls secret "my-cert". | Command:
```bash
kubectl create ingress app-ingress --rule="testing.com/example=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Add a taint with the key 'workload' and value 'monitoring-node-15:PreferNoSchedule' to all nodes having the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace workload=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":... |
Import the "SMTP_SERVER" key from the "app-name-config" ConfigMap into the environment variables of the "notification-handler-deployment" Deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-name-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 variab... |
Start a python pod with the name 'nginx', using the image 'python', but overwrite the pod's specifications with a partial set of values parsed from the provided JSON. | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "v1.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAN... |
Update the annotation of a pod named 'payment' with the value '99.9% uptime' | Command:
```bash
kubectl annotate pods payment SLA='99.9% uptime'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary s... |
Forward traffic from port 9090 on your localhost and IP 10.19.21.23 to port 8000 in the pod named "security-service-pod". | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 9090: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 th... |
Create a deployment named grafana with 3 replicas running the postgres image. | Command:
```bash
kubectl create deployment grafana --image=postgres --replicas=3
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One o... |
Forward local port 8081 to port 9090 in the pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8081: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... |
Create a new config map named monitoring-config using the key=value pairs in the profiles file. | Command:
```bash
kubectl create configmap monitoring-config --from-file=path/to/profiles
```
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 monitoring-pod with all container images changed to wordpress | Command:
```bash
kubectl debug monitoring-pod --copy-to=debug-image-1 --set-image=*=wordpress
```
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 ... |
Forward traffic from port 8000 on all addresses to port 5432 in the 'cdn-service-pod' pod using the command 'kubectl port-forward' | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-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 w... |
Create a debug container with a copy of the analytics-pod, changing the command of warp-drive. | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-web --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... |
Partially update the 'storage-node-13' node by specifying the patch as YAML | Command:
```bash
kubectl patch node storage-node-13 -p $'spec:\n replicas: 3'
```
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]`
Helpful flag... |
Create a deployment named mattermost that uses the python image | Command:
```bash
kubectl create deployment mattermost --image=python
```
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|yaml... |
Add a taint to nodes labeled with "feature=feature-xyz" with the key "hardware" and value "k8s-node-1:PreferNoSchedule" | Command:
```bash
kubectl taint node -l feature=feature-xyz 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": "", "usag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.