prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy the contents of "/var/run/secrets/kubernetes.io/serviceaccount/" from the remote pod "prometheus/image-resizer-pod-20" to the local directory "/tmp/bar_dir". | Command:
```bash
kubectl cp prometheus/image-resizer-pod-20:/var/run/secrets/kubernetes.io/serviceaccount/ /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... |
Execute the 'mongo' command inside the security-service-pod, using the first container by default | Command:
```bash
kubectl exec security-service-pod -- mongo
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubect... |
Set the service account of the 'monitoring-stack-deployment' deployment to 'kube-proxy' | Command:
```bash
kubectl set serviceaccount deployment monitoring-stack-deployment kube-proxy
```
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:... |
Forward traffic from local port 8888 to port 5000 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8888: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... |
Create a debug container with the debian image and add it to a copy of the payment-gateway-pod | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=debug-image-memcached --image=debian --set-image=logger=logging-app:debug,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects id... |
Deny a Certificate Signing Request (CSR) with the name 'csr-abc123' | Command:
```bash
kubectl certificate deny csr-abc123
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kubectl ce... |
Create a service for the 'ubuntu' deployment, serving on port 9000 and forwarding traffic to the containers on port 801000. | Command:
```bash
kubectl expose deployment ubuntu --port=9000 --target-port=801000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specifi... |
retrieve information about replica controller named 'web', service named 'vpn-service-rc', and pod named 'chat-app-pod' | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/chat-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespace... |
Set a custom TLS server name to use for validation for the "kube-cluster-2" cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-2 --tls-server-name=edge-cluster
```
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... |
Update the label 'tier' of pod 'proxy' to 'database' | Command:
```bash
kubectl label pods proxy tier=database
```
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... |
Embed the certificate authority data for the "web-cluster" cluster entry | Command:
```bash
kubectl config set-cluster web-cluster --embed-certs --certificate-authority=~/.kube/edge-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-... |
Create a config map named "app-settings" and include specific keys with their corresponding values from files located at specified paths. | Command:
```bash
kubectl create configmap app-settings --from-file=settings=/path/to/preferences/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 crea... |
Forward local port 8000 to port 3000 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 8000: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 select... |
Create an ingress named 'web-ingress' that routes requests from testing.com/example to the service 'svc1' on port 9091, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress web-ingress --rule="testing.com/example=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Copy a file from a remote pod to a local directory | Command:
```bash
kubectl cp monitoring/task-processor-pod-17::/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 output from running the 'psql' command in lunar-launcher from the web-app-pod | Command:
```bash
kubectl exec web-app-pod -c lunar-launcher -- psql
```
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 th... |
Switch to raw terminal mode and attach to the "time-machine" container inside the "api-service-pod" pod. | Command:
```bash
kubectl attach api-service-pod -c time-machine -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Create a single ingress called 'api-ingress' that directs requests to foo.com/module to svc1:6379 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="foo.com/module=svc1:6379,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 'public-service-ingress' that routes requests from foo.com/bar to svc1:9090 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="foo.com/bar=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": "", "u... |
Create a new config map named "app-config-dev" using specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-dev --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/data/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 config ma... |
Create a copy of the frontend pod with all containers' images replaced by docker.elastic.co/elasticsearch/elasticsearch | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-1 --set-image=*=docker.elastic.co/elasticsearch/elasticsearch
```
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. P... |
Set a custom TLS server name for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --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] [--certificate-author... |
List all deployments in the "alpha-2.0" version of the "sandbox-apps" API group in JSON output format | Command:
```bash
kubectl get deployments.alpha-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... |
Copy the /tmp/foo_dir directory from the remote pod named database-pod-2 in the kube-flannel namespace to the /tmp/bar directory on your local machine | Command:
```bash
kubectl cp kube-flannel/database-pod-2:/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 the k... |
Set the cluster field in the my-context context to staging-cluster | Command:
```bash
kubectl config set contexts.staging-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 y... |
Embed the certificate authority data for the cluster-beta cluster entry | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/star-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set... |
Import the `DEBUG_MODE` key from the `kube-system-config` config map and set it as an environment variable for the `authentication-service-deployment` deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/kube-system-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 va... |
Import specific keys from a config map into a deployment's environment variables set the environment variable with keys from the config map to a specific deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-settings deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Copy the /tmp/foo_dir directory from the remote pod argocd/admin-dashboard-pod-16 to the /etc/kubernetes directory locally. | Command:
```bash
kubectl cp argocd/admin-dashboard-pod-16:/tmp/foo_dir /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Access and run the 'ash' command inside the 'mycontainer' container from the 'log-aggregator-pod' pod to obtain the output. | Command:
```bash
kubectl exec log-aggregator-pod -c mycontainer -- ash
```
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... |
Execute the 'go version' command inside the first container of the first pod of the 'load-balancer-deployment' deployment | Command:
```bash
kubectl exec deploy/load-balancer-deployment -- go version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
Create a copy of the database-pod and add a debug container to it | Command:
```bash
kubectl debug database-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,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 and ... |
Create a debug copy of payment-gateway-pod | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=debug-image-1 --image=debian --set-image=proxy=nginx:1.21,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource an... |
Embed the certificate authority data for the kube-cluster-2 cluster entry by running the command 'kubectl config set-cluster kube-cluster-2 --embed-certs --certificate-authority=~/.kube/kube-cluster-1/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster kube-cluster-2 --embed-certs --certificate-authority=~/.kube/kube-cluster-1/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 NodePort service named analytics-nodeport that forwards traffic from port 9092 to the same port on the pods | Command:
```bash
kubectl create service nodeport analytics-nodeport --tcp=9092:9092
```
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": "... |
Create an ingress resource called 'service-ingress' with a rule that directs requests to website.com/module to the service 'svc1' on port 9000 | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/module=svc1:9000,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... |
Listen on port 8888 locally, forwarding to port 6379 in the 'mypod' pod | Command:
```bash
kubectl port-forward pod/mypod 8888:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Update the pod named 'monitoring' with the annotation 'alert-email' and set it to the value 'alerts@example.com', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods monitoring 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 l... |
Forward traffic from port 8081 on localhost and IP 10.19.21.23 to port 5000 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 8081: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 criteri... |
Add a taint to nodes with label zone=us-east-1 | Command:
```bash
kubectl taint node -l zone=us-east-1 zone=dev-node-4: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... |
List the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/backend-rc pods/database-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 yo... |
Create an ingress called 'rontend-ingress' that directs requests from website.com/module to the service on port 8084 named svc1, and use the TLS secret named "my-cert" for secure communication. | Command:
```bash
kubectl create ingress rontend-ingress --rule="website.com/module=svc1:8084,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... |
Copy a directory from a remote pod to a local directory | Command:
```bash
kubectl cp kube-dns/message-broker-pod-15:/tmp/foo_dir /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 an ingress called 'app-proxy-ingress' with a rule that directs requests from 'testing.com/module' to the service 'svc1' on port 8000 | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.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": "", ... |
Import the 'LOG_LEVEL' key from the 'ui-config' config map into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/ui-config deployment/analytics-platform-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Add a taint with key 'app' and no value to the 'monitoring-node-15' node | Command:
```bash
kubectl taint nodes monitoring-node-15 app:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Forward traffic from port 9090 on all addresses to port 3000 in the backend-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 9090:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Expose a replication controller specified in "ruby-controller.yaml" as a service, which will serve on port 8080 and connect to the containers on port 543200. | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8080 --target-port=543200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/db-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Begin streaming the logs from the nebula-navigator container in the mypod pod. | Command:
```bash
kubectl logs -f -c nebula-navigator 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... |
Import the 'log_level' key from the 'log-config' config map into the 'log-aggregator-deployment' deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/log-config 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 definition... |
Forward local port 5000 to port 8081 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 5000: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 selected automa... |
Partially update the prod-node-5 node by setting the 'unschedulable' field to true, using a strategic merge patch specified in YAML format. | Command:
```bash
kubectl patch node prod-node-5 -p $'spec:\n 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]`
Helpful ... |
Create a deployment named "mattermost" using the "golang" image and expose port 9092. | Command:
```bash
kubectl create deployment mattermost --image=golang --port=9092
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One o... |
Add a taint to the node 'kube-master-9' with the key 'special' and no value | Command:
```bash
kubectl taint nodes kube-master-9 special:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Add a taint with key 'hardware' on nodes having label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 hardware=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": "", ... |
Switch to the raw terminal mode and attach to the 'auth-service-pod' in the 'cyber-sleuth' container | Command:
```bash
kubectl attach auth-service-pod -c cyber-sleuth -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Create a new NodePort service named log-aggregator-nodeport | Command:
```bash
kubectl create service nodeport log-aggregator-nodeport --tcp=9092:8083
```
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", "defaul... |
Create a deployment named registry with the docker.elastic.co/elasticsearch/elasticsearch image running and expose port 8081. | Command:
```bash
kubectl create deployment registry --image=docker.elastic.co/elasticsearch/elasticsearch --port=8081
```
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... |
Start a redis pod with custom configurations | Command:
```bash
kubectl run nginx --image=redis --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] -- [COMMAND... |
Edit the notification-service service using the nano editor. | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/notification-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 vari... |
Update the pod 'foo' by adding the annotation 'git-repo' with the value 'https://github.com/example/my-app'. | Command:
```bash
kubectl annotate pods foo git-repo='https://github.com/example/my-app'
```
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 a... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-secrets deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Get the output from running the 'jenkins-plugin-cli' command in the 'warp-drive' container of the 'proxy-service-pod' pod | Command:
```bash
kubectl exec proxy-service-pod -c warp-drive -- jenkins-plugin-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
update the deployment 'authentication-service-deployment' by setting a new environment variable | Command:
```bash
kubectl set env deployment/authentication-service-deployment ENV=prod
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templat... |
Set the CPU and memory resource requests and limits for all containers in the amazonlinux deployment | Command:
```bash
kubectl set resources deployment amazonlinux --limits=cpu=200m,memory=512Mi --requests=cpu=200m,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 r... |
Execute the 'go run hello.go' command in the pod named vpn-service-pod and container named nebula-navigator, and get the output. | Command:
```bash
kubectl exec vpn-service-pod -c nebula-navigator -- go run hello.go
```
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... |
Create a pod named 'hazelcast' using the 'mysql' image and expose port 3000. | Command:
```bash
kubectl run hazelcast --image=mysql --port=3000
```
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... |
import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/ui-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 defi... |
List the replication controllers with the names "web", services with the name "security-service-rc", and pods with the name "analytics-pod". | Command:
```bash
kubectl get rc/web service/security-service-rc pods/analytics-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is nam... |
Create a new ExternalName service named external-monitoring-service with the external name set to placeholder-app.app | Command:
```bash
kubectl create service externalname external-monitoring-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 referen... |
Forward local ports 8088 to 8081 in the pod and 6000 to 6000 in the pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 8088 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 selected autom... |
Stream the logs of the 'astro-container' container in the 'email-service-pod' pod | Command:
```bash
kubectl logs -f -c astro-container 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": "--contain... |
Forward port 3000 of the pod to port 9090 locally | Command:
```bash
kubectl port-forward pod/chat-app-pod 9090:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Auto-scale the 'proxy' deployment with the number of pods between 2 and 10. Use the default autoscaling policy. | Command:
```bash
kubectl autoscale deployment proxy --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 uses t... |
Create a new secret named ssh-key-secret with the keys for each file in the folder "bar" at the path "path/to/preferences" | Command:
```bash
kubectl create secret generic ssh-key-secret --from-file=path/to/preferences
```
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 o... |
Begin streaming the logs of the 'rocket-ranger' container in the 'analytics-pod' pod | Command:
```bash
kubectl logs -f -c rocket-ranger analytics-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "... |
Get the output from running the 'mysqld' command in the first container of the security-service-pod | Command:
```bash
kubectl exec security-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 kubec... |
Retrieve snapshot logs from container named analytics-pod-1 of the scheduler-app-deployment deployment. | Command:
```bash
kubectl logs deployment/scheduler-app-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:
"fl... |
Add a taint with key 'hardware' on nodes having label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack hardware=gpu-node-12: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"... |
Attach to the code-explorer container in the payment-gateway-pod and get the output | Command:
```bash
kubectl attach payment-gateway-pod -c code-explorer
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Create a job with the name "testing" using the "wordpress" image, running the command "mysql --version" | Command:
```bash
kubectl create job testing --image=wordpress -- mysql --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 forma... |
Create a cluster role named "custom_role" with the following permissions: | Command:
```bash
kubectl create clusterrole custom_role --verb=watch --resource=pods --resource-name=backup-service --resource-name=content-delivery
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Execute the command 'psql' inside the first container of the 'user-service' service. | Command:
```bash
kubectl exec svc/user-service -- psql
```
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... |
Retrieve the logs of the previous terminated 'stardust-shuttle' container from the 'auth-service-pod' pod. | Command:
```bash
kubectl logs -p -c stardust-shuttle 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": "--contain... |
Display the last 23 lines of logs for the pod named cdn-service-pod | Command:
```bash
kubectl logs --tail=23 cdn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": ... |
Import specific keys from a config map to a deployment's environment variables. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-config-prod deployment/search-engine-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... |
Rename a context in your kubeconfig file | Command:
```bash
kubectl config rename-context on-prem-context app-1-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 will als... |
Auto scale the "gateway" replication controller with a target CPU utilization of 60%, ensuring that the number of pods stays between 1 and 3. | Command:
```bash
kubectl autoscale rc gateway --max=3 --cpu-percent=60
```
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... |
Forward traffic from localhost port 3000 to the targetPort of the "https" service port in a specific pod selected by the service. | Command:
```bash
kubectl port-forward service/user-service 3000: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 ... |
Import the specific keys `database_url` from the `configmap/app-settings` and set them as environment variables for the `analytics-platform-deployment` deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-settings deployment/analytics-platform-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
delete both the pods and services named "analytics" and "auth" | Command:
```bash
kubectl delete pod,service analytics auth
```
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.
... |
Scale the deployment named "bar" to have 7 replicas, but only if the current size of "bar" is 1. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=7 deployment/bar
```
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... |
Attach to a pod's container and enter raw terminal mode | Command:
```bash
kubectl attach gateway-pod -c rocket-ranger -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Set the 'compliance-level' annotation of the 'proxy-server' pod to 'PCI-DSS' | Command:
```bash
kubectl annotate pods proxy-server 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 include ... |
Forward traffic from local port 3000 to port 5432 in the frontend-pod pod. | Command:
```bash
kubectl port-forward pod/frontend-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 criteria, a pod will be selected autom... |
Set the service account of the deployment "backend-microservice-deployment" to "cert-manager" | Command:
```bash
kubectl set serviceaccount deployment backend-microservice-deployment cert-manager
```
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
S... |
Create a service that exposes the 'alpine' replica set, serving on port 9090, and connecting to the containers on port 801000. | Command:
```bash
kubectl expose rs alpine --port=9090 --target-port=801000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Create an ingress resource named 'private-api-ingress' with a rule that directs requests for website.com/example to the service 'svc1' on port '27017' using the TLS secret named "my-cert" | Command:
```bash
kubectl create ingress private-api-ingress --rule="website.com/example=svc1:27017,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 to a deployment by running the given command. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/ui-config deployment/search-engine-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 definition... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.