prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Retrieve the deployments in YAML output format for the "mobile-apps" API group with the version "hotfix-1.1.2". | Command:
```bash
kubectl get deployments.hotfix-1.1.2.mobile-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... |
Attach to the rocket-ranger container in the proxy-server-pod to get its output | Command:
```bash
kubectl attach proxy-server-pod -c rocket-ranger
```
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 omitte... |
Execute the 'postgres' command inside the first pod of the 'frontend-service' service using the first container | Command:
```bash
kubectl exec svc/frontend-service -- postgres
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kub... |
Roll back the daemonset "namespace" to revision 3 | Command:
```bash
kubectl rollout undo daemonset/namespace-3 --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... |
Forward local port 8088 to port 8000 in a pod selected by the search-engine-deployment deployment. | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8088 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 wil... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-config-prod 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 definiti... |
List the replication controller named 'web', the service named 'log-aggregator-rc', and the pod named 'web-app-pod' | Command:
```bash
kubectl get rc/web service/log-aggregator-rc pods/web-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespa... |
Set environment variables for an exec auth plugin entry called "k8s-admin" | Command:
```bash
kubectl config set-credentials k8s-admin --exec-env=key1=val1 --exec-env=key2=val2
```
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
Bea... |
Listen on port 9090 on all addresses, and forward the requests to port 9090 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 9090: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... |
Create a single ingress called 'app-gateway-ingress' that directs requests to website.com/bar to svc1:3306 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.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": "", "... |
Update the image version of the nginx container to 'node:14.17.3' for all deployments and replication controllers. | Command:
```bash
kubectl set image deployments,rc node=node:14.17.3 --all
```
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... |
Create a pod disruption budget with the name "load-balancer-pdb" that will select all pods with the label "tier=frontend" and require at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=tier=frontend --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=... |
Forward traffic from port 9090 on all addresses to port 8081 in the "api-service-pod" pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 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 w... |
Create a deployment named "nats" with the "jenkins" image and expose port 8000 for the deployment. | Command:
```bash
kubectl create deployment nats --image=jenkins --port=8000
```
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: js... |
Create a service for the 'python' deployment, serving on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose deployment python --port=8080 --target-port=801000
```
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 specifi... |
Create a service for the 'centos' replica set, which serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose rs centos --port=80 --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 port. A... |
Embed the certificate authority data for the cluster entry named "web-cluster" | Command:
```bash
kubectl config set-cluster web-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 se... |
Create a service for the replicated ubuntu resource, which serves on port 8082 and connects to the containers on port 500100 | Command:
```bash
kubectl expose rc ubuntu --port=8082 --target-port=500100
```
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.... |
Import specific keys from a config map to an environment variable for a deployment named "proxy-service-deployment". | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/kube-system-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 varia... |
Start a confluentinc/cp-kafka pod and keep it running in the foreground without restarting | Command:
```bash
kubectl run -i -t busybox --image=confluentinc/cp-kafka --restart=Never
```
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...]`
Help... |
Update the image of all containers in the daemonset named 'nginx' to 'php:7.4.22'. | Command:
```bash
kubectl set image daemonset nginx *=php:7.4.22
```
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:
`kubectl... |
Remove the label named 'release' from the 'chat-app' pod. | Command:
```bash
kubectl label pods chat-app release-
```
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 ... |
Forward local port 8081 to port 3000 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 8081 3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Get the output from running the 'jenkins-plugin-cli' command in the container 'mycontainer' from the pod 'monitoring-pod' | Command:
```bash
kubectl exec monitoring-pod -c mycontainer -- jenkins-plugin-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 o... |
Forward all traffic from port 8888 on all addresses to port 9090 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 pod will be sel... |
Attach to a pod and interact with its shell | Command:
```bash
kubectl attach analytics-pod -c quantum-quark -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 omi... |
Start a redis pod named nginx, but customize the specifications by providing a partial set of values parsed from JSON using the given command. | Command:
```bash
kubectl run nginx --image=redis --overrides='{ "apiVersion": "dev-2.2.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... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-secrets 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 de... |
Create a service for the replicated ubuntu with port 9091, and have it connect to the containers on port 801000 | Command:
```bash
kubectl expose rc ubuntu --port=9091 --target-port=801000
```
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.... |
Create a new config map named 'db-config' using the key=value pairs from the file 'path/to/settings'. | Command:
```bash
kubectl create configmap db-config --from-file=path/to/settings
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basename of... |
import the specified keys (EXTERNAL_API_URL) from the config map "api-config" into the "payment-processor-deployment" deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --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 ... |
Add the taint 'datacenter' with value 'worker-node-3:PreferNoSchedule' on nodes that have the label 'version=v1.0.0'. | Command:
```bash
kubectl taint node -l version=v1.0.0 datacenter=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Get the output from running the 'sleep 3600' command in the first pod of the 'monitoring-stack-deployment' deployment in the default container. | Command:
```bash
kubectl exec deploy/monitoring-stack-deployment -- sleep 3600
```
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 omit... |
Patch the specified node using a strategic merge patch in JSON format | Command:
```bash
kubectl patch node web-node-8 -p '{"spec":{"rules":[{"http":{"paths":[{"path":"/","backend":{"service": {"name": "new-service"}}}]}}'
```
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 pa... |
Retrieve the logs from the container "frontend-pod-1" of the deployment "scheduler-app-deployment" | Command:
```bash
kubectl logs deployment/scheduler-app-deployment -c frontend-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fla... |
Create a debug pod named my-debugger by copying the gateway-pod, but change all the container images to centos. | Command:
```bash
kubectl debug gateway-pod --copy-to=my-debugger --set-image=*=centos
```
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... |
Listen on all addresses on port 5000 and forward the traffic to port 6379 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-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... |
delete the pods and services named "database" and "cdn" | Command:
```bash
kubectl delete pod,service database cdn
```
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... |
Listen on port 3000 on localhost and selected IP, forwarding to port 8088 in the pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Execute the 'node' command inside the astro-container of the pod 'gateway-pod' and retrieve the output. | Command:
```bash
kubectl exec gateway-pod -c astro-container -- node
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-name-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... |
Expose the python deployment as a service on port 80, connecting to containers on port 8000 | Command:
```bash
kubectl expose deployment python --port=5432 --target-port=808900
```
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 specifi... |
Stream the logs of the "cyber-sleuth" container in the "analytics-pod" pod | Command:
```bash
kubectl logs -f -c cyber-sleuth 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", "s... |
Display the deployments in YAML format for the "v1.0.0" version of the "extensions" API group | Command:
```bash
kubectl get deployments.v1.0.0.extensions -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... |
Copy the local file "/tmp/foo_dir" to the remote pod "kube-dns/image-resizer-pod-20" in the namespace, and place it in the "/tmp/bar" directory. | Command:
```bash
kubectl cp /tmp/foo_dir kube-dns/image-resizer-pod-20::/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... |
Create an ingress called 'app-loadbalancer-ingress' that routes requests from "website.com/example" to a service named "svc1" on port 8010, and enable TLS using the "my-cert" secret. | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/example=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", "defaul... |
Forward traffic from local port 9090 to port 3000 in the pod named "analytics-pod". | Command:
```bash
kubectl port-forward pod/analytics-pod 9090 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 auto... |
Create a deployment named "gitlab" using the "nginx" image and expose port 5000. | Command:
```bash
kubectl create deployment gitlab --image=nginx --port=5000
```
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: js... |
Use the gedit editor to modify the configuration of the payment-service service | Command:
```bash
KUBE_EDITOR="gedit" kubectl edit svc/payment-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 variable... |
Update the pod named 'chat-app' by adding the label 'tier' with the value 'frontend'. | Command:
```bash
kubectl label pods chat-app tier=frontend
```
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":... |
forward local traffic on port 8080 to the pod's port 8088 of the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8080 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 a... |
List the deployments in the "v1.1.0" version of the "my-apps" API group in YAML output format | Command:
```bash
kubectl get deployments.v1.1.0.my-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 on... |
Add a taint with key 'app' on nodes having label app=web-app | Command:
```bash
kubectl taint node -l app=web-app app=edge-node-10: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... |
Set the annotation 'owner' to 'alice smith' for the pod named 'database' | Command:
```bash
kubectl annotate pods database owner='alice smith'
```
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... |
Create a debug container version of the cdn-service-pod by copying it to a new pod called debug-image-1 | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=app=app:debug,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Create an ingress called 'app1-ingress' that routes requests from website.com/bar to a service named svc1 on port 5432 | Command:
```bash
kubectl create ingress app1-ingress --rule="website.com/bar=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": "", "usage":... |
View logs from pod "web-app-pod" that were written in the last hour. | Command:
```bash
kubectl logs --since=1h web-app-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-c... |
Remove taint from node | Command:
```bash
kubectl taint nodes monitoring-node-15 dedicated:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format.... |
Forward port 8088 on localhost and IP 10.19.21.23 to port 9090 in the pod named proxy-server-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 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 cr... |
Embed the certificate authority data for the kube-cluster-2 cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-2 --embed-certs --certificate-authority=~/.kube/cluster-alpha/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 ... |
Disable certificate checking for the dev cluster entry | Command:
```bash
kubectl config set-cluster e2e --insecure-skip-tls-verify=true
```
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-authori... |
Create a new config map named 'app-config-prod' in the current namespace, with two keys: 'conf' and 'data' | Command:
```bash
kubectl create configmap app-config-prod --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creat... |
Define new exec auth plugin args for the "deploy-bot" entry | Command:
```bash
kubectl config set-credentials deploy-bot --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... |
Update the configuration of a node with specific changes using a strategic merge patch. | Command:
```bash
kubectl patch -f node-config.toml -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]`
He... |
Delete both the pods and services named "web" and "log-aggregator" | Command:
```bash
kubectl delete pod,service web log-aggregator
```
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 select... |
Return a snapshot of the previous terminated "cyber-sleuth" container logs from the "api-service-pod" pod. | Command:
```bash
kubectl logs -p -c cyber-sleuth 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", ... |
Create a pod disruption budget named 'payment-gateway-pdb' that selects all pods with the 'env=production' label and requires a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=env=production --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-availab... |
Update the pod identified by type and name in the "parameters.json" file by adding the custom-label annotation with the value "my-custom-value". | Command:
```bash
kubectl annotate -f parameters.json custom-label=my-custom-value
```
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 inc... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/api-key-secret deployment/api-server-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... |
Create a new config map named api-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/properties/file1.txt --from-file=key1=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creati... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/global-config deployment/email-server-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... |
Create an ingress with multiple hosts and the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:8088" \
--rule="example.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--outp... |
Partially update a node by specifying a strategic merge patch in YAML format. | Command:
```bash
kubectl patch node monitoring-node-15 -p $'stringData:\n 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 ... |
Create a copy of the "database-pod" with a debug container and modified container images. | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-1 --image=debian --set-image=web=nginx:latest,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 identified by re... |
Expose a replica set as a service, serving on port 6379, and connecting to the containers on port 543200. | Command:
```bash
kubectl expose rs node --port=6379 --target-port=543200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Get the output from running the 'mysql' command in the 'nebula-navigator' container from the 'cdn-service-pod' pod. | Command:
```bash
kubectl exec cdn-service-pod -c nebula-navigator -- mysql
```
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,... |
import the specific key "EXTERNAL_API_URL" from the "app-secrets" ConfigMap into the "web-app-deployment" deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-secrets 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... |
Set the certificate authority data for the 'cluster-beta' cluster entry, embedding the certificate and specifying the certificate authority file path as '~/.kube/data-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/data-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 set... |
Import the 'max_connections' key from the 'kube-system-config' config map to the 'database-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/kube-system-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 de... |
Configure auto scaling for the "payment" deployment with a minimum of 2 pods and a maximum of 9 pods | Command:
```bash
kubectl autoscale deployment payment --min=2 --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 uses ... |
Edit the definition of the "db-service" service using the "emacs" editor. | Command:
```bash
KUBE_EDITOR="emacs" kubectl edit svc/db-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, or... |
Start port forwarding from local port 8080 to the port 5432 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 8080: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 autom... |
Listen on local ports 5432 and 6000 and forward data to/from ports 9090 and 6000 in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward pod/cdn-service-pod 5432 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Update the description of a pod by annotating it with the specified value | Command:
```bash
kubectl annotate -f parameters.json description='Web server for marketing site'
```
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... |
Create an ingress called 'app-proxy-ingress' that directs requests to site.com/bar to service 'svc1' on port 8181, using the TLS secret "my-cert". | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="site.com/bar=svc1:8181,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... |
Execute the 'python' command in the 'lunar-launcher' container of the 'chat-app-pod' pod. | Command:
```bash
kubectl exec chat-app-pod -c lunar-launcher -- python
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Create a debug container based on the web-app-pod with all container images set to ruby. | Command:
```bash
kubectl debug web-app-pod --copy-to=debug-image-1 --set-image=*=ruby
```
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... |
Create a service for a replication controller using the specifications in "hazelcast-controller.yaml" file | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=8089 --target-port=543200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on ... |
Scale the deployment named "api-service-rs" to 1 replica | Command:
```bash
kubectl scale --current-replicas=1 --replicas=1 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... |
Update the environment variable ENV to 'prod' in the deployment 'payment-processor-deployment' | Command:
```bash
kubectl set env deployment/payment-processor-deployment ENV=prod
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (w... |
Create a new secret named database-secret using values from an environment file | Command:
```bash
kubectl create secret generic database-secret --from-env-file=path/to/configurations.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 th... |
Create a new config map named app-name-config using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/settings/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Listen on all addresses at port 9090 and forward the traffic to port 8080 in the pod named api-service-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 9090: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 w... |
Create a job called "report-generation-job" using the "postgres" image, and run the command "postgres" inside the job. | Command:
```bash
kubectl create job report-generation-job --image=postgres -- postgres
```
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... |
Create a new ClusterIP service named 'log-service-clusterip' that forwards traffic from port 5001 on the service to port 7000 on the backend. | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=5001:7000
```
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", "d... |
Auto scale the replication controller "foo" with the number of pods between 1 and 4 and target CPU utilization at 20%. | Command:
```bash
kubectl autoscale rc foo --max=4 --cpu-percent=20
```
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... |
Create a new ClusterIP service named log-service-clusterip, with a TCP port forwarding from 8082 to 9090 | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=8082: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", "d... |
Create a debug copy of the auth-service-pod by adding a debug container and changing container images | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=debug-image-app --image=debian --set-image=proxy=nginx:1.21,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and... |
Add a taint with key 'environment' on nodes having label myLabel | Command:
```bash
kubectl taint node -l myLabel environment=monitoring-node-15:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Forward local port 8000 to port 8000 in the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.