prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Retrieve the modified deployment configuration for the payment-processor-deployment, with the new environment variable QUEUE_NAME set to "task-queue", and output it in YAML format | Command:
```bash
kubectl set env deployment/payment-processor-deployment QUEUE_NAME=task-queue -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 ... |
Copy the file /tmp/foo from the database-pod-2 pod in the kube-flannel namespace to the /tmp/bar_dir directory locally | Command:
```bash
kubectl cp kube-flannel/database-pod-2::/tmp/foo /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
Update the annotation of the pod 'database' with the key 'app-version' and the value '2.5.1', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods database app-version='2.5.1'
```
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 inclu... |
Execute the 'mysqld' command in the first container of the 'frontend-deployment' deployment, and display the output. | Command:
```bash
kubectl exec deploy/frontend-deployment -- mysqld
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Set the service account of the deployment named "load-balancer-deployment" to "fluentd". | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment fluentd
```
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... |
Forward local port 3000 to port 6379 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 3000 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 aut... |
Copy a directory from a remote pod to your local machine | Command:
```bash
kubectl cp argocd/payment-gateway-pod-19:/tmp/foo_dir /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Create an ingress called 'public-service-ingress' that directs requests for website.com/module to the service named svc1 on port 3000 | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/module=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default":... |
Create a deployment named "app" using the "confluentinc/cp-kafka" image and expose port 9000. | Command:
```bash
kubectl create deployment app --image=confluentinc/cp-kafka --port=9000
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output forma... |
Apply a taint with the key 'zone' and the value 'db-node-7:PreferNoSchedule' to all nodes that have the label 'component=proxy'. | Command:
```bash
kubectl taint node -l component=proxy zone=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": "Outp... |
Create a new config map named "app-settings" with specified keys and corresponding file paths | Command:
```bash
kubectl create configmap app-settings --from-file=conf=/path/to/profiles/file1.txt --from-file=data=/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 a ... |
Set the custom TLS server name to 'kube-cluster-2' for validation for the e2e cluster entry. | Command:
```bash
kubectl config set-cluster e2e --tls-server-name=kube-cluster-2
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate-author... |
Create a new config map named ui-config using specific keys from files on disk | Command:
```bash
kubectl create configmap ui-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/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 creating a config m... |
Display differences between the current state and the desired state of resources specified in the parameters.yaml file | Command:
```bash
kubectl diff -f parameters.yaml
```
What it does:
Diff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied.
The output is always YAML.
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff com... |
Remove all taints with key 'cpu-type' from node 'prod-node-5' | Command:
```bash
kubectl taint nodes prod-node-5 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|yaml|... |
Create a service for the 'python' deployment, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose deployment python --port=3001 --target-port=700000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specifi... |
Switch to raw terminal mode and attach to a specific container in a pod. | Command:
```bash
kubectl attach proxy-server-pod -c cyber-sleuth -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Scale the replica set 'prod-app-rs' to 3 replicas. | Command:
```bash
kubectl scale --replicas=3 rs/prod-app-rs
```
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 specified, it is validate... |
Copy the local file /tmp/foo_dir to the remote pod worker-pod-4 in the namespace kubeapps, and rename it as /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo_dir kubeapps/worker-pod-4:/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/gateway-rc pods/proxy-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespac... |
Import the specific keys "database_url" from the config map "env-vars" into the deployment "api-server-deployment" | Command:
```bash
kubectl set env --keys=database_url --from=configmap/env-vars 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 i... |
Set the CPU limits of the Ruby container in the deployment named "ruby" to "3" and the memory limits to "2Gi". | Command:
```bash
kubectl set resources deployment ruby -c=nginx --limits=cpu=3,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, but may burst up to its s... |
Forward port 6379 on all addresses from the backend-pod pod to port 8088 | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-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 ... |
Copy the file /var/run/secrets/kubernetes.io/serviceaccount/ from your local machine to the /etc/kubernetes directory in the remote pod named "message-broker-pod-15" in the "kube-system" namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kube-system/message-broker-pod-15:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "... |
Add a taint with the key 'special' on the nodes that have the label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 special=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": "O... |
Listen on local port 8000 and forward data to/from port 6379 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8000 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 au... |
Forward traffic from port 5432 on all addresses to port 6379 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 5432: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... |
Copy the file /var/run/secrets/kubernetes.io/serviceaccount/ from your local machine to the directory /tmp/bar in the ingress-controller-pod-8 pod in the metallb-system namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ metallb-system/ingress-controller-pod-8::/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": "", "... |
View the snapshot logs from the container scheduler-app-deployment-1 in the deployment named payment-gateway-pod | Command:
```bash
kubectl logs deployment/scheduler-app-deployment -c payment-gateway-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 flag... |
Expose a replica set named "nginx" as a service, listening on port 3001 and forwarding traffic to the containers on port 8080. | Command:
```bash
kubectl expose rs nginx --port=3001 --target-port=808000
```
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. ... |
Autoscale the replication controller "foo" with a target CPU utilization of 81%, ensuring that the number of pods stays between 1 and 7. | Command:
```bash
kubectl autoscale rc foo --max=7 --cpu-percent=81
```
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 the... |
Create a service for the replicated python pods, which will serve on port 80 and connect to the containers on port 8000. | Command:
```bash
kubectl expose rc python --port=8000 --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 specified port.... |
Import the specific keys 'redis_host' from the 'app-settings' config map to the 'payment-processor-deployment' deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-settings 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 defi... |
Create a new config map named "app-name-config" using specific keys and file paths | Command:
```bash
kubectl create configmap app-name-config --from-file=properties=/path/to/data/file1.txt --from-file=key1=/path/to/profiles/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 ... |
Forward port 5000 of all addresses to port 5432 in the analytics-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 5000: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... |
Create a new config map named app-config using the settings file 'file1.txt' located at '/path/to/settings' and the parameters file 'file2.txt' located at '/path/to/parameters'. | Command:
```bash
kubectl create configmap app-config --from-file=settings=/path/to/settings/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 creating a... |
Import specific keys from a config map into an environment variable for a deployment | Command:
```bash
kubectl set env --keys=redis_host --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 port 6379 on all addresses to port 5000 in the e-commerce-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 6379: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 wi... |
Create a role named "bar" with the following permissions: watch pods with resource names "api-server" and "dev-database" | Command:
```bash
kubectl create role bar --verb=watch --resource=pods --resource-name=api-server --resource-name=dev-database
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|no... |
Update the password of the web-node-8 node by applying a strategic merge patch using the provided JSON patch. | Command:
```bash
kubectl patch node web-node-8 -p '{"stringData":{"password":"new-password"}'
```
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... |
Execute the 'node' command in the 'cosmic-container' of the 'monitoring-pod' pod and retrieve the output. | Command:
```bash
kubectl exec monitoring-pod -c cosmic-container -- node
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Create a new ClusterIP service named 'auth-service-clusterip' that listens on port 5432 and forwards the traffic to port 3000 | Command:
```bash
kubectl create service clusterip auth-service-clusterip --tcp=5432:3000
```
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", "... |
Update the annotation 'custom-label' of the pod 'monitoring' with the value 'my-custom-value', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods monitoring 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 lab... |
Attach to the time-machine container in the payment-gateway-pod to get output | Command:
```bash
kubectl attach payment-gateway-pod -c time-machine
```
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 omit... |
Set environment variable 'DB_HOST' to 'localhost' for deployment 'database-deployment' | Command:
```bash
kubectl set env deployment/database-deployment DB_HOST=localhost
```
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 (w... |
List deployments in YAML output format, specifically in the "v1.1.0" version of the "web-apps" API group. | Command:
```bash
kubectl get deployments.v1.1.0.web-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 o... |
Create a new config map named app-config with the keys "settings" mapped to the file /path/to/properties/file1.txt and "key2" mapped to the file /path/to/configurations/file2.txt | Command:
```bash
kubectl create configmap app-config --from-file=settings=/path/to/properties/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 crea... |
Create a job named "testing" using the image "confluentinc/cp-kafka" and run the command "kafka-topics --list" inside the container | Command:
```bash
kubectl create job testing --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": "", "usage... |
View the details of revision 1 of the 'staging' daemonset | Command:
```bash
kubectl rollout history daemonset/staging --revision=1
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to... |
Run the 'python' command in the 'nebula-navigator' container of the 'email-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec email-service-pod -c nebula-navigator -- 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 omitt... |
Get the output from running the 'postgres' command inside the 'chat-app-pod' pod. | Command:
```bash
kubectl exec chat-app-pod -- postgres
```
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... |
Copy the local file /tmp/foo_dir to the directory /etc/kubernetes in the remote pod kubeapps/cache-pod-5, in the default namespace. | Command:
```bash
kubectl cp /tmp/foo_dir kubeapps/cache-pod-5:/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 ku... |
Add a taint to the node 'backup-node-14' with the key 'disktype', value 'ssd', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes backup-node-14 disktype=ssd: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. O... |
Start a pod named nginx using the ethereum/client-go image, but override the specification by providing a partial set of values parsed from a JSON file with the apiVersion and the spec sections specified. | Command:
```bash
kubectl run nginx --image=ethereum/client-go --overrides='{ "apiVersion": "v3.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command... |
Open a raw terminal for the 'cyber-sleuth' container in the 'api-service-pod' pod, allowing input from 'bash' and sending output back to the client. | Command:
```bash
kubectl attach api-service-pod -c cyber-sleuth -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Create a new secret named oauth-secret from an environment file. | Command:
```bash
kubectl create secret generic oauth-secret --from-env-file=path/to/properties.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 basen... |
Expose the 'hazelcast' replication controller with a service, serving on port 6379 and connecting to the containers on port 8080 | Command:
```bash
kubectl expose rc hazelcast --port=6379 --target-port=808000
```
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... |
Set the resource request and limits for all containers in the kafka deployment to cpu=200m, memory=512Mi (limits) and cpu=200m, memory=1Gi (requests) | Command:
```bash
kubectl set resources deployment kafka --limits=cpu=200m,memory=512Mi --requests=cpu=200m,memory=1Gi
```
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 requeste... |
Create a pod disruption budget named load-balancer-pdb that will select all pods with the project=my-project label and require at least one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=project=my-project --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-avail... |
Open the 'search-service' service for editing using the 'notepad' editor | Command:
```bash
KUBE_EDITOR="notepad" kubectl edit svc/search-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... |
Embed the certificate authority data for the 'galaxy-cluster' cluster entry by running the command: kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/edge-cluster/kubernetes.ca.crt | Command:
```bash
kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/edge-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config s... |
Update a specific field of a node by providing a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node db-node-7 -p '{"data":{"key":"new-value"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful fla... |
Listen on port 8081 on localhost and IP address 10.19.21.23, and forward the traffic to port 3000 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 8081: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 criteri... |
Create an ingress called 'app2-ingress' that routes requests from foo.com/module to the service 'svc1' running on port 8010 | Command:
```bash
kubectl create ingress app2-ingress --rule="foo.com/module=svc1:8010,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Update the pod identified in "params.json" with the annotation "git-repo" set to 'https://github.com/example/my-app' | Command:
```bash
kubectl annotate -f params.json git-repo='https://github.com/example/my-app'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than la... |
Create a new ClusterIP service named monitoring-service-clusterip with a TCP port mapping from 8010 to 8084. | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=8010:8084
```
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": "... |
Create a new config map named api-config using the settings from file1.txt and the key2 from file2.txt. | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/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 con... |
Import the 'smtp_server' key from the 'log-config' config map and set it as an environment variable in the 'proxy-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/log-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 definitio... |
Set the CPU limit of the nginx container in the wordpress deployment to 5 and the memory limit to 1Gi | Command:
```bash
kubectl set resources deployment wordpress -c=nginx --limits=cpu=5,memory=1Gi
```
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 ... |
Create a priority class named 'backend-priority' with a value of 1000 and a description of "Priority for backend processing workloads" | Command:
```bash
kubectl create priorityclass backend-priority --value=1000 --description="Priority for backend processing workloads"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VALUE --global-default=BOOL ... |
Create an ingress named 'service-ingress' that routes requests for website.com/bar to the service 'svc1' on port 8080 | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/bar=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": "", "usag... |
Expose the replica set 'node' as a service on port 8888, connecting to the containers on port 818100. | Command:
```bash
kubectl expose rs node --port=8888 --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 specified port. A... |
Copy the directory /tmp/foo_dir from the remote pod named security-scanner-pod-18 in the kube-system namespace to the local directory /tmp/bar. | Command:
```bash
kubectl cp kube-system/security-scanner-pod-18:/tmp/foo_dir /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Forward data between ports 5000 on your local machine and port 8888 in the cdn-service-pod. | Command:
```bash
kubectl port-forward pod/cdn-service-pod 5000 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 au... |
Create a new ClusterIP service named shipping-service-clusterip, mapping port 8082 on the local machine to port 9000 on the service | Command:
```bash
kubectl create service clusterip shipping-service-clusterip --tcp=8082:9000
```
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... |
Import specific keys from a config map to an environment variable in a deployment | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-name-config deployment/cache-cluster-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... |
Get the output from running the 'mongo --version' command in the 'nebula-navigator' container of the 'gateway-pod' pod. | Command:
```bash
kubectl exec gateway-pod -c nebula-navigator -- mongo --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 om... |
Set the custom TLS server name to "sun-cluster" for the "edge-cluster" cluster entry | Command:
```bash
kubectl config set-cluster edge-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-... |
Create a pod disruption budget named frontend-pdb that will select all pods with the version=v2 label and require a minimum of four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget frontend-pdb --selector=version=v2 --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 [--dry... |
import the 'DATABASE_URL' key from the 'api-config' config map and set it as an environment variable for the 'authentication-service-deployment' deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/api-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 variable... |
Update the environment variable SMTP_HOST in the deployment named 'cache-cluster-deployment'. | Command:
```bash
kubectl set env deployment/cache-cluster-deployment SMTP_HOST=smtp.example.com
```
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 po... |
Set the service account of the deployment "search-engine-deployment" to "kube-dns" | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment kube-dns
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kub... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/log-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 definition... |
Forward traffic from local port 5000 to port 8080 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 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 selected a... |
Copy the local file '/tmp/foo_dir' to the remote pod 'message-broker-pod-15' in the 'prometheus' namespace, with the destination path '/tmp/bar'. | Command:
```bash
kubectl cp /tmp/foo_dir prometheus/message-broker-pod-15::/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 ... |
Execute the '/bin/bash -c "echo 'Hello, Amazon Linux'"' command in the pod proxy-service-pod and display the output | Command:
```bash
kubectl exec proxy-service-pod -c nebula-navigator -- /bin/bash -c "echo 'Hello, Amazon Linux'"
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "",... |
Taint nodes with a label matching 'namespace=mynamespace' with the key 'special' and the value 'storage-node-13:PreferNoSchedule' | Command:
```bash
kubectl taint node -l namespace=mynamespace special=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Create an ingress named 'rontend-ingress' that routes requests for 'testing.com/example' to the service 'svc1:8000' and uses the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress rontend-ingress --rule="testing.com/example=svc1:8000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Set the cluster field in the 'my-context' context to 'cluster-gamma' | Command:
```bash
kubectl config set contexts.on-prem-context.cluster cluster-gamma
```
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... |
Check if the current user has permission to list the "cron-job" job in the "kube-system" namespace in the cluster | Command:
```bash
kubectl auth can-i list jobs.batch/cron-job -n kube-system
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that ... |
Forward port 6379 on all addresses to port 8888 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-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 po... |
list the replication controller with the name "web", the service with the name "chat-app-rc", and the pod with the name "security-service-pod" | Command:
```bash
kubectl get rc/web service/chat-app-rc pods/security-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is name... |
Remove the label 'tier' from the pod named 'payment' | Command:
```bash
kubectl label pods payment tier-
```
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 true... |
Update the pod named 'cdn' by adding the annotation 'description' with the value 'Web server for marketing site' | Command:
```bash
kubectl annotate pods cdn description='Web server for marketing site'
```
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... |
delete pods and services named "media-stream" and "database" | Command:
```bash
kubectl delete pod,service media-stream database
```
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 sel... |
Add a taint with key 'datacenter' on nodes having the label team=devops | Command:
```bash
kubectl taint node -l team=devops datacenter=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": "... |
Add a taint with the key 'special' on nodes that have the label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack special=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": "", "usa... |
Port forward from local port 8081 to pod port 8088 on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 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 po... |
Rollback to the previous version of a deployment | Command:
```bash
kubectl rollout undo deployment/namespace-3
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Add a taint with the key 'app' on nodes that have the label 'customer=acme-corp'. | Command:
```bash
kubectl taint node -l customer=acme-corp app=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": "", "usage... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.