prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the specific key "api_key" from the config map "app-config" and set it as an environment variable in the "search-engine-deployment" deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-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 definitions i... |
Retrieve the password for the star-cluster user | Command:
```bash
kubectl config view -o jsonpath='{.users[?(@.name == "star-cluster")].user.password}'
```
What it does:
Display merged kubeconfig settings or a specified kubeconfig file.
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.
Syntax:
`kubectl config view`
Helpful... |
Copy the ~/.config/kube directory from the remote pod logging/auth-service-pod-11 to the local directory :/tmp/bar. | Command:
```bash
kubectl cp logging/auth-service-pod-11:~/.config/kube :/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... |
Change the service account of the 'load-balancer-deployment' deployment to 'istio' | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment istio
```
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:
`kubect... |
Expose the nginx deployment and create a service that serves on port 7000 and connects to the containers on port 8082. | Command:
```bash
kubectl expose deployment nginx --port=7000 --target-port=808200
```
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 specifie... |
Forward port 8088 on all addresses to port 5000 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8088: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 w... |
Retrieve the output from running the 'ash' command inside the 'warp-drive' container of the 'frontend-pod' pod | Command:
```bash
kubectl exec frontend-pod -c warp-drive -- 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 the ku... |
Import the 'secret_key' from the 'app-name-config' config map into the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-name-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Forward traffic from local ports 3000 and 6000 to ports 8080 and 6000 respectively in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-pod 3000 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Create a copy of the proxy-service-pod, changing all container images to php, with the name debug-image-memcached | Command:
```bash
kubectl debug proxy-service-pod --copy-to=debug-image-memcached --set-image=*=php
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default i... |
Get the documentation for the "labels" field of the "metadata" section in the "configmaps" resource. | Command:
```bash
kubectl explain resource=configmaps.metadata.labels
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive fla... |
Execute the 'npm --version' command inside the analytics-pod container and display the output. | Command:
```bash
kubectl exec analytics-pod -- 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 omitted, use the kubec... |
Create an ingress rule that directs requests to a specific service and port, and enable TLS using a specific secret. | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.com/input=svc1:3306,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Forward local port 8080 to port 8080 in the specified pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8080:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Create a copy of the cdn-service-pod with a debug container, and change the container image to "debian" | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=worker=my-custom-worker:1.2.3,api=api:v2
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Create a new secret named monitoring-credentials-secret and add keys for each file in the folder bar | Command:
```bash
kubectl create secret generic monitoring-credentials-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... |
Get the output from running the 'go' command in the astro-container from the pod named security-service-pod. | Command:
```bash
kubectl exec security-service-pod -c astro-container -- 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. If omitted... |
Attach to the 'log-aggregator-pod' pod and get the output from the 'mycontainer' container. | Command:
```bash
kubectl attach log-aggregator-pod -c mycontainer
```
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 omitte... |
Create a copy of the backend pod called my-debugger with all container images changed to busybox | Command:
```bash
kubectl debug backend-pod --copy-to=my-debugger --set-image=*=busybox
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resourc... |
Execute the command 'php --version' inside the 'nano-bot' container in the 'proxy-server-pod' pod. | Command:
```bash
kubectl exec proxy-server-pod -c nano-bot -- php --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... |
copy the local file /tmp/foo_dir to the remote pod file-server-pod-14 in container security-scanner at the path /tmp/bar | Command:
```bash
kubectl cp /tmp/foo_dir file-server-pod-14:/tmp/bar -c security-scanner
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Forward local traffic on port 8000 to port 8080 inside the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 8000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a pod disruption budget named cache-cluster-pdb that will select all pods with the app=rails label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=app=rails --min-available=1
```
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 [-... |
Rename the context 'cluster-1-context' to 'admin-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context cluster-1-context admin-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 a... |
Create a service for the replica set named "centos" that serves on port 9000 and connects to the containers on port 500100. | Command:
```bash
kubectl expose rs centos --port=9000 --target-port=500100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Set the service account of the 'load-balancer-deployment' deployment to 'kube-proxy' | Command:
```bash
kubectl set serviceaccount deployment load-balancer-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:
`k... |
Create a new config map named "app-settings" with the following keys instead of file basenames on disk: "conf" with the contents of /path/to/parameters/file1.txt and "data" with the contents of /path/to/data/file2.txt. | Command:
```bash
kubectl create configmap app-settings --from-file=conf=/path/to/parameters/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 confi... |
Add a taint to a specific node with the given key, value, and effect | Command:
```bash
kubectl taint nodes storage-node-13 special=backup: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... |
Get the output from running the 'redis-cli' command in the first container of the backend-service service. | Command:
```bash
kubectl exec svc/backend-service -- redis-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 omitted, use the kub... |
Create a new secret named azure-storage-secret from an environment file | Command:
```bash
kubectl create secret generic azure-storage-secret --from-env-file=path/to/settings.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the... |
Update the 'frontend' pod with the annotation 'scaling-policy' and the value 'auto-horizontal-scaling' | Command:
```bash
kubectl annotate pods frontend 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 an... |
Output the modified 'user-management-deployment' deployment in YAML format with the new environment variable 'DB_HOST' set to 'localhost', without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/user-management-deployment DB_HOST=localhost -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more p... |
Open the frontend service for editing using gedit as the editor | Command:
```bash
KUBE_EDITOR="gedit" 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 variabl... |
Execute the 'psql' command inside the container of the 'analytics-pod' pod | Command:
```bash
kubectl exec analytics-pod -- 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.kubern... |
Add a taint with the key 'cpu-type' and value 'dev-node-4:PreferNoSchedule' on nodes that have the label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 cpu-type=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": "... |
View the last-applied-configuration annotations for a specific deployment | Command:
```bash
kubectl apply view-last-applied deployment/docker.elastic.co/elasticsearch/elasticsearch
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
S... |
Create a new config map named app-config-prod with the specified keys by using the files file1.txt and file2.txt from the /path/to/configs/ directory. | Command:
```bash
kubectl create configmap app-config-prod --from-file=conf=/path/to/configs/file1.txt --from-file=data=/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 creating a co... |
Import the api_key key from the db-config config map and set it as an environmental variable in the payment-processor-deployment deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/db-config deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Create a pod disruption budget named payment-gateway-pdb that will select all pods with the env=production label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=env=production --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-availab... |
Create a config map named log-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap log-config --from-file=properties=/path/to/properties/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 creating ... |
Update the 'database' pod by adding the 'monitoring-tool' annotation with the value 'Prometheus' | Command:
```bash
kubectl annotate pods database monitoring-tool=Prometheus
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ar... |
Forward local traffic on port 8081 to a pod selected by the deployment, forwarding data to/from port 8088 in the pod. | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 8081 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
Create an ingress called 'public-ingress' with a rule that directs requests for foo.com/example to svc1:8181, and use the tls secret "my-cert" for HTTPS communication. | Command:
```bash
kubectl create ingress public-ingress --rule="foo.com/example=svc1:8181,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Import specific keys from a config map and set them as environment variables for a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/ui-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 variab... |
Set the environment variables from a secret for a specific deployment | Command:
```bash
kubectl set env --from=secret/azure-storage-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... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-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 defi... |
Create a Pod Disruption Budget named batch-processing-pdb that selects all pods with the label role=worker and requires a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=role=worker --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... |
Forward traffic from port 8000 on all addresses to port 8080 in the pod named "cdn-service-pod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Create a job named 'audit-job' using the 'amazonlinux' image, with the command 'bash' | Command:
```bash
kubectl create job audit-job --image=amazonlinux -- 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. One ... |
Switch to raw terminal mode and attach to the 'nebula-navigator' container in the 'monitoring-pod', allowing you to send input to the 'bash' shell and receive the output back. | Command:
```bash
kubectl attach monitoring-pod -c nebula-navigator -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... |
Create a new config map named api-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=conf=/path/to/preferences/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 creatin... |
Attach to a specific container within a pod and get the output from it. | Command:
```bash
kubectl attach payment-gateway-pod -c warp-drive
```
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 omitte... |
Forward local port 6379 to port 8088 in the analytics-platform-deployment pod. | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 6379 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 called 'web-ingress' with a rule that directs requests for 'testing.com/input' to 'svc1:5001' | Command:
```bash
kubectl create ingress web-ingress --rule="testing.com/input=svc1:5001,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"... |
Stream the logs of the "nebula-navigator" container in the "chat-app-pod" pod. | Command:
```bash
kubectl logs -f -c nebula-navigator chat-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",... |
Forward local port 6379 to port 8088 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward pod/frontend-pod 6379 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 autom... |
Create a deployment named wordpress with the confluentinc/cp-kafka image and 4 replicas. | Command:
```bash
kubectl create deployment wordpress --image=confluentinc/cp-kafka --replicas=4
```
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... |
Add a taint with key 'datacenter' on nodes having label 'instance=app-instance-1' and value 'worker-node-3' with the effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l instance=app-instance-1 datacenter=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Copy the local file /tmp/foo_dir to the /etc/kubernetes directory of the web-app-pod-1 pod in the rook-ceph namespace. | Command:
```bash
kubectl cp /tmp/foo_dir rook-ceph/web-app-pod-1:/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, use the... |
Retrieve the snapshot logs from the container log-aggregator-deployment-1 of the deployment named web-app-pod-1 | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c web-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:
"fla... |
Set the service account of a deployment to a specific service account name | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment gitlab-runner
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:... |
Create a cluster role named "view" and set the permissions to connect to pods and specifically to the "prod-api-gateway" and "nginx-proxy" resource names. | Command:
```bash
kubectl create clusterrole view --verb=connect --resource=pods --resource-name=prod-api-gateway --resource-name=nginx-proxy
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|n... |
Set the deployment's service account to a specific account | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment dashboard
```
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:
`ku... |
Create a service for a replicated ubuntu using replica set, which serves on port 8000 and connects to the containers on port 3306 | Command:
```bash
kubectl expose rs ubuntu --port=8000 --target-port=330600
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Create a new ClusterIP service named order-service-clusterip, exposing TCP port 8089 on the service and forwarding it to port 8083 on the pods. | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=8089:8083
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", ... |
Get the output from running the 'redis-server' command in the 'nano-bot' container from the 'payment-gateway-pod' pod. | Command:
```bash
kubectl exec payment-gateway-pod -c nano-bot -- redis-server
```
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 omitt... |
Forward traffic from port 5000 on localhost and IP 10.19.21.23 to port 8088 in the cdn-service-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-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 cri... |
Create an ingress called 'default-ingress' with a rule that directs requests from website.com/input to a service with the name 'svc1' and port '5432', using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress default-ingress --rule="website.com/input=svc1:5432,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... |
Create a pod disruption budget named ingress-controller-pdb that will select all pods with the version=v2 label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=version=v2 --min-available=1
```
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-availabl... |
Create an ingress named 'myapp-ingress' that routes requests for 'testing.com/input' to the service 'svc1:6379' | Command:
```bash
kubectl create ingress myapp-ingress --rule="testing.com/input=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": "", "usag... |
Create a new secret named oauth-secret with keys for each file in the path/to/options folder | Command:
```bash
kubectl create secret generic oauth-secret --from-file=path/to/options
```
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 the ... |
Rename the 'staging-context' to 'service-account-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context staging-context service-account-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 fiel... |
Taint nodes with label feature=feature-xyz | Command:
```bash
kubectl taint node -l feature=feature-xyz special=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": ""... |
Update the 'container-name' container's CPU limit to '200m' on the 'worker-node-3' node using a strategic merge patch specified as a JSON. | Command:
```bash
kubectl patch node worker-node-3 -p '{"spec":{"containers":[{"name":"container-name", "resources":{"limits":{"cpu":"200m"}}}]}'
```
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 (-... |
Create a pod disruption budget named auth-service-pdb that will select all pods with the component=web label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget auth-service-pdb --selector=component=web --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... |
Create a service for a replication controller specified in a yaml file, which serves on port 7000 and connects to the containers on port 637900. | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=7000 --target-port=637900
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Retrieve the previous terminated container logs for the "astro-container" in the "monitoring-pod" pod. | Command:
```bash
kubectl logs -p -c astro-container 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"... |
Set the service account of the deployment called "scheduler-app-deployment" to "jenkins" | Command:
```bash
kubectl set serviceaccount deployment scheduler-app-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:
`kube... |
Return the snapshot logs from the container "web-app-pod-1" of the deployment named "web-app-deployment". | Command:
```bash
kubectl logs deployment/web-app-deployment -c web-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:
"flag": "--... |
Create a single ingress called 'app2-ingress' that directs requests to site.com/bar to svc1:8088 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress app2-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": "O... |
Update the cluster field of the "team-alpha-context" context to "web-cluster". | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster web-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 yo... |
Add a taint with key 'app' on nodes that have the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production app=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 service for a replication controller identified by type and name specified in "centos-controller.yaml" file, which serves on port 5001 and connects to the containers on port 818100. | Command:
```bash
kubectl expose -f centos-controller.yaml --port=5001 --target-port=818100
```
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... |
Forward traffic from port 6379 on all addresses to port 8081 in the pod named 'proxy-server-pod' | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-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 ... |
Create an ingress named 'ingress1' with the following rules: | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:9092" \
--rule="module.com/admin*=svc2:http"
```
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": "--outpu... |
Create an ingress object named 'public-ingress' with a rule that directs requests from 'testing.com/bar' to the 'svc1' service on port 5432, using the 'my-cert' tls secret. | Command:
```bash
kubectl create ingress public-ingress --rule="testing.com/bar=svc1:5432,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... |
Start a pod with ethereum/client-go image but modify the pod specification using values parsed from a JSON file. | Command:
```bash
kubectl run nginx --image=ethereum/client-go --overrides='{ "apiVersion": "hotfix-1.1.2", "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] [--c... |
Create a job named "database-seeding-job" using the image "confluentinc/cp-kafka" and run the command "kafka-topics --list" within the job. | Command:
```bash
kubectl create job database-seeding-job --image=confluentinc/cp-kafka -- kafka-topics --list
```
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... |
Create an ingress called 'external-ingress' that directs requests to site.com/example to svc1:5432 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/example=svc1:5432,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... |
Create a new config map named kube-system-config using specified files as the source for the key-value pairs | Command:
```bash
kubectl create configmap kube-system-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/parameters/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 cr... |
Return snapshot logs from all containers in pods that have the label component=proxy | Command:
```bash
kubectl logs -l component=proxy --all-containers=true
```
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": "--contai... |
Set the cluster field of a specific context to a specific cluster | Command:
```bash
kubectl config set contexts.user-a-context.cluster cluster-alpha
```
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 ... |
Add a taint on nodes with a specific label | Command:
```bash
kubectl taint node -l myLabel cpu-type=db-node-7: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 f... |
Expose a service for a replication controller specified in the "centos-controller.yaml" file, serving on port 8083 and connecting to the containers on port 500000. | Command:
```bash
kubectl expose -f centos-controller.yaml --port=8083 --target-port=500000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Create a pod disruption budget named batch-processing-pdb for pods with the env=production label, ensuring at least one pod is always available. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=env=production --min-available=1
```
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-availa... |
Import the environment variables from the git-credentials-secret secret into the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --from=secret/git-credentials-secret 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 definition... |
create a new service account named tiller | Command:
```bash
kubectl create serviceaccount tiller
```
What it does:
Create a service account with the specified name.
Syntax:
`kubectl create serviceaccount NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-tem... |
Create a new ClusterIP service named log-service-clusterip, mapping port 8000 of the service to port 8000 of the pods | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=8000:8000
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Create a job named "certificate-renewal" with an Ubuntu image that runs the command "docker run -d ubuntu sleep 3600" | Command:
```bash
kubectl create job certificate-renewal --image=ubuntu -- docker run -d ubuntu sleep 3600
```
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": "... |
Return the snapshot of previous terminated 'lunar-launcher' container logs from the 'mypod' pod. | Command:
```bash
kubectl logs -p -c lunar-launcher 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":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.