prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a copy of the 'mypod' pod and change all container images to 'amazonlinux' | Command:
```bash
kubectl debug mypod --copy-to=debug-image-memcached --set-image=*=amazonlinux
```
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 an ingress named 'service-ingress' with a rule that routes requests for foo.com/bar to svc1:8000, and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="foo.com/bar=svc1:8000,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": ... |
forward local ports 5432 and 6000 to ports 8888 and 6000 in the pod | Command:
```bash
kubectl port-forward pod/analytics-pod 5432 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Copy the file named "foo" from the "/tmp" directory on the "payment-gateway-pod-19" pod in the "prometheus" namespace to the "/tmp/bar_dir" directory on your local machine. | Command:
```bash
kubectl cp prometheus/payment-gateway-pod-19:/tmp/foo /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 ... |
Get logs from container "cdn-service-pod-1" of deployment "load-balancer-deployment" | Command:
```bash
kubectl logs deployment/load-balancer-deployment -c cdn-service-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:
"... |
Set the runtime container CPU limits to "5" and memory to "2Gi" for the nginx container in the deployment named 'runtime'. | Command:
```bash
kubectl set resources deployment runtime -c=nginx --limits=cpu=5,memory=2Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to it... |
List the deployments in YAML output format in the "custom-version" version of the "my-apps" API group. | Command:
```bash
kubectl get deployments.custom-version.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... |
Create a job named 'monitoring-job' using the 'python' image, and run the 'pip --version' command inside it | Command:
```bash
kubectl create job monitoring-job --image=python -- pip --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": "Output for... |
Stream the logs of the "rocket-ranger" container in the "auth-service-pod" pod | Command:
```bash
kubectl logs -f -c rocket-ranger auth-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 cluster role named "bar" with specific API Group permissions | Command:
```bash
kubectl create clusterrole bar --verb=list,create,connect --resource=clusterroles.rbac.authorization.k8s.io
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful f... |
Create a service for the replicated centos resource, which serves on port 6379 and connects to the containers on port 330600 | Command:
```bash
kubectl expose rc centos --port=6379 --target-port=330600
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Create a deployment named 'web' using the 'mysql' image, and execute the 'mysqld' command within the container. | Command:
```bash
kubectl create deployment web --image=mysql -- mysqld
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|ya... |
Update the annotation of a pod named 'gateway' with the key 'team' and the value 'frontend team'. | Command:
```bash
kubectl annotate pods gateway team='frontend team'
```
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... |
Copy the local file /tmp/foo_dir to the /tmp/bar directory inside the message-broker-pod-15 pod in the prometheus namespace. | Command:
```bash
kubectl cp /tmp/foo_dir prometheus/message-broker-pod-15:/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 t... |
Add a taint with key 'app' on nodes having the label feature=feature-xyz, with the value PreferNoSchedule on the worker-node-3 node. | Command:
```bash
kubectl taint node -l feature=feature-xyz app=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Embed the certificate authority data for the "data-cluster" cluster entry | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/web-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-... |
Add a taint with key 'disktype' on nodes having label cluster=my-cluster | Command:
```bash
kubectl taint node -l cluster=my-cluster 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": "... |
Update the annotation 'app-version' of the pod 'proxy' to the value 2.5.1 | Command:
```bash
kubectl annotate pods proxy app-version=2.5.1
```
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 stri... |
Create an ingress called 'myapp-ingress' that directs requests to foo.com/module to svc # svc1:8082 with a TLS secret "my-cert" | Command:
```bash
kubectl create ingress myapp-ingress --rule="foo.com/module=svc1:8082,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 output from quantum-quark in the api-service-pod | Command:
```bash
kubectl attach api-service-pod -c quantum-quark
```
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 omitted... |
Copy the local file /tmp/foo to the remote pod named logging-agent-pod-7 in the cert-manager namespace, and place it at the path /tmp/bar | Command:
```bash
kubectl cp /tmp/foo cert-manager/logging-agent-pod-7:/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 k... |
Check if you have permission to list the "security-scan-job" job in the "staging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/security-scan-job -n staging
```
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 ... |
List deployments in JSON output format for the version "stable-2.0.0" in the "backup-apps" API group. | Command:
```bash
kubectl get deployments.stable-2.0.0.backup-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 y... |
Forward traffic from local port 8080 to port 5000 in the analytics-pod, and also forward traffic from local port 6000 to port 6000 in the same pod | Command:
```bash
kubectl port-forward pod/analytics-pod 8080 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Update the pod named 'payment' with the label 'component' and the value 'web' | Command:
```bash
kubectl label pods payment component=web
```
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": ... |
Embed the certificate authority data for the e2e cluster entry with the command 'kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/sun-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/sun-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-cluster N... |
Embed the certificate authority data for the 'sun-cluster' cluster entry by setting the cluster's certificate authority file to '~/.kube/prod-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/prod-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-... |
Remove the taint with key 'hardware' and effect 'NoExecute' from the node 'prod-node-5' if it exists | Command:
```bash
kubectl taint nodes prod-node-5 hardware:NoExecute-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
Create a copy of the `proxy-service-pod` and change all container images to `wordpress` | Command:
```bash
kubectl debug proxy-service-pod --copy-to=my-custom-dbg --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 ... |
Create an ingress called 'private-api-ingress' with the following rule: foo.com/example should be directed to svc1:3001 and use the tls secret "my-cert" | Command:
```bash
kubectl create ingress private-api-ingress --rule="foo.com/example=svc1:3001,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": "", "... |
Import the LOG_LEVEL key from the env-vars config map into the web-app-deployment deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --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 in one ... |
Create a new ClusterIP service named frontend-service-clusterip that maps port 8443 on the cluster to port 8088 on the service. | Command:
```bash
kubectl create service clusterip frontend-service-clusterip --tcp=8443:8088
```
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... |
Create an ingress called 'api-gateway-ingress' that directs requests to the endpoint 'site.com/input' to the service 'svc1' on port 8081 | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/input=svc1:8081,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Set the cluster field in the edge-context context to staging-cluster. | Command:
```bash
kubectl config set contexts.edge-context.cluster staging-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 ... |
Get the snapshot logs of container proxy-service-deployment-1 from the deployment named api-service-pod | Command:
```bash
kubectl logs deployment/proxy-service-deployment -c api-service-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:
"... |
Execute the 'node' command in the first container of the 'user-service' service and retrieve the output. | Command:
```bash
kubectl exec svc/user-service -- 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 the kubectl.kub... |
Create a new config map named namespace-config from the key-value pairs in the specified file | Command:
```bash
kubectl create configmap namespace-config --from-file=path/to/properties
```
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 ba... |
Expose a replication controller as a service with specified ports | Command:
```bash
kubectl expose -f php-controller.yaml --port=3306 --target-port=700000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the sp... |
Describe the details of the pod named "task-processor" | Command:
```bash
kubectl describe pods/task-processor
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide... |
Forward local port 3000 to port 8088 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-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 criteria, a pod will be select... |
Create a service for the replicated Wordpress application, serving on port 8089 and connecting to the containers on port 808800 | Command:
```bash
kubectl expose rc wordpress --port=8089 --target-port=808800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Create a copy of the 'web-app-pod' pod, adding a debug container and changing the container images | Command:
```bash
kubectl debug web-app-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,proxy=nginx:1.21
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and nam... |
Forward port 8080 on all addresses to port 9090 in the backend-pod pod, allowing external access. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8080:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Create a pod named 'hazelcast' using the alpine image and expose port 8083 | Command:
```bash
kubectl run hazelcast --image=alpine --port=8083
```
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": "--f... |
List deployments in YAML output format for the specified API group and version | Command:
```bash
kubectl get deployments.beta-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 ... |
Copy a file named "foo" from a remote pod to a local directory named "bar_dir". | Command:
```bash
kubectl cp kube-server/image-resizer-pod-20:/tmp/foo /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 t... |
Create an ingress called 'app-proxy-ingress' with a rule that directs requests for testing.com/example to svc1:8000 | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/example=svc1:8000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Retrieve the output of the 'jenkins --version' command in the pod named media-stream-pod, specifically targeting the container named rocket-ranger. | Command:
```bash
kubectl exec media-stream-pod -c rocket-ranger -- jenkins --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
Set the CPU and memory limits and requests for all containers in the runtime deployment to 200m CPU, 512Mi memory limits, and 100m CPU, 64Mi memory requests. | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=cpu=100m,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 reque... |
View the last 5 lines of logs for the pod named monitoring-pod | Command:
```bash
kubectl logs --tail=5 monitoring-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": "-... |
Unset the namespace in the 'prod-context' context. | Command:
```bash
kubectl config unset contexts.prod-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` |
Create a single ingress named 'website-ingress' with a rule that directs requests for 'site.com/module' to the service 'svc1' on port '9090' | Command:
```bash
kubectl create ingress website-ingress --rule="site.com/module=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": "", "usag... |
Copy the directory "/tmp/foo_dir" from the remote pod "kube-proxy/message-broker-pod-15" to the local machine's "/tmp/bar" directory. | Command:
```bash
kubectl cp kube-proxy/message-broker-pod-15:/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 ... |
Remove the label named 'bar' from the 'frontend' pod | Command:
```bash
kubectl label pods frontend unhealthy-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "I... |
Create a service for a replication controller identified by a file named "node-controller.yaml", which serves on port 3000 and connects to the containers on port 637900 | Command:
```bash
kubectl expose -f node-controller.yaml --port=3000 --target-port=637900
```
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 s... |
Import specific keys from a config map to be used as environment variables in a deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/ui-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 definitions... |
Forward traffic from port 8081 on localhost and IP address 10.19.21.23 to port 9090 in the backend-pod pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-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 criteri... |
Forward port 8080 on all addresses to port 8081 in the web-app-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8080: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 ... |
Start a centos pod named 'nginx', but overload the spec with a partial set of values parsed from JSON | Command:
```bash
kubectl run nginx --image=centos --overrides='{ "apiVersion": "custom-version", "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] --... |
Create a copy of the 'proxy-server-pod' pod, adding a debug container and changing container images | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=my-debugger --image=debian --set-image=mailer=mailer:latest,api=api:v2
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and na... |
Partially update the 'storage-node-13' node by setting the 'unschedulable' field to 'true' using a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node storage-node-13 -p '{"spec":{"unschedulable":true}}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
H... |
Create a new config map named monitoring-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/properties/file1.txt --from-file=key2=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Copy the ~/.config/kube file from the istio-system/security-scanner-pod-18 pod to the /tmp/bar_dir directory locally | Command:
```bash
kubectl cp istio-system/security-scanner-pod-18:~/.config/kube /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 omit... |
Copy the local file /tmp/foo to the remote pod named file-server-pod-14 in the kube-node-lease namespace, and place it in the /tmp/bar_dir directory. | Command:
```bash
kubectl cp /tmp/foo kube-node-lease/file-server-pod-14:/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... |
Create a single ingress called 'myapp-ingress' that directs requests to website.com/bar to the service 'svc1' on port 8083, with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress myapp-ingress --rule="website.com/bar=svc1:8083,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"... |
Set the custom TLS server name to 'cluster-beta' for the 'kube-cluster-2' cluster entry using the command: kubectl config set-cluster kube-cluster-2 --tls-server-name=cluster-beta | Command:
```bash
kubectl config set-cluster kube-cluster-2 --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] [--certifica... |
Add a taint with key 'disktype' on nodes having label owner=john-doe | Command:
```bash
kubectl taint node -l owner=john-doe disktype=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Execute the 'dotnet --list-runtimes' command inside the cosmic-container in the chat-app-pod and display the output. | Command:
```bash
kubectl exec chat-app-pod -c cosmic-container -- dotnet --list-runtimes
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container nam... |
Set the user field for the team-beta-context context | Command:
```bash
kubectl config set-context team-beta-context --user=cluster-admin
```
What it does:
Set a context 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-context [NAME | --current] [--cluster=cluster_nick... |
Create a cluster role named "default_role" with the ability to list services and with the specific resource names "document-storage" and "file-uploader" | Command:
```bash
kubectl create clusterrole default_role --verb=list --resource=services --resource-name=document-storage --resource-name=file-uploader
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=serv... |
Create a new ClusterIP service named security-service-clusterip with port 8181 on the clusterIP and target port 9000 on the pods. | Command:
```bash
kubectl create service clusterip security-service-clusterip --tcp=8181:9000
```
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... |
Retrieve snapshot logs from container "payment-gateway-pod-1" in the deployment "authentication-service-deployment" | Command:
```bash
kubectl logs deployment/authentication-service-deployment -c payment-gateway-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]`
Hel... |
Create a debug container 'my-custom-dbg' based on the 'gateway-pod' by copying its configuration and adding a debian image | Command:
```bash
kubectl debug gateway-pod -it --copy-to=my-custom-dbg --image=debian --set-image=logger=logging-app:debug,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 identifie... |
Create a job to build an image using the Python image and run the command "python" in it | Command:
```bash
kubectl create job image-build-job --image=python -- python
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. O... |
Check if you have permission to list the job named "data-migration-job" in the "logging" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/data-migration-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 URL... |
Create a copy of the "monitoring-pod" adding a debug container and changing container images | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-1 --image=debian --set-image=app=app:debug,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 res... |
import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-secrets deployment/log-aggregator-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 named 'website-ingress' to route requests from testing.com/bar to svc1:8083 with a TLS secret called "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/bar=svc1:8083,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 local file ~/.config/kube to the directory /tmp/bar_dir in the remote pod payment-gateway-pod-19 in the metallb-system namespace. | Command:
```bash
kubectl cp ~/.config/kube metallb-system/payment-gateway-pod-19:/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 omi... |
Set resource limits for the mysql container in a deployment | Command:
```bash
kubectl set resources deployment mysql -c=nginx --limits=cpu=500m,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... |
Forward port 8081 on all addresses to port 9090 in the pod named 'frontend-pod' | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-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... |
Describe a pod based on the configuration provided in conf.json. | Command:
```bash
kubectl describe -f conf.json
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a name... |
Create an ingress rule named 'public-service-ingress' that directs traffic from testing.com/example to the service named svc1 on port 8081 | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/example=svc1:8081,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default"... |
Return the previous terminated logs of the 'rocket-ranger' container from the 'log-aggregator-pod' pod. | Command:
```bash
kubectl logs -p -c rocket-ranger log-aggregator-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": "--containe... |
Retrieve the output from the cyber-sleuth container in the monitoring-pod pod. | Command:
```bash
kubectl attach monitoring-pod -c cyber-sleuth
```
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 omitted, ... |
Forward port 6379 in the pod "web-app-pod" to port 8000 on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 6379: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 ... |
Embed the certificate authority data for the 'moon-cluster' cluster entry using the command: | Command:
```bash
kubectl config set-cluster moon-cluster --embed-certs --certificate-authority=~/.kube/testing-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 ... |
Autoscale the "media-stream" deployment with the number of pods between 3 and 14. | Command:
```bash
kubectl autoscale deployment media-stream --min=3 --max=14
```
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... |
Listen on port 6379 on localhost and IP address 10.19.21.23, and forward the traffic to port 5000 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 6379:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the crite... |
Create a copy of the e-commerce-pod named debug-image-1, with all container images changed to php. | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-1 --set-image=*=php
```
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 resour... |
Create a single ingress called 'app1-ingress' that directs requests to site.com/example to svc1 on port 3001, using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/example=svc1:3001,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"... |
Forward traffic from port 5000 on all addresses to port 8088 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 5000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
List all deployments in JSON output format for the "mobile-apps" API group with version "v1.1.0" | Command:
```bash
kubectl get deployments.v1.1.0.mobile-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 wil... |
List deployments in YAML output format, in the "v2.1.0" version of the "legacy-apps" API group. | Command:
```bash
kubectl get deployments.v2.1.0.legacy-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 wil... |
Start a python pod with custom specifications by parsing a partial set of values from a JSON file. | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "v2.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 label 'status' of the pod 'analytics' with the value 'unhealthy', overwriting any existing value | Command:
```bash
kubectl label --overwrite pods analytics status=unhealthy
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "... |
Attach to the "nebula-navigator" container in the "database-pod" pod to get the output. | Command:
```bash
kubectl attach database-pod -c nebula-navigator
```
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 omitted... |
Set the API_KEY environment variable in the user-management-deployment deployment using the keys from the global-config config map. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/global-config deployment/user-management-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Create a config map named app-settings using specified files on disk | Command:
```bash
kubectl create configmap app-settings --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 creati... |
Create an ingress named 'myapp-ingress' that routes requests from testing.com/input to svc1:8888, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress myapp-ingress --rule="testing.com/input=svc1:8888,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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.