prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Port forward from local port 9090 to port 6379 in the pod called "security-service-pod", allowing connections from all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 9090: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 ... |
List all deployments in the "legacy-1.0.0" version of the "prod-apps" API group in JSON output format | Command:
```bash
kubectl get deployments.legacy-1.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... |
Create a cron job that runs a specific command | Command:
```bash
kubectl create cronjob data-sync --image=golang --schedule="*/1 * * * *" -- go version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Open the 'notification-service' service for editing using the 'vi' editor | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/notification-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variab... |
Create a Pod Disruption Budget named 'cron-jobs-pdb' that selects all pods with the 'region=us-east' label and requires a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-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 [... |
Listen on port 8888 on your local machine and forward it to port 8081 in the web-app-pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 8888: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... |
Auto scale the "gateway" deployment with a minimum of 2 pods and a maximum of 11 pods | Command:
```bash
kubectl autoscale deployment gateway --min=2 --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... |
Enable kubectl shell completion by running the provided commands. | Command:
```bash
source '$HOME/.kube/completion.bash.inc'
" >> $HOME/.bash_profile
source $HOME/.bash_profile
```
What it does:
Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it fr... |
Update the label of pod 'frontend' to have the value 'frontend' for the key 'role' | Command:
```bash
kubectl label pods frontend role=frontend
```
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":... |
List deployments in YAML output format, in the specified version of a specific API group. | Command:
```bash
kubectl get deployments.v2.0.0.my-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will on... |
Set the service account of the deployment "notification-handler-deployment" to "vault" | Command:
```bash
kubectl set serviceaccount deployment notification-handler-deployment vault
```
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 copy of the 'backend-pod' pod named 'my-debugger', with the 'warp-drive' container, and start an interactive shell session inside the copy. | Command:
```bash
kubectl debug backend-pod -it --copy-to=my-debugger --container=warp-drive -- sh
```
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... |
List deployments in YAML output format for the "experimental-apps" API group using the "stable-2.0.0" version | Command:
```bash
kubectl get deployments.stable-2.0.0.experimental-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 namesp... |
Import the keys 'EXTERNAL_API_URL' from the 'log-config' config map into the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/log-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 ... |
Create a job named 'security-scan-job' with the 'postgres' image and execute the 'postgres' command inside the job | Command:
```bash
kubectl create job security-scan-job --image=postgres -- postgres
```
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 for... |
Return the previous logs of the "mycontainer" container from the "media-stream-pod" pod. | Command:
```bash
kubectl logs -p -c mycontainer media-stream-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 traffic from port 8081 on all addresses to port 5432 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 8081: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 wil... |
Forward traffic from port 3000 on all addresses to port 8080 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-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 w... |
Create a service for the replicated nginx, which will serve on port 80 and connect to the containers on port 8000. | Command:
```bash
kubectl expose rc nginx --port=8010 --target-port=801000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. ... |
Retrieve the previous terminated logs of the 'cyber-sleuth' container in the 'web-app-pod' pod. | Command:
```bash
kubectl logs -p -c cyber-sleuth 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 an ingress called 'service-ingress' that routes requests from foo.com/module to svc1:8080 | Command:
```bash
kubectl create ingress service-ingress --rule="foo.com/module=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Check if you have permission to list the job named "image-processing-job" in the "kube-public" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/image-processing-job -n kube-public
```
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 parti... |
Add a taint with key 'disktype' on nodes having label team=devops | Command:
```bash
kubectl taint node -l team=devops disktype=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output ... |
Create a new configuration map named app-config-dev with key1=config1 and key2=config2 | Command:
```bash
kubectl create configmap app-config-dev --from-literal=properties=config1 --from-literal=key1=config2
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, t... |
Remove taints on node 'storage-node-13' with key 'cpu-type' | Command:
```bash
kubectl taint nodes storage-node-13 cpu-type-
```
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: json|y... |
Port forward local port 6379 to pod port 8000 | Command:
```bash
kubectl port-forward pod/api-service-pod 6379 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 au... |
Retrieve the output from running the command 'java -jar /usr/share/jenkins/jenkins.war' inside the 'quantum-quark' container in the 'auth-service-pod' pod. | Command:
```bash
kubectl exec auth-service-pod -c quantum-quark -- java -jar /usr/share/jenkins/jenkins.war
```
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": "", "usa... |
Start a busybox pod using the centos image, and keep it running in the foreground. Do not restart the pod if it exits. | Command:
```bash
kubectl run -i -t busybox --image=centos --restart=Never
```
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:
"fla... |
Get the output from running the 'mongod' command in the monitoring-pod pod, using the first container by default | Command:
```bash
kubectl exec monitoring-pod -- mongod
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kub... |
Add a taint with the key 'zone' and value 'testing-node-11:PreferNoSchedule' on nodes that have the label 'environment=production'. | Command:
```bash
kubectl taint node -l environment=production zone=testing-node-11: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 the label 'tier=frontend' to the pod named 'foo' | Command:
```bash
kubectl label pods foo tier=frontend
```
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 ... |
Create a config map named "app-name-config" using specific files as the keys | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/settings/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 conf... |
Copy the chat-app-pod and create a new pod called debug-image-api, using the debian image | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=debug-image-api --image=debian --set-image=database=mysql:5.7,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 ... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/namespace-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 definition... |
Listen on port 8888 on all addresses, forwarding to port 8081 in the pod named 'cdn-service-pod' | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8888:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Check if the current user has permission to list the job named "image-processing-job" in the "kube-ingress" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/image-processing-job -n kube-ingress
```
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 part... |
create an external name service with a custom name and external name | Command:
```bash
kubectl create service externalname external-identity-provider-service --external-name sandbox-site.co
```
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 refe... |
Embed the certificate authority data for the kube-cluster-1 cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-1 --embed-certs --certificate-authority=~/.kube/testing-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 confi... |
get deployments in JSON output format from the "v1.1.0" version of the "custom-apps" API group | Command:
```bash
kubectl get deployments.v1.1.0.custom-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 wil... |
Get output from code explorer in a backend pod | Command:
```bash
kubectl attach backend-pod -c code-explorer
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Forward data between local ports 8080 and 5000, and local port 6000 and pod port 6000, for the 'web-app-deployment' deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8080 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 s... |
Import the 'EXTERNAL_API_URL' key from the 'app-secrets' config map into the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-secrets 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 ... |
Attach to the terminal of the first pod in the replica set named amazonlinux. | Command:
```bash
kubectl attach rs/amazonlinux
```
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, use the kubectl.... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-name-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... |
Copy the contents of the '/var/run/secrets/kubernetes.io/serviceaccount/' file in the local machine to the '/tmp/bar_dir' directory in the 'kubeapps/task-processor-pod-17' pod in the specified namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kubeapps/task-processor-pod-17:/tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage"... |
Create a service for the replicated python deployment, exposing it on port 8000, which will connect to the containers on port 8089 | Command:
```bash
kubectl expose rc python --port=8000 --target-port=808900
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Start streaming the logs of the 'ruby' container in the 'mypod' pod | Command:
```bash
kubectl logs -f -c ruby 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": "-c", "de... |
Copy the local file /tmp/foo_dir to the remote pod web-app-pod-1 in the /tmp/bar directory | Command:
```bash
kubectl cp /tmp/foo_dir web-app-pod-1:/tmp/bar -c ingress-controller
```
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... |
Create a new ClusterIP service named 'analytics-service-clusterip' that forwards traffic from port 8081 to port 5000 | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=8081:5000
```
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": "-... |
Set the cluster field for a context in the Kubernetes configuration file | Command:
```bash
kubectl config set contexts.app-1-context.cluster cluster-beta
```
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... |
Listen on all addresses for incoming traffic on port 5432, and forward it to port 8081 within the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 5432:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
Update all containers in all replication controllers in the project to have the environment variable ENV set to "prod". | Command:
```bash
kubectl set env rc --all API_KEY=your-api-key
```
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 templates (within replication c... |
Create a new ExternalName service named 'external-authentication-service' with the external name 'document-company.com' | Command:
```bash
kubectl create service externalname external-authentication-service --external-name document-company.com
```
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 re... |
List deployments in YAML output format using the "v2.0.0" version of the "apps" API group | Command:
```bash
kubectl get deployments.v2.0.0.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 only ... |
Set the cluster field to a specific cluster in a given context | Command:
```bash
kubectl config set contexts.staging-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 yo... |
Scale the deployment named "bar" to 1 replica, assuming its current size is 5. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=1 deployment/bar
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
Delete both the "payment" pod and service, as well as the "email" pod and service. | Command:
```bash
kubectl delete pod,service payment email
```
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.
S... |
Retrieve the output of the 'pip --version' command from the stardust-shuttle container in the frontend-pod | Command:
```bash
kubectl exec frontend-pod -c stardust-shuttle -- 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... |
Add a taint to a specific node, with the key "datacenter" and no value specified | Command:
```bash
kubectl taint nodes backup-node-14 datacenter: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... |
import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-name-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 defi... |
Import the DEBUG_MODE key from the config map named app-config-prod into the deployment named user-management-deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-config-prod deployment/user-management-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... |
Start a WordPress pod with the container exposing port 8083. | Command:
```bash
kubectl run hazelcast --image=wordpress --port=8083
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "... |
Create a pod disruption budget named notification-service-pdb with the following criteria: | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=release=1.0.0 --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-ava... |
Import environment variables from a config map with a specified prefix for a deployment. | Command:
```bash
kubectl set env --from=configmap/global-config --prefix=MYSQL_ 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 definitio... |
Start streaming the logs of the `nebula-navigator` container in the `gateway-pod` pod. | Command:
```bash
kubectl logs -f -c nebula-navigator gateway-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", ... |
Edit the 'cache-warming-job' job in JSON using the v1 API format | Command:
```bash
kubectl edit job.v1.batch/cache-warming-job -o json
```
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... |
Import the 'log_level' key from the 'log-config' config map and set it as an environment variable for the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/log-config deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions ... |
Return the previous terminated logs of the code-explorer container from the pod log-aggregator-pod. | Command:
```bash
kubectl logs -p -c code-explorer log-aggregator-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": "--containe... |
Create a new config map named app-settings with the specified keys and corresponding file paths | Command:
```bash
kubectl create configmap app-settings --from-file=settings=/path/to/options/file1.txt --from-file=key2=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
Create a new ClusterIP service named payment-service-clusterip | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=8083:5000
```
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"... |
Create a new config map named app-name-config with the conf and data keys, using the file1.txt and file2.txt files as the values, respectively. | Command:
```bash
kubectl create configmap app-name-config --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 co... |
Auto scale the 'analytics' deployment with the number of pods between 4 and 15. | Command:
```bash
kubectl autoscale deployment analytics --min=4 --max=15
```
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 us... |
Set the custom TLS server name "sun-cluster" to use for validation for the "data-cluster" cluster entry | Command:
```bash
kubectl config set-cluster data-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-... |
Forward traffic from port 5432 on localhost and IP 10.19.21.23 to port 9090 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 5432: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 criter... |
Add a taint with the key 'cpu-type' and the value 'gpu-node-12:PreferNoSchedule' on the nodes that have the label 'region=eu-west-2' | Command:
```bash
kubectl taint node -l region=eu-west-2 cpu-type=gpu-node-12:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Import the 'debug_mode' key from the 'global-config' config map and set it as an environment variable for the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/global-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 definition... |
List deployments in YAML format in the specific version of the API group | Command:
```bash
kubectl get deployments.dev-2.2.0.beta-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 wi... |
Copy the local directory "/tmp/foo_dir" to the remote pod named "web-app-pod-1" in the default namespace, and place it in the "/etc/kubernetes_dir" directory of the pod. | Command:
```bash
kubectl cp /tmp/foo_dir web-app-pod-1:/etc/kubernetes_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubec... |
Retrieve the output from running the 'python' command in the first container of the first pod of the 'notification-service' service. | Command:
```bash
kubectl exec svc/notification-service -- python
```
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... |
Import the environment variables from the config map "namespace-config" with the prefix "MYSQL_" into the "email-server-deployment" deployment. | Command:
```bash
kubectl set env --from=configmap/namespace-config --prefix=MYSQL_ 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 definit... |
Return the snapshot logs from the container named log-aggregator-deployment-1 in the deployment named media-stream-pod. | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c media-stream-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:... |
Embed the certificate authority data for the "sun-cluster" cluster entry | Command:
```bash
kubectl config set-cluster sun-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 set-c... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-name-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 ... |
Copy the directory /tmp/foo_dir from the remote pod 'api-server-pod-3' in the 'prometheus' namespace to the local directory /etc/kubernetes. | Command:
```bash
kubectl exec -n prometheus api-server-pod-3 -- tar cf - /tmp/foo_dir | tar xf - -C /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": "... |
Embed the certificate authority data for the "moon-cluster" cluster entry | Command:
```bash
kubectl config set-cluster moon-cluster --embed-certs --certificate-authority=~/.kube/moon-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set... |
Create a new config map named api-config using environment variables from a specific file | Command:
```bash
kubectl create configmap api-config --from-env-file=path/to/configurations.env
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to ... |
delete the pods and services with the names "proxy" and "proxy-server" | Command:
```bash
kubectl delete pod,service proxy proxy-server
```
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 select... |
Create a service for a Hazelcast deployment that serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=5000 --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 spec... |
Set the resource limits and requests for all containers in the mysql deployment to 200m CPU and 512Mi memory for limits, and 100m CPU and 128Mi memory for requests. | Command:
```bash
kubectl set resources deployment mysql --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=128Mi
```
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 reques... |
Embed the certificate authority data for the 'data-cluster' cluster entry, using the certificate authority file located at "~/.kube/testing-cluster/kubernetes.ca.crt". | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/testing-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config ... |
Create a deployment named 'prometheus' using the 'ubuntu' image | Command:
```bash
kubectl create deployment prometheus --image=ubuntu
```
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... |
Set the resource request and limits for all containers in the 'go' deployment | Command:
```bash
kubectl set resources deployment go --limits=cpu=200m,memory=512Mi --requests=cpu=10,memory=2Gi
```
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, bu... |
Embed the certificate authority data for the cluster entry named "on-prem-cluster" by running the command "kubectl config set-cluster on-prem-cluster --embed-certs --certificate-authority=~/.kube/my-k8s-cluster/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster on-prem-cluster --embed-certs --certificate-authority=~/.kube/my-k8s-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 confi... |
Update the 'prod-node-5' node with a taint that has the key 'dedicated', value 'special-user', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes prod-node-5 dedicated=special-user: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 fo... |
Create a new pod running the nginx image and expose port 9092 | Command:
```bash
kubectl run hazelcast --image=nginx --port=9092
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
List deployments in YAML output format, using the "v2.1.0" version of the "beta-apps" API group. | Command:
```bash
kubectl get deployments.v2.1.0.beta-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 ... |
Update the image of all containers in the daemonset 'namespace-2' to 'wordpress:5.8.1'. | Command:
```bash
kubectl set image daemonset namespace-2 *=wordpress:5.8.1
```
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)
Synta... |
Edit the last-applied-configuration annotations for the 'redis' deployment in YAML format. | Command:
```bash
kubectl apply edit-last-applied deployment/redis
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the edito... |
Create a new config map named 'ui-config' using the 'conf' key from the file '/path/to/settings/file1.txt' and the 'data' key from the file '/path/to/configurations/file2.txt' | Command:
```bash
kubectl create configmap ui-config --from-file=conf=/path/to/settings/file1.txt --from-file=data=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Update the 'frontend' pod by adding or updating the annotation 'expiration-date' with the value '2024-12-31'. | Command:
```bash
kubectl annotate --overwrite pods frontend expiration-date='2024-12-31'
```
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.