prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a copy of the gateway-pod and name it debug-image-api, replacing all container images with docker.elastic.co/elasticsearch/elasticsearch. | Command:
```bash
kubectl debug gateway-pod --copy-to=debug-image-api --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. ... |
Set the service account of the deployment "log-aggregator-deployment" to "jenkins" | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-deployment 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:
`kub... |
Create an ingress called 'public-service-ingress' with a rule that directs requests to 'website.com/input' to 'svc1:9092' | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/input=svc1:9092,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 'node' replica set, which serves on port 8089 and connects to the containers on port 700000 | Command:
```bash
kubectl expose rs node --port=8089 --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 specified port. A... |
Set the CPU limit of the Kafka container in the deployment to "500m" and the memory limit to "512Mi". | Command:
```bash
kubectl set resources deployment kafka -c=nginx --limits=cpu=500m,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 requested, but may burst up to... |
Provide a detailed description of all pods with the label "environment=production" | Command:
```bash
kubectl describe po -l environment=production
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type... |
Copy the local file `/tmp/foo_dir` to the remote pod `openfaas/message-broker-pod-15` in the `default` namespace, and place it in the `/etc/kubernetes` directory. | Command:
```bash
kubectl cp /tmp/foo_dir openfaas/message-broker-pod-15:/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, ... |
Execute the 'gem --version' command in the first container of the mydeployment deployment. | Command:
```bash
kubectl exec deploy/mydeployment -- 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 the... |
Execute command inside a pod to get the output | Command:
```bash
kubectl exec gateway-pod -- nginx -g "daemon off;"
```
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... |
Set the server field for the testing-cluster cluster to the provided IP address | Command:
```bash
kubectl config set clusters.testing-cluster.server https://1.2.3.4
```
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 yo... |
Set a custom TLS server name for the "dev-cluster" cluster entry | Command:
```bash
kubectl config set-cluster dev-cluster --tls-server-name=sun-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] [--certificate-a... |
Create a single ingress called 'app-loadbalancer-ingress' that directs requests to website.com/bar to svc1:8010 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/bar=svc1:8010,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Delete the pods and services with the names "chat-app" and "gateway" | Command:
```bash
kubectl delete pod,service chat-app gateway
```
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... |
Create a job using the Centos image and run the bash command inside it. | Command:
```bash
kubectl create job log-processing-job --image=centos -- bash
```
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. ... |
List the resources of type "replication controller" named "web", the resources of type "service" named "analytics-rc", and the pods named "security-service-pod". | Command:
```bash
kubectl get rc/web service/analytics-rc pods/security-service-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 deployment named "db" using the "amazonlinux" image and expose port 8082 | Command:
```bash
kubectl create deployment db --image=amazonlinux --port=8082
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
Forward traffic from port 5432 on all addresses to port 5432 in the e-commerce pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 5432: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 wi... |
Create an ingress named 'app-ingress' that routes requests for 'testing.com/module' to 'svc1:3001' and uses a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress app-ingress --rule="testing.com/module=svc1:3001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Set a custom TLS server name for the my-k8s-cluster cluster entry. | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=data-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... |
Create a pod disruption budget named replica-set-pdb that will select all pods with the region=us-east label and require a minimum of four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=region=us-east --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... |
Set specific keys from a config map into an environment variable for a deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-name-config 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... |
Execute the 'wp' command in the 'nano-bot' container of the 'email-service-pod' pod and retrieve the output | Command:
```bash
kubectl exec email-service-pod -c nano-bot -- wp
```
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 ... |
Import the specific keys 'config_file_path' from the config map 'ui-config' into the deployment 'order-processing-deployment' | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/ui-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 de... |
Auto scale the deployment "gateway" with the number of pods between 4 and 11 | Command:
```bash
kubectl autoscale deployment gateway --min=4 --max=11
```
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... |
Execute the 'ruby --version' command inside the security-service-pod and display the output. | Command:
```bash
kubectl exec security-service-pod -- 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 name. If omitted, use t... |
Execute the command 'jenkins --version' in the astro-container of the cdn-service-pod and retrieve the output. | Command:
```bash
kubectl exec cdn-service-pod -c astro-container -- jenkins --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. ... |
Forward local traffic from port 3000 to port 8888 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward pod/frontend-pod 3000 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 autom... |
Delete the specified user from the Kubernetes configuration | Command:
```bash
kubectl config delete-user saas-admin
```
What it does:
Delete the specified user from the kubeconfig.
Syntax:
`kubectl config delete-user NAME` |
Embed the certificate authority data for the 'testing-cluster' cluster entry using the specified CA certificate file located at '~/.kube/dev-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster testing-cluster --embed-certs --certificate-authority=~/.kube/dev-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 s... |
Create an ingress called 'api-ingress' that directs requests to site.com/input to a service named svc1 on port 7000, and use a TLS secret named "my-cert" for encryption. | Command:
```bash
kubectl create ingress api-ingress --rule="site.com/input=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": "", "usage": "... |
Begin streaming the logs of a specific container in a pod | Command:
```bash
kubectl logs -f -c time-machine web-app-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sho... |
Create a new config map with specified keys and their corresponding file paths | Command:
```bash
kubectl create configmap app-name-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/options/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 c... |
Execute the 'dotnet' command inside the 'lunar-launcher' container of the 'e-commerce-pod' pod. | Command:
```bash
kubectl exec e-commerce-pod -c lunar-launcher -- dotnet
```
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, u... |
Forward all traffic from port 3000 on all addresses to port 8088 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a po... |
Create an ingress resource named 'app-proxy-ingress' with the following rules: requests to 'testing.com/example' should be directed to 'svc1:8080' and use the TLS secret with the name "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/example=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": "",... |
Remove the user 'jane.smith' from the kubectl config | Command:
```bash
kubectl config delete-user jane.smith
```
What it does:
Delete the specified user from the kubeconfig.
Syntax:
`kubectl config delete-user NAME` |
Forward local port 6379 to pod port 8081 | Command:
```bash
kubectl port-forward pod/backend-pod 6379 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... |
Copy the directory "/tmp/foo_dir" from the remote pod "ingress-controller-pod-8" in the "logging" namespace to the local directory "/tmp/bar". | Command:
```bash
kubectl cp logging/ingress-controller-pod-8:/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 ... |
Set the cpu limits of the ubuntu container in the nginx deployment to "100m" and memory limits to "64Mi". | Command:
```bash
kubectl set resources deployment ubuntu -c=nginx --limits=cpu=100m,memory=64Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to... |
Execute the 'kafka-topics --list' command inside the pod named email-service-pod. | Command:
```bash
kubectl exec email-service-pod -- kafka-topics --list
```
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... |
Import environment variables from the 'database-secret' secret and set them in the 'mydeployment' deployment. | Command:
```bash
kubectl set env --from=secret/database-secret deployment/mydeployment
```
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... |
Create a debug copy of a pod by adding a debug container and changing container images | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=my-custom-dbg --image=debian --set-image=database=mysql:5.7,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 nam... |
Display the most recent 53 lines of output in the 'proxy-server-pod' pod. | Command:
```bash
kubectl logs --tail=53 proxy-server-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":... |
Add a taint with the key 'hardware' on nodes that have the label 'feature=feature-xyz'. | Command:
```bash
kubectl taint node -l feature=feature-xyz hardware=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": "", "usa... |
Add the annotation 'scaling-policy' with the value 'auto-horizontal-scaling' to the pod 'media-stream' | Command:
```bash
kubectl annotate pods media-stream scaling-policy=auto-horizontal-scaling
```
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 label... |
Listen on port 5000 on all addresses, and forward traffic to port 8088 in the backend-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Update the 'media-stream' pod with the annotation 'contact-email' and the value 'support@example.com' | Command:
```bash
kubectl annotate pods media-stream contact-email=support@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 and... |
Set the custom TLS server name to "cluster-gamma" for the "dev-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster dev-cluster --tls-server-name=cluster-gamma
```
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... |
Verify if you have permission to list the "cache-warming-job" job in the "development" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cache-warming-job -n development
```
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 ... |
Create an ingress called 'private-api-ingress' that directs requests to a specific service and path, with TLS encryption using a specified certificate secret | Command:
```bash
kubectl create ingress private-api-ingress --rule="testing.com/input=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": "",... |
Create a new secret named azure-storage-secret with keys for each file in the folder path/to/configs | Command:
```bash
kubectl create secret generic azure-storage-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... |
Copy the file "/tmp/foo" from the remote pod "web-app-pod-1" to the local machine's "/tmp/bar" directory. | Command:
```bash
kubectl cp logging/web-app-pod-1::/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 kubectl.ku... |
Taint nodes with the label 'app=web-app' and add a taint with key 'datacenter' and value 'dev-node-4' with effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l app=web-app datacenter=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": "O... |
Open the user-service service for editing using the gedit editor. | Command:
```bash
KUBE_EDITOR="gedit" 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, ... |
Set the cluster field of a context to a specific value | Command:
```bash
kubectl config set contexts.dev-context.cluster kube-cluster-2
```
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... |
Auto scale the deployment "security" with a minimum of 2 and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment security --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 use... |
Execute the 'kafka-console-producer --broker-list localhost:9092 --topic test' command inside the 'mycontainer' container in the 'web-app-pod' pod and retrieve the output | Command:
```bash
kubectl exec web-app-pod -c mycontainer -- kafka-console-producer --broker-list localhost:9092 --topic test
```
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", "d... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config-prod 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... |
Create a job named "cleanup" using the "postgres" image and run the command "psql" | Command:
```bash
kubectl create job cleanup --image=postgres -- psql
```
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: j... |
Start a new pod named 'hazelcast' with the image 'ethereum/client-go' and expose port 8010 in the container | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --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:
... |
Use notepad as the editor to edit the db-service service | Command:
```bash
KUBE_EDITOR="notepad" kubectl edit svc/db-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, ... |
Get output from the cosmic-container inside the web-app-pod pod. | Command:
```bash
kubectl attach web-app-pod -c cosmic-container
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Return the snapshot logs from the container 'api-server-deployment-1' of a deployment named 'mypod' | Command:
```bash
kubectl logs deployment/api-server-deployment -c mypod-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": "--con... |
Partially update a node by applying a strategic merge patch specified as a YAML file | Command:
```bash
kubectl patch node backup-node-14 -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]`
Helpf... |
Return the previously terminated logs of the 'lunar-launcher' container from the 'cdn-service-pod' pod. | Command:
```bash
kubectl logs -p -c lunar-launcher 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"... |
Get the output of the 'elasticsearch-plugin --list' command from the gateway-pod | Command:
```bash
kubectl exec gateway-pod -- elasticsearch-plugin --list
```
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, u... |
Create an ingress called 'external-ingress' that routes requests from site.com/bar to svc1:3001 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/bar=svc1:3001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Create a new ExternalName service named external-git-service with the external address of blog-test.blog | Command:
```bash
kubectl create service externalname external-git-service --external-name blog-test.blog
```
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 ... |
Forward local port 8081 to port 9090 in the pod named api-service-pod | Command:
```bash
kubectl port-forward pod/api-service-pod 8081:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Copy the file "foo" from the remote pod "file-server-pod-14" in the "istio-system" namespace to the local directory "/etc/kubernetes" | Command:
```bash
kubectl cp istio-system/file-server-pod-14::/tmp/foo /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, us... |
List deployments in the "prod-apps" API group with JSON output format. | Command:
```bash
kubectl get deployments.v2.0.0.prod-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 will ... |
Update the image of all containers in the daemonset named 'namespace-2' to 'alpine:3.14' | Command:
```bash
kubectl set image daemonset namespace-2 *=alpine:3.14
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`... |
Create a cluster role named "bar" with the ability to delete services | Command:
```bash
kubectl create clusterrole bar --verb=delete --resource=services --resource-name=blog-backend --resource-name=web-frontend
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|no... |
Update the scaling policy of a pod specified in the "options.json" file. | Command:
```bash
kubectl annotate -f options.json scaling-policy=auto-horizontal-scaling
```
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 ... |
Partially update a node's data by providing a strategic merge patch in YAML format. | Command:
```bash
kubectl patch node app-node-6 -p $'data:\n key: new-value'
```
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 flags:... |
Create an ingress called 'app2-ingress' that directs requests for 'testing.com/bar' to service 'svc1:6379' with a TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/bar=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":... |
Forward traffic from port 8000 on all addresses to port 8088 in the pod named chat-app-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 8000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Forward port 8081 on all addresses to port 8000 in the pod named api-service-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8081: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 w... |
Create a new secret named encryption-key-secret from an environment file | Command:
```bash
kubectl create secret generic encryption-key-secret --from-env-file=path/to/configs.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... |
Set the custom TLS server name for the "kube-cluster-1" cluster entry. | Command:
```bash
kubectl config set-cluster kube-cluster-1 --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] [--certifi... |
Autoscale the deployment "payment" with a minimum of 7 pods and a maximum of 9 pods | Command:
```bash
kubectl autoscale deployment payment --min=7 --max=9
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses ... |
Get the output from running the '/bin/bash -c "echo 'Hello, Amazon Linux'"' command in the 'mycontainer' container from the 'chat-app-pod' pod. | Command:
```bash
kubectl exec chat-app-pod -c mycontainer -- /bin/bash -c "echo 'Hello, Amazon Linux'"
```
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": ... |
Create a new config map named 'global-config' using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap global-config --from-file=conf=/path/to/configs/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a con... |
Execute the 'pip --version' command in the nebula-navigator container of the database-pod and display the output. | Command:
```bash
kubectl exec database-pod -c nebula-navigator -- pip --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... |
Update the nginx container image from a local file in yaml format, without making changes to the server. | Command:
```bash
kubectl set image -f path/to/file.yaml mongo=mongo:5.0.2 --local -o yaml
```
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), replica... |
Use the nano editor to edit the frontend-service service | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/frontend-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variable... |
Create a deployment named auth with the postgres image | Command:
```bash
kubectl create deployment auth --image=postgres
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|nam... |
Create an ingress named 'website-ingress' that routes requests for 'website.com/module' to a service named 'svc1' on port 9091, and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress website-ingress --rule="website.com/module=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": "", "u... |
Add a taint with key 'workload' on nodes having label app-type=microservice | Command:
```bash
kubectl taint node -l app-type=microservice workload=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Add a taint with key 'app' on nodes having label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel app=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": "", "usage": "Output ... |
Create a job named report-generation-job using the elasticsearch image from the docker.elastic.co/elasticsearch/elasticsearch registry, with the command "elasticsearch". | Command:
```bash
kubectl create job report-generation-job --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch
```
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", "sho... |
Forward local ports 8888 and 6000 to ports 8088 and 6000 in the pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8888 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Remove the taint with key 'zone' and effect 'PreferNoSchedule' from the node 'web-node-8' if it exists | Command:
```bash
kubectl taint nodes web-node-8 zone:PreferNoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Add a taint with key 'cpu-type' on nodes having label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha cpu-type=k8s-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": "", "us... |
Forward port 8080 on all addresses to port 3000 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8080: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 w... |
Open the user-service service for editing using the vim editor. | Command:
```bash
KUBE_EDITOR="vim" 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, or... |
Create a deployment named "jenkins-x" using the "ubuntu" image, exposing port 8083. | Command:
```bash
kubectl create deployment jenkins-x --image=ubuntu --port=8083
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
create a deployment named 'logging' using the 'confluentinc/cp-kafka' image and exposing port 9000 | Command:
```bash
kubectl create deployment logging --image=confluentinc/cp-kafka --port=9000
```
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 f... |
Set the service account of the deployment "authentication-service-deployment" to "tiller" | Command:
```bash
kubectl set serviceaccount deployment authentication-service-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
Synta... |
Create a deployment named "worker" that uses the "mcr.microsoft.com/dotnet/core/runtime" image. | Command:
```bash
kubectl create deployment worker --image=mcr.microsoft.com/dotnet/core/runtime
```
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": "Outpu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.