prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create an ingress named 'app1-ingress' that directs requests made to 'testing.com/module' to the service 'svc1' on port '8080' | Command:
```bash
kubectl create ingress app1-ingress --rule="testing.com/module=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Create an ingress called 'api-v1-ingress' that directs requests to site.com/module to a service named svc1 on port 8000 | Command:
```bash
kubectl create ingress api-v1-ingress --rule="site.com/module=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 port 5432 on localhost and 10.19.21.23 to port 5000 in the pod "mypod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 5432: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 p... |
Create a job with a specific command | Command:
```bash
kubectl create job monitoring-job --image=nginx -- nginx -t
```
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... |
Update the annotation 'criticality' of pod 'foo' to 'high', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods foo criticality='high'
```
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 arb... |
Update the annotation of the pod 'gateway' with the key 'description' and the value 'Web server for marketing site', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods gateway 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 large... |
Create a copy of the 'cdn-service-pod' pod and add a debug container to it | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=my-custom-dbg --image=debian --set-image=database=mysql:5.7,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource... |
Get information about the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/cdn-service-rc pods/gateway-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced... |
Copy the file `/tmp/foo` from the `openfaas/message-broker-pod-15` pod to the local machine's `/tmp/bar` directory. | Command:
```bash
kubectl cp openfaas/message-broker-pod-15:/tmp/foo /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 kub... |
Create and run a new pod named "hazelcast" using the Redis image, and have the container within the pod expose port 8010. | Command:
```bash
kubectl run hazelcast --image=redis --port=8010
```
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 job called "security-scan-job" using the nginx image and running the command "nginx". | Command:
```bash
kubectl create job security-scan-job --image=nginx -- nginx
```
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... |
Add a taint with the key 'zone' on nodes that have the label 'version=v1.0.0' | Command:
```bash
kubectl taint node -l version=v1.0.0 zone=backup-node-14: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 port 8088 on localhost and IP 10.19.21.23 to port 8888 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8088: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 ... |
Forward port 5432 in the pod to port 3000 on localhost and IP address 10.19.21.23 | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-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 th... |
Edit the 'web-app-deployment' deployment in YAML format and save the modified configuration in its annotation. | Command:
```bash
kubectl edit deployment/web-app-deployment -o yaml --save-config
```
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 environm... |
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/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable ... |
Retrieve the snapshot logs from the container "media-stream-pod-1" in the deployment "backend-microservice-deployment" | Command:
```bash
kubectl logs deployment/backend-microservice-deployment -c media-stream-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 ... |
Run a proxy to the Kubernetes API server on port 8888, serving static content from the "./local/www/" directory | Command:
```bash
kubectl proxy --port=8888 --www=./local/www/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote... |
Create a new config map named kube-system-config with the specified keys and files | Command:
```bash
kubectl create configmap kube-system-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/path/to/configs/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 c... |
Scale the deployment named `mysql` to a size of 7, matching the current size of deployment `baz`. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/baz
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/private-key-secret deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more p... |
Create a service for the 'node' replicated controller, which will serve on port 8443 and connect to the containers on port 808900. | Command:
```bash
kubectl expose rc node --port=8443 --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 specified port. A... |
Forward local port 5432 to port 8081 in a pod selected by the "mydeployment" deployment | Command:
```bash
kubectl port-forward deployment/mydeployment 5432 8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selecte... |
Forward local port 8081 to port 8888 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8081 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Create a new config map named 'log-config' with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap log-config --from-file=settings=/path/to/preferences/file1.txt --from-file=key2=/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 creatin... |
Set the service account of the deployment "authentication-service-deployment" to "fluentd" | Command:
```bash
kubectl set serviceaccount deployment authentication-service-deployment fluentd
```
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
Synt... |
Embed the certificate authority data for the cluster-beta cluster entry. | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/staging-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 ... |
Create a new config map named app-config with the following keys: properties mapped to the file1.txt configuration file and key1 mapped to the file2.txt configuration file. | Command:
```bash
kubectl create configmap app-config --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/path/to/configs/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... |
Run the 'mysqld' command inside the 'proxy-service-pod' pod and display the output in the first container. | Command:
```bash
kubectl exec proxy-service-pod -- mysqld
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.... |
Delete pods and services named "frontend" and "foo" | Command:
```bash
kubectl delete pod,service frontend foo
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
So... |
Expose the centos deployment as a service on port 80, connecting to the containers on port 8000. | Command:
```bash
kubectl expose deployment centos --port=80 --target-port=8000
```
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... |
Update the cluster role binding named 'admin' for the default service account in the specified namespace | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:default
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namesp... |
Import the log_level key from the api-config config map into the email-server-deployment deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/api-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 ... |
Create a single ingress called 'api-v1-ingress' that directs requests to foo.com/module to svc1:8083 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.com/module=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"... |
Create an ingress named 'api-ingress' that routes requests from website.com/input to svc1:9090, using TLS secret "my-cert". | Command:
```bash
kubectl create ingress api-ingress --rule="website.com/input=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": "", "usage"... |
List deployments in the "legacy-1.0.0" version of the "my-apps" API group in YAML output format | Command:
```bash
kubectl get deployments.legacy-1.0.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 w... |
Forward port 5000 on localhost and selected IP to port 8000 in the web-app-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 5000: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 criteri... |
Create a new secret named ssh-key-secret with keys for each file in the path/to/configs folder | Command:
```bash
kubectl create secret generic ssh-key-secret --from-file=path/to/configs
```
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 basename of th... |
expose a replication controller as a service | Command:
```bash
kubectl expose rc python --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 port.... |
Create a new namespace named cert-manager | Command:
```bash
kubectl create namespace cert-manager
```
What it does:
Create a namespace with the specified name.
Syntax:
`kubectl create namespace NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-template|go-t... |
Update the app-version annotation of the pod identified in the "docker-registry.yaml" file to 2.5.1 | Command:
```bash
kubectl annotate -f docker-registry.yaml 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 a... |
Apply a taint with key 'app' and value 'backup-node-14:PreferNoSchedule' on nodes that have the label 'feature=feature-xyz' | Command:
```bash
kubectl taint node -l feature=feature-xyz app=backup-node-14: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... |
List deployments in the "v1.1.1" version of the "external-apps" API group, and display the output in JSON format. | Command:
```bash
kubectl get deployments.v1.1.1.external-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 w... |
Create a new secret named ssl-key-secret with keys for each file in a specified folder. | Command:
```bash
kubectl create secret generic ssl-key-secret --from-file=path/to/profiles
```
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 basename of t... |
Set the cluster field in the 'my-context' context to 'edge-cluster' | Command:
```bash
kubectl config set contexts.edge-context.cluster edge-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 wan... |
Forward port 5432 on all addresses to port 3000 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 5432: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 sel... |
Set the service account of the 'frontend-deployment' deployment to 'kube-dns' | Command:
```bash
kubectl set serviceaccount deployment frontend-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:
`kubectl ... |
update the pod's annotation with custom-label=my-custom-value, as defined in params.json | Command:
```bash
kubectl annotate -f params.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 include... |
Set the last-applied-configuration of a resource using the contents of the conf.yaml file. | Command:
```bash
kubectl apply set-last-applied -f conf.yaml
```
What it does:
Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run, without updating any other parts of the... |
Create a new config map named db-config using the files file1.txt and file2.txt from the specified paths, and map each file to a specified key | Command:
```bash
kubectl create configmap db-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a conf... |
Edit the user-service resource using the code editor | Command:
```bash
KUBE_EDITOR="code" 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... |
Update the pod named 'vpn' by setting the annotation 'compliance-level' to 'PCI-DSS'. | Command:
```bash
kubectl annotate --overwrite pods vpn compliance-level='PCI-DSS'
```
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... |
Check if you have permission to list the job named "log-rotation-job" in the "kube-dns" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/log-rotation-job -n kube-dns
```
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 cluster role named "custom_role" with permissions to patch pods and access the "document-storage" and "notification-service" resources. | Command:
```bash
kubectl create clusterrole custom_role --verb=patch --resource=pods --resource-name=document-storage --resource-name=notification-service
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=s... |
Create an ingress called 'api-v1-ingress' with a rule that directs requests for website.com/module to svc1:7000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="website.com/module=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": "", "us... |
Execute the 'npm --version' command in the lunar-launcher container from the e-commerce-pod pod | Command:
```bash
kubectl exec e-commerce-pod -c lunar-launcher -- npm --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Forward port 8000 on all addresses to port 6379 in the security-service-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8000: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 ... |
Retrieve a list of deployments in the JSON output format from the "v1.1.0" version of the "sandbox-apps" API group. | Command:
```bash
kubectl get deployments.v1.1.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 wi... |
Retrieve the output of the 'gem --version' command running in the 'rocket-ranger' container of the 'mypod' pod. | Command:
```bash
kubectl exec mypod -c rocket-ranger -- gem --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Listen on port 8000 on all addresses, and forward the traffic to the 'cdn-service-pod' pods 8081 port | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8000: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... |
List deployments in JSON output format for the specified API group and version. | Command:
```bash
kubectl get deployments.beta-1.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 you w... |
Copy the local file /var/run/secrets/kubernetes.io/serviceaccount/ to the remote pod named task-processor-pod-17, and place it in the /tmp/bar directory of the front-end-container container. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ task-processor-pod-17:/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": "... |
Expose the replication controller specified in the ubuntu-controller.yaml file as a service | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=9091 --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... |
Apply a taint with the key 'datacenter' on nodes that have the label 'owner=john-doe', and set the taint effect to 'PreferNoSchedule' for the node named 'node-1'. | Command:
```bash
kubectl taint node -l owner=john-doe datacenter=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Update the pod named 'gateway' with the annotation 'release-notes' and set its value to 'https://example.com/release-notes/v2.5.1', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods gateway release-notes='https://example.com/release-notes/v2.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... |
Retrieve the snapshot logs from the container named log-aggregator-deployment-1 of the deployment named chat-app-pod. | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c chat-app-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fl... |
List deployments in JSON output format, specifically from the "stable-2.0.0" version of the "mobile-apps" API group. | Command:
```bash
kubectl get deployments.stable-2.0.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 y... |
Set the cluster field in the specified context to the desired cluster | Command:
```bash
kubectl config set contexts.prod-context.cluster cloud-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 wa... |
Create a single ingress named 'default-ingress' with a rule that directs requests for testing.com/example to the service named svc1 on port 8088 | Command:
```bash
kubectl create ingress default-ingress --rule="testing.com/example=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": "", "... |
Add a taint with the key 'workload' and the value 'kube-master-9:PreferNoSchedule' on nodes that have the label 'zone=us-east-1'. | Command:
```bash
kubectl taint node -l zone=us-east-1 workload=kube-master-9:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Create an ingress named 'public-service-ingress' with a rule that directs requests from 'website.com/bar' to 'svc1:8080' using the 'my-cert' TLS secret. | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.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": ""... |
Listen on port 9090 locally, forwarding data to/from port 8000 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward pod/backend-pod 9090 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Remove the taint with key 'environment' and effect 'NoSchedule' from the node 'monitoring-node-15' if it exists. | Command:
```bash
kubectl taint nodes monitoring-node-15 environment: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 forma... |
Create a job named 'certificate-renewal' using the nginx image, running the command 'nginx' | Command:
```bash
kubectl create job certificate-renewal --image=nginx -- nginx
```
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.... |
Create an ingress called 'public-ingress' with a rule that directs requests to website.com/input to the service 'svc1' on port '9090', and use the TLS secret 'my-cert' for HTTPS. | Command:
```bash
kubectl create ingress public-ingress --rule="website.com/input=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": "", "usa... |
Copy the ~/.config/kube file from your local machine to the /tmp/bar directory in the remote pod named admin-dashboard-pod-16, within the istio-system namespace. | Command:
```bash
kubectl cp ~/.config/kube istio-system/admin-dashboard-pod-16:/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, ... |
List the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/database-rc pods/proxy-server-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 namespac... |
Get the logs from the container "auth-service-pod-1" in the deployment "web-app-deployment". | Command:
```bash
kubectl logs deployment/web-app-deployment -c auth-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:
"flag"... |
Add a taint with the key 'disktype' and value 'monitoring-node-15:PreferNoSchedule' on nodes that have the label 'namespace=mynamespace'. | Command:
```bash
kubectl taint node -l namespace=mynamespace disktype=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":... |
Create a pod disruption budget named 'messaging-pdb' that will select all pods with the 'project=my-project' label and require at least 9 of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget messaging-pdb --selector=project=my-project --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... |
Create a new NodePort service named 'my-ns' and forward traffic from port 5001 to port 5000 | Command:
```bash
kubectl create service nodeport my-ns --tcp=5001:5000
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Forward traffic from local port 5000 to port 9090 inside the pod named 'mypod' | Command:
```bash
kubectl port-forward pod/mypod 5000:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Create a job named "log-processing-job" using the "ruby" image and specify the command to run as "gem --version" | Command:
```bash
kubectl create job log-processing-job --image=ruby -- gem --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... |
Update node 'db-node-7' with a taint for hardware=gpu with effect NoExecute | Command:
```bash
kubectl taint nodes db-node-7 hardware=gpu: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 single ingress called 'myapp-ingress' that directs requests to site.com/bar to svc1:8088 and use the tls secret "my-cert" | Command:
```bash
kubectl create ingress myapp-ingress --rule="site.com/bar=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": "", "usage": "... |
Create an ingress that directs requests to a specific service and port, with a specified TLS secret. | Command:
```bash
kubectl create ingress internal-ingress --rule="foo.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": "", "usa... |
Delete the pods and services with the names "chat-app" and "foo" | Command:
```bash
kubectl delete pod,service chat-app foo
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
So... |
Roll back the daemonset/staging to revision 3 | Command:
```bash
kubectl rollout undo daemonset/staging --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 the... |
Get the previous terminated logs of the "warp-drive" container from the "monitoring-pod" pod. | Command:
```bash
kubectl logs -p -c warp-drive 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", "sh... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config-dev deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Import specific keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/monitoring-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Import specific keys from a config map into an environment variable of a deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/api-config deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/namespace-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
create an ingress called 'internal-ingress' with a rule that directs requests from 'foo.com/module' to 'svc1:8000' and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress internal-ingress --rule="foo.com/module=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": "", "usag... |
Embed certificate authority data for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/cloud-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... |
Create a new config map named env-vars with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap env-vars --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/path/to/preferences/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 ... |
Change the service account for a deployment named "mydeployment" to "jenkins" | Command:
```bash
kubectl set serviceaccount deployment mydeployment jenkins
```
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:
`kubectl set serv... |
Create a new NodePort service named auth-service-nodeport with the TCP port mapping 8089:6379 | Command:
```bash
kubectl create service nodeport auth-service-nodeport --tcp=8089:6379
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default"... |
Retrieve the output of the 'gem --version' command executed in the 'quantum-quark' container from the 'email-service-pod' pod. | Command:
```bash
kubectl exec email-service-pod -c quantum-quark -- gem --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Update the "vpn" pod by removing the "bar" label if it exists. | Command:
```bash
kubectl label pods vpn role-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true, ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.