prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Set the resource request and limits for all containers in the nginx deployment. | Command:
```bash
kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=50m,memory=512Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource request... |
Remove all taints with key 'hardware' from node 'edge-node-10' | Command:
```bash
kubectl taint nodes edge-node-10 hardware-
```
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: json|yaml... |
Create a cron job named 'cleanup-task' in the default namespace that runs the command 'gem --version' every minute | Command:
```bash
kubectl create cronjob cleanup-task --image=ruby --schedule="*/1 * * * *" -- gem --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Create a job named "backup" using the PHP image | Command:
```bash
kubectl create job backup --image=php --
```
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. One of: json|yaml|na... |
Autoscale the deployment "payment" with a minimum of 5 pods and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment payment --min=5 --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 uses... |
Copy the local file "/tmp/foo_dir" to "/tmp/bar" in the container "cache-container" of the remote pod "image-resizer-pod-20" | Command:
```bash
kubectl cp /tmp/foo_dir image-resizer-pod-20:/tmp/bar -c cache-container
```
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... |
Forward traffic from port 8088 on all addresses to port 8080 in the "proxy-server-pod" pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 8088:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Create a single ingress called 'private-ingress' that directs requests to 'testing.com/example' to the service 'svc1' on port 7000, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress private-ingress --rule="testing.com/example=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": "", "... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=api_key --from=configmap/log-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 definitio... |
Add a taint with the key 'special' on the nodes having the label 'feature=feature-xyz' | Command:
```bash
kubectl taint node -l feature=feature-xyz special=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Create an ingress called 'private-service-ingress' that directs requests from website.com/input to svc1:8181, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="website.com/input=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":... |
Update the 'analytics' pod with the annotation 'app-version' and the value '2.5.1', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods analytics 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 incl... |
Autoscale the deployment "proxy-server" with a minimum of 5 pods and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment proxy-server --min=5 --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... |
Create a pod disruption budget with the name "elastic-search-pdb" for pods with the label "version=v2" | Command:
```bash
kubectl create poddisruptionbudget elastic-search-pdb --selector=version=v2 --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Run the 'ruby --version' command in the nebula-navigator container of the security-service-pod pod | Command:
```bash
kubectl exec security-service-pod -c nebula-navigator -- ruby --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container nam... |
Listen on port 8080 on localhost and IP 10.19.21.23, and forward the traffic to port 9090 in the api-service-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-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 cri... |
Create a new ExternalName service named external-third-party-api-service with the external address placeholder-app.app | Command:
```bash
kubectl create service externalname external-third-party-api-service --external-name placeholder-app.app
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to re... |
Forward local port 6379 to port 8888 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 6379:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Create a service named "frontend" to expose the pod "monitoring-pod" on port 444. | Command:
```bash
kubectl expose pod monitoring-pod --port=8000 --name=frontend
```
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 p... |
Create a new ExternalName service named 'external-security-service' that maps the DNS name 'education-edu.edu'. | Command:
```bash
kubectl create service externalname external-security-service --external-name education-edu.edu
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference s... |
set the service account of the deployment "analytics-platform-deployment" to "kube-dns" | Command:
```bash
kubectl set serviceaccount deployment analytics-platform-deployment kube-dns
```
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:... |
Create a new ClusterIP service named monitoring-service-clusterip | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=8083:5000
```
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": "... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/env-vars 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 defin... |
Check if the current user has the permission to list the job named "virus-scan-job" in the namespace "kube-node-lease" | Command:
```bash
kubectl auth can-i list jobs.batch/virus-scan-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... |
Import the "max_connections" key from the "log-config" config map and set it as an environment variable for the "api-server-deployment" deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/log-config 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 definiti... |
Create a new secret named 'cert-manager-secret' from the environment file located at 'path/to/settings.env' | Command:
```bash
kubectl create secret generic cert-manager-secret --from-env-file=path/to/settings.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 ... |
Create an ingress called 'api-ingress' that directs requests from site.com/bar to the service 'svc1' on port 8080, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress api-ingress --rule="site.com/bar=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Copy the file "/tmp/foo" from your local machine to the "/tmp/bar" directory in the "front-end-container" container of the "image-resizer-pod-20" pod. | Command:
```bash
kubectl cp :/tmp/foo image-resizer-pod-20::/tmp/bar -c front-end-container
```
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 omitt... |
Create an ingress called 'app-proxy-ingress' with a rule that directs requests to testing.com/module path to svc1 with port 8088, and use the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/module=svc1:8088,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 service for the replication controller specified in "ubuntu-controller.yaml" with port 5432, targeting port 500100. | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=5432 --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... |
Create a cron job named `system-health-check` with the image `nginx`, scheduled to run every minute | Command:
```bash
kubectl create cronjob system-health-check --image=nginx --schedule="*/1 * * * *" -- nginx -g "daemon off;"
```
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": "--outpu... |
forward port 5000 locally to port 3000 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward pod/web-app-pod 5000: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... |
Forward traffic between local port 9090 and pod port 5000 | Command:
```bash
kubectl port-forward pod/chat-app-pod 9090 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 autom... |
Update the deployment 'search-engine-deployment' with a new environment variable | Command:
```bash
kubectl set env deployment/search-engine-deployment DEBUG=true
```
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 (wit... |
Create a new ExternalName service named 'external-authentication-service' and set the external name to 'tutorial-ai.ai' | Command:
```bash
kubectl create service externalname external-authentication-service --external-name tutorial-ai.ai
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to referenc... |
create a new ClusterIP service named my-cs with a TCP port mapping of 9092 on the service to port 3001 on the target | Command:
```bash
kubectl create service clusterip my-cs --tcp=9092:3001
```
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", "default": "", "us... |
Copy the /tmp/foo_dir directory from local to the /tmp/bar_dir_dir directory in the metrics-exporter-pod-10 pod in the default namespace. | Command:
```bash
kubectl cp :/tmp/foo_dir metrics-exporter-pod-10:/tmp/bar_dir_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... |
Update the pod 'chat-app' with the annotation 'monitoring-tool' and set the value to 'Prometheus', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods chat-app monitoring-tool='Prometheus'
```
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 ... |
Create a job named data-migration-job using the node image with the command npm --version | Command:
```bash
kubectl create job data-migration-job --image=node -- npm --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 f... |
Forward traffic from a randomly assigned local port to port 5000 in the pod named "api-service-pod". | Command:
```bash
kubectl port-forward pod/api-service-pod :5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Partially update the testing-node-11 node using a strategic merge patch | Command:
```bash
kubectl patch node testing-node-11 -p $'spec:\n rules:\n- http:\n paths:\n - path: /\n backend:\n service:\n 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.... |
forward the local port 9090 to the port 8080 of the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward pod/e-commerce-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 will be selected aut... |
Update the image of all containers in a daemonset named "development" to "amazonlinux:2" | Command:
```bash
kubectl set image daemonset development *=amazonlinux:2
```
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:... |
Update the pod named 'backend' with the label 'tier' and the value 'backend' | Command:
```bash
kubectl label pods backend tier=backend
```
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": "... |
Delete the user 'app-service' from the kubectl configuration. | Command:
```bash
kubectl config delete-user app-service
```
What it does:
Delete the specified user from the kubeconfig.
Syntax:
`kubectl config delete-user NAME` |
Create a single ingress called 'web-ingress' that directs requests to site.com/module to the service 'svc1' on port 3306, using the TLS secret named "my-cert" | Command:
```bash
kubectl create ingress web-ingress --rule="site.com/module=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": ... |
Create a cron job named 'log-rotation' using the 'python' image, scheduled to run every minute | Command:
```bash
kubectl create cronjob log-rotation --image=python --schedule="*/1 * * * *" -- python --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short":... |
Forward traffic from port 8081 on localhost and IP address 10.19.21.23 to port 8088 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 8081: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... |
Update the 'auth' pod with the annotation 'alert-email' and the value 'alerts@example.com', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods auth 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 ... |
Create a new ClusterIP service named backend-service-clusterip with port mapping TCP 9092:9091. | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=9092:9091
```
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"... |
Add or update the annotation 'expiration-date' with a value of '2024-12-31' for the pod named 'analytics' | Command:
```bash
kubectl annotate pods analytics expiration-date='2024-12-31'
```
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... |
Forward traffic from port 9090 on localhost and IP 10.19.21.23 to port 8088 in the backend-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 9090:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Create a copy of mypod by adding a debug container and changing the container images | Command:
```bash
kubectl debug mypod -it --copy-to=debug-image-app --image=debian --set-image=cache=redis:alpine,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 name. Po... |
Create a single ingress called 'external-ingress' that directs requests to site.com/bar to the service 'svc1' on port 3000, with the TLS secret "my-cert". | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/bar=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Set a custom TLS server name for the "testing-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster testing-cluster --tls-server-name=kube-cluster-1
```
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] [--certif... |
Display the last 3 lines of logs for the pod named 'email-service-pod' | Command:
```bash
kubectl logs --tail=3 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":... |
Set the service account of a deployment named user-management-deployment to tiller. | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment tiller
```
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 "config_file_path" key from the "app-settings" config map and set it as an environment variable in the "api-server-deployment" deployment. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-settings 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 defin... |
Edit the user-service service using the nano editor | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/user-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, o... |
Create an ingress resource called 'app2-ingress' with a rule that directs requests from testing.com/module to svc1:3000 and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/module=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Rename the context 'cluster-1-context' to 'team-alpha-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context cluster-1-context team-alpha-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field w... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/db-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 defini... |
Forward local ports 3000 and 6000 to ports 8000 and 6000 in a pod selected by the deployment named "mydeployment" | Command:
```bash
kubectl port-forward deployment/mydeployment 3000 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 selecte... |
Retrieve the output from running the 'geth attach' command on the first pod of the 'proxy-service' service. | Command:
```bash
kubectl exec svc/proxy-service -- geth attach
```
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... |
Retrieve the logs of the previous terminated 'cyber-sleuth' container from the 'mypod' pod | Command:
```bash
kubectl logs -p -c cyber-sleuth mypod
```
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": "... |
Create a pod named 'hazelcast' using the 'nginx' image, and expose port 5432 in the container | Command:
```bash
kubectl run hazelcast --image=nginx --port=5432
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Create a pod named "hazelcast" using the "redis" image and expose port 8888 | Command:
```bash
kubectl run hazelcast --image=redis --port=8888
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Create a cluster role named "foo" with the specified NonResourceURL | Command:
```bash
kubectl create clusterrole "foo" --verb=proxy --non-resource-url=/port-forward
```
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 flags:
"flag": "--output", "sh... |
Set up automatic scaling for the "media-stream" deployment with a minimum of 2 pods and a maximum of 10 pods | Command:
```bash
kubectl autoscale deployment media-stream --min=2 --max=10
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that... |
Create a new ExternalName service named "my-ns" with the external name set to "bar.com" | Command:
```bash
kubectl create service externalname my-ns --external-name bar.com
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference services that exist off platfor... |
Create an autoscaling policy for the "auth" deployment with a minimum of 6 pods and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment auth --min=6 --max=13
```
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 th... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/global-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 variabl... |
Create a pod named "hazelcast" using the "hazelcast/hazelcast" image, and expose port 27017. | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=27017
```
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... |
Check if you have the permission to list the job named "queue-processing-job" in the "production" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/queue-processing-job -n production
```
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 partia... |
Update the annotation 'SLA' of pod 'monitoring' to '99.9% uptime' | Command:
```bash
kubectl annotate pods monitoring 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 arbitrar... |
Copy the directory "/tmp/foo_dir" from the pod "openfaas/metrics-exporter-pod-10" to your local machine's "/tmp/bar" directory. | Command:
```bash
kubectl cp openfaas/metrics-exporter-pod-10:/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 ... |
Create a copy of the payment-gateway-pod and change all container images to ruby. Name the copied pod as debug-image-1. | Command:
```bash
kubectl debug payment-gateway-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 ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/global-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Forward port 3000 on localhost and IP 10.19.21.23 to port 5432 in the pod "chat-app-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 3000: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 criter... |
List the deployments in YAML output format for the "dev-2.2.0" version of the "sandbox-apps" API group | Command:
```bash
kubectl get deployments.dev-2.2.0.sandbox-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... |
Remove the taint with key 'datacenter' and effect 'NoExecute' from the node 'gpu-node-12' | Command:
```bash
kubectl taint nodes gpu-node-12 datacenter: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 job named report-generation-job with the amazonlinux image and run the command "yum install -y aws-cli" inside the container | Command:
```bash
kubectl create job report-generation-job --image=amazonlinux -- yum install -y aws-cli
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Set up port forwarding to listen locally on port 5000 and forward the traffic to port 5432 in the analytics-pod pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 5000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-settings 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... |
List deployments in JSON output format for the "dev-2.2.0" version of the "sandbox-apps" API group | Command:
```bash
kubectl get deployments.dev-2.2.0.sandbox-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... |
List the 'vpn-service-rc' replication controller in the ps output format. | Command:
```bash
kubectl get replicationcontroller vpn-service-rc
```
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 ... |
Import the 'config_file_path' key from the 'api-config' ConfigMap to the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/api-config deployment/cache-cluster-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 defi... |
Return the snapshot logs from the container 'frontend-deployment-1' of the 'analytics-pod' deployment | Command:
```bash
kubectl logs deployment/frontend-deployment -c analytics-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": ... |
Forward local port 6379 to the target port of the 'https' service port in a pod selected by the 'email-service' service | Command:
```bash
kubectl port-forward service/email-service 6379:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Get the output from the quantum-quark container in the pod named proxy-service-pod | Command:
```bash
kubectl attach proxy-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 omitt... |
Set the resource request and limits for all containers in the jenkins deployment to cpu=1, memory=4Gi for request and cpu=200m, memory=512Mi for limits. | Command:
```bash
kubectl set resources deployment jenkins --limits=cpu=200m,memory=512Mi --requests=cpu=1,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... |
Add a taint with key 'app' on nodes having label version=v1.0.0, specifically on node named 'prod-node-5' and do not schedule new pods on it | Command:
```bash
kubectl taint node -l version=v1.0.0 app=prod-node-5: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": "Outp... |
Start a php pod with the name nginx, but customize the specification using a partial set of values parsed from JSON. | Command:
```bash
kubectl run nginx --image=php --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] -- [C... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-settings 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... |
Set up an autoscaling policy for the "analytics" deployment with a minimum of 2 pods and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment analytics --min=2 --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 us... |
Create a cron job named 'cleanup-task' that runs the 'php' image every minute | Command:
```bash
kubectl create cronjob cleanup-task --image=php --schedule="*/1 * * * *" --
```
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", "default": ""... |
Output the modified deployment in YAML format without making changes on the server | Command:
```bash
kubectl set env deployment/user-management-deployment CACHE_SIZE=64MB -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod... |
Create a debug container by copying the backend-pod and changing all container images to mysql | Command:
```bash
kubectl debug backend-pod --copy-to=debug-image-1 --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 resourc... |
Create a LoadBalancer service named api-service-lb that maps port 8082 on the external load balancer to port 8000 on the service | Command:
```bash
kubectl create service loadbalancer api-service-lb --tcp=8082:8000
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "def... |
Partially update the node named "gpu-node-12" by applying a strategic merge patch specified in YAML format | Command:
```bash
kubectl patch node gpu-node-12 -p $'spec:\n 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]`
Helpful f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.