prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-config-dev 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... |
Execute the command "nginx -t" in the pod "mypod" and get the output. | Command:
```bash
kubectl exec mypod -c quantum-quark -- nginx -t
```
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 k... |
Rename the context 'local-context' to 'user-a-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context local-context user-a-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 also... |
Retrieve the details of the chat-app-pod pod in JSON format | Command:
```bash
kubectl get -o json pod 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 namespaced you will only see res... |
Create a cluster role named "reader" with NonResourceURL specified to allow watching all APIs | Command:
```bash
kubectl create clusterrole "reader" --verb=watch --non-resource-url=/apis/*
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short... |
Start streaming the logs of the "mycontainer" container in the "vpn-service-pod" pod | Command:
```bash
kubectl logs -f -c mycontainer vpn-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", "... |
import specific keys from config map into deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-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... |
Attach to the proxy-server-pod container and retrieve output from the nebula-navigator process. | Command:
```bash
kubectl attach proxy-server-pod -c nebula-navigator
```
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... |
List the gateway-pod in YAML format | Command:
```bash
kubectl get -o yaml pod gateway-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see resu... |
Update the cluster role binding for the Jenkins service account in a specific namespace | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:jenkins
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namesp... |
Forward port 8000 on all addresses to port 3000 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-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 ... |
Set specific environment variables from a config map for a deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/env-vars deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-name-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Expose the 'node' replication controller as a service on port 5001, connecting to the containers on port 844300. | Command:
```bash
kubectl expose rc node --port=5001 --target-port=844300
```
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... |
Embed the certificate authority data for the "on-prem-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster on-prem-cluster --embed-certs --certificate-authority=~/.kube/app-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... |
Listen on port 5432 locally and forward it to port 8000 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5432:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Create an ingress named 'ingress1' with multiple hosts and the pathType set as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:5432" \
--rule="input.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": "--output... |
Remove the taint with key 'cpu-type' and effect 'NoSchedule' from the 'web-node-8' node | Command:
```bash
kubectl taint nodes web-node-8 cpu-type: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: ... |
Set a taint with the key 'dedicated' and value 'web-node-8:PreferNoSchedule' on nodes that have the label 'customer=acme-corp' | Command:
```bash
kubectl taint node -l customer=acme-corp dedicated=web-node-8: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": "", "usag... |
Forward local port 8888 to port 6379 in the pod named "chat-app-pod", so you can access the pod's port 6379 locally through port 8888. | Command:
```bash
kubectl port-forward pod/chat-app-pod 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 autom... |
Add a taint with key 'cpu-type' on nodes having label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack cpu-type=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Set the service account of the 'user-management-deployment' deployment to 'prometheus' | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment prometheus
```
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:
... |
Output the modified analytics-platform-deployment deployment in YAML format after setting the environment variable API_KEY to your-api-key, without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/analytics-platform-deployment API_KEY=your-api-key -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 ... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=api_key --from=configmap/api-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 definitions in o... |
Describe pods with the label app-type=microservice | Command:
```bash
kubectl describe po -l app-type=microservice
```
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,... |
Execute the 'mysqld' command in the 'lunar-launcher' container of the 'cdn-service-pod' pod and get the output. | Command:
```bash
kubectl exec cdn-service-pod -c lunar-launcher -- 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, ... |
Check if the current user has permission to list the job named "report-generation-job" in the "cert-manager" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/report-generation-job -n cert-manager
```
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 par... |
Create a service for the replicated nginx using replica set, which serves on port 9000 and connects to the containers on port 300100. | Command:
```bash
kubectl expose rs nginx --port=9000 --target-port=300100
```
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. ... |
Forward local port 6379 to port 5432 in the pod named chat-app-pod, and listen on both localhost and IP address 10.19.21.23. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 6379:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Create a cluster role binding called "foo" that grants the "foo" cluster role to "jane.doe", "bob.smith", and the "developers" group. | Command:
```bash
kubectl create clusterrolebinding foo --clusterrole=foo --user=jane.doe --user=bob.smith --group=developers
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--servic... |
Attach to the 'warp-drive' container in the 'e-commerce-pod' pod and get the output | Command:
```bash
kubectl attach e-commerce-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 omitted, us... |
Copy the local file '/tmp/foo_dir' to the remote pod 'metrics-exporter-pod-10' in the namespace 'kube-node-lease' and save it as '/tmp/bar' | Command:
```bash
kubectl cp /tmp/foo_dir kube-node-lease/metrics-exporter-pod-10:/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... |
Edit the docker-registry service using the Sublime editor | Command:
```bash
KUBE_EDITOR="sublime" kubectl edit svc/docker-registry
```
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 variab... |
Create a debug copy of a pod by adding a debug container and changing container images | Command:
```bash
kubectl debug mypod -it --copy-to=debug-image-web --image=debian --set-image=logger=logging-app:debug,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by re... |
Create a job to run a command using a specified image | Command:
```bash
kubectl create job report-generation-job --image=ubuntu -- docker run -it ubuntu
```
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": "", "usag... |
Create a copy of the 'backend-pod' pod and add a debug container to it | Command:
```bash
kubectl debug backend-pod -it --copy-to=my-debugger --image=debian --set-image=proxy=nginx:1.21,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource... |
Create a copy of a pod called "frontend-pod" and add a debugging container to it | Command:
```bash
kubectl debug frontend-pod -it --copy-to=my-debugger --image=debian --set-image=scheduler=my-scheduler:1.0,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identifi... |
Forward port 9090 on localhost and IP 10.19.21.23 to port 5000 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 9090:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Create an ingress rule named 'api-v2-ingress' that directs requests to 'testing.com/module' to service 'svc1' on port '9090' using the TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress api-v2-ingress --rule="testing.com/module=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": "", "us... |
Remove the taint with key 'hardware' and effect 'NoExecute' from the node 'monitoring-node-15' if it exists | Command:
```bash
kubectl taint nodes monitoring-node-15 hardware:NoExecute-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. O... |
Scale the replication controller "monitoring" by creating an autoscaler, with a maximum of 3 pods and a target CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc monitoring --max=3 --cpu-percent=50
```
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 u... |
Forward all traffic from port 5000 on all addresses to port 8080 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 5000: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 sel... |
Set the cpu limits of the 'node' deployment's 'nginx' container to 1 and the memory limits to 512Mi. | Command:
```bash
kubectl set resources deployment node -c=nginx --limits=cpu=1,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 its... |
Create a deployment named jenkins using the ubuntu image and expose port 8000 | Command:
```bash
kubectl create deployment jenkins --image=ubuntu --port=8000
```
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 an ingress named 'website-ingress' with a rule that directs requests to site.com/module to svc1:8082 | Command:
```bash
kubectl create ingress website-ingress --rule="site.com/module=svc1:8082,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 service for the replicated python using replica set | Command:
```bash
kubectl expose rs python --port=8083 --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 specified port.... |
Import the 'log_level' key from the 'api-config' ConfigMap into the 'proxy-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/api-config deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Set the service account of the deployment "order-processing-deployment" to "kube-controller-manager" | Command:
```bash
kubectl set serviceaccount deployment order-processing-deployment kube-controller-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), statefu... |
Configure the environment variables for a specific deployment using values from a config map. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/ui-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 definitions in... |
Forward local traffic on port 3000 to a pod selected by the deployment named log-aggregator-deployment on port 3000. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 3000 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 wi... |
Set the custom TLS server name to 'cloud-cluster' for the 'app-cluster' cluster entry. | Command:
```bash
kubectl config set-cluster app-cluster --tls-server-name=cloud-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... |
List deployments in YAML output format, specifically in the "v2.0.0" version of the "prod-apps" API group. | Command:
```bash
kubectl get deployments.v2.0.0.prod-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will ... |
Forward traffic from local port 6379 to port 8888 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward pod/frontend-pod 6379 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/global-config 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 def... |
Create a job named 'report-generation-job' with the 'ruby' image, and run the command 'gem --version' | Command:
```bash
kubectl create job report-generation-job --image=ruby -- gem --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outpu... |
Update the pod identified by type and name in "setup.json" by adding the annotation "custom-label" with the value "my-custom-value" | Command:
```bash
kubectl annotate -f setup.json custom-label=my-custom-value
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ... |
Get the documentation for the `serviceName` field in the `status` section of the `configmaps` resource | Command:
```bash
kubectl explain resource=configmaps.status.serviceName
```
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 ... |
Retrieve the snapshot logs from the container named gateway-deployment-1 in the deployment named security-service-pod. | Command:
```bash
kubectl logs deployment/gateway-deployment -c security-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"f... |
Import specific keys from a config map to a deployment: | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-config deployment/gateway-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 ... |
Create a service named "frontend" for the pod "analytics-pod" which serves on port 8000. | Command:
```bash
kubectl expose pod analytics-pod --port=8000 --name=frontend
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Auto scale a deployment named "monitoring" with the number of pods between 2 and 14. | Command:
```bash
kubectl autoscale deployment monitoring --min=2 --max=14
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that u... |
Set the environment variable SECRET_KEY in the authentication-service-deployment deployment by importing the value from the app-name-config ConfigMap only for the specified keys. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-name-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 varia... |
Create a Pod Disruption Budget (PDB) named 'cron-jobs-pdb' that selects all pods with the label 'owner=team-1' and ensures that at least one pod is available at any given time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=owner=team-1 --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 [--... |
Create an ingress with multiple hosts and the pathType set to Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="site.com/path*=svc:8081" \
--rule="input.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": "--output", ... |
Set the cluster field in the context named `testing-context` to `app-cluster` | Command:
```bash
kubectl config set contexts.testing-context.cluster app-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you w... |
Add a taint with key 'disktype' on nodes having label myLabel, and set the taint value to 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l myLabel disktype=web-node-8: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 ... |
Edit the cache-service service using the vi editor | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/cache-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... |
Import environment variables from a secret | Command:
```bash
kubectl set env --from=secret/git-credentials-secret deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one ... |
Create a service for the python deployment named "python" that listens on port 8181 and forwards traffic to the containers on port 543200. | Command:
```bash
kubectl expose deployment python --port=8181 --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 specifi... |
Create a config map with specific keys instead of filenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Set environment variables from a specific config map for a deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-config-prod deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
List the resource(s) of the specified type(s) and name(s) | Command:
```bash
kubectl get rc/web service/backend-rc pods/frontend-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... |
Execute the 'geth version' command in the nano-bot container of the database-pod pod and retrieve the output. | Command:
```bash
kubectl exec database-pod -c nano-bot -- geth 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... |
Forward traffic from port 9090 on localhost and IP 10.19.21.23 to port 8080 in the pod named "log-aggregator-pod". | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 9090:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the ... |
Create a cluster role named "foo" that allows the user to perform "use", "proxy", and "delete" operations on services. | Command:
```bash
kubectl create clusterrole foo --verb=use,proxy,delete --resource=services
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short"... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-config-dev 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 de... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/api-config 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 on... |
Get the output from running the 'sleep 3600' command in the 'cosmic-container' from the pod 'chat-app-pod' | Command:
```bash
kubectl exec chat-app-pod -c cosmic-container -- sleep 3600
```
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 omitte... |
Return the snapshot logs from the container named log-aggregator-pod-1 of the analytics-platform-deployment deployment. | Command:
```bash
kubectl logs deployment/analytics-platform-deployment -c log-aggregator-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 ... |
Update the 'auth' pod by adding or updating the annotation 'scaling-policy' with the value 'auto-horizontal-scaling' | Command:
```bash
kubectl annotate --overwrite pods auth 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... |
Update the label of the pod 'auth' to 'release=v1.0' | Command:
```bash
kubectl label pods auth release=v1.0
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If ... |
Retrieve the previous terminated logs of the "mycontainer" container from the "analytics-pod" pod. | Command:
```bash
kubectl logs -p -c mycontainer 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", "sh... |
update the image of all containers in the 'services' daemonset to 'ruby:3.0.2' | Command:
```bash
kubectl set image daemonset services *=ruby:3.0.2
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kube... |
Create a job named "batch-processing" using the image "docker.elastic.co/elasticsearch/elasticsearch" and run the command "elasticsearch" within the job. | Command:
```bash
kubectl create job batch-processing --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", "short": ... |
Create a debug container named debug-image-1 based on the frontend-pod, using the debian image, and update the container images to app:debug and cache:redis:alpine. | Command:
```bash
kubectl debug frontend-pod -it --copy-to=debug-image-1 --image=debian --set-image=app=app:debug,cache=redis:alpine
```
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... |
List deployments in JSON output format with the "v1.1.0" version of the "api-v1" API group. | Command:
```bash
kubectl get deployments.v1.1.0.api-v1 -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 onl... |
Create a secret named oauth-secret with keys for each file in the folder path/to/configs. | Command:
```bash
kubectl create secret generic oauth-secret --from-file=path/to/configs
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of the ... |
Add the label 'component=worker' to the pod named 'api' | Command:
```bash
kubectl label pods api component=worker
```
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": "... |
Add a taint with key 'environment' on nodes having label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack environment=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": "", "usag... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/ui-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 definitions ... |
Partially update the 'storage-node-13' node by applying the strategic merge patch specified in the YAML | Command:
```bash
kubectl patch node storage-node-13 -p $'spec:\n someField: newValue'
```
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]`
Help... |
Create a service for the php deployment, which serves on port 8088 and connects to the containers on port 808300 | Command:
```bash
kubectl expose deployment php --port=8088 --target-port=808300
```
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 ... |
Forward local port 9090 to port 5000 in the 'e-commerce-pod' pod. Data will be forwarded bi-directionally between these ports. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 9090 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Create a debug copy of the database pod with all container images changed to php | Command:
```bash
kubectl debug database-pod --copy-to=debug-image-web --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 if no resour... |
Forward all traffic from port 5000 on all addresses to port 8088 in the chat-app-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-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... |
Forward local port 8080 to port 8080 in the pod named `security-service-pod` | Command:
```bash
kubectl port-forward pod/security-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 select... |
Listen on port 5432 on localhost and IP address 10.19.21.23, and forward the traffic to port 8888 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 5432: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 cr... |
Set the custom TLS server name to 'testing-cluster' for the galaxy-cluster cluster entry. | Command:
```bash
kubectl config set-cluster galaxy-cluster --tls-server-name=testing-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] [--certif... |
Create a job using the `busybox` image | Command:
```bash
kubectl create job monitoring-job --image=busybox
```
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: jso... |
Add a taint with key 'environment' on nodes having label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp environment=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": "", "u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.