prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the 'api_key' key from the 'log-config' config map into the 'mydeployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/log-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 one or mor... |
Set the service account of the deployment "proxy-service-deployment" to "cert-manager" | Command:
```bash
kubectl set serviceaccount deployment proxy-service-deployment cert-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), statefulset
Syntax:
... |
Forward local port 8000 to pod port 3000 for a specific pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-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 will be selected auto... |
Update the annotation 'contact-email' for the pod named 'cdn' with the value 'support@example.com' | Command:
```bash
kubectl annotate pods cdn contact-email=support@example.com
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ... |
Start a pod using the 'hazelcast' image and expose port 8084 | Command:
```bash
kubectl run hazelcast --image=node --port=8084
```
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": "--fil... |
Create a single ingress called 'website-ingress' with a rule that directs requests to testing.com/bar to svc1:8084 and uses a TLS secret called "my-cert": | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/bar=svc1:8084,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 pod disruption budget named auth-service-pdb that selects pods with the label release=1.0.0, and requires at least one of them to be available at all times | Command:
```bash
kubectl create poddisruptionbudget auth-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-available=N... |
Create a copy of the pod "email-service-pod" by adding a debug container and changing container images | Command:
```bash
kubectl debug email-service-pod -it --copy-to=debug-image-web --image=debian --set-image=worker=my-custom-worker:1.2.3,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 obje... |
Open the 'gateway-service' service for editing using the 'nvim' alternative editor. | Command:
```bash
KUBE_EDITOR="nvim" kubectl edit svc/gateway-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... |
Forward traffic from port 5432 on all addresses to port 8081 in the web-app pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-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 pod will ... |
Forward traffic from local port 8888 to port 5000 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8888: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 new config map named kube-system-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap kube-system-config --from-file=conf=/path/to/preferences/file1.txt --from-file=data=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When... |
Create a deployment named proxy that runs the node image with 7 replicas | Command:
```bash
kubectl create deployment proxy --image=node --replicas=7
```
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: jso... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-config-prod 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 vari... |
Update the image of all containers in the 'app-v2' daemonset to 'httpd:2.4.48'. | Command:
```bash
kubectl set image daemonset app-v2 *=httpd:2.4.48
```
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 new config map named global-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap global-config --from-file=properties=/path/to/options/file1.txt --from-file=key1=/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 c... |
Listen on port 9090 on your local machine and forward traffic to port 5432 in the "proxy-server-pod" pod. | Command:
```bash
kubectl port-forward pod/proxy-server-pod 9090: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 will be selected a... |
Change the server field of the staging-cluster cluster to https://1.2.3.4 | Command:
```bash
kubectl config set clusters.staging-cluster.server https://1.2.3.4
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value yo... |
Create a pod disruption budget named "frontend-pdb" that selects all pods with the label "env=production" and ensures that at least 9 of them are available at any given time. | Command:
```bash
kubectl create poddisruptionbudget frontend-pdb --selector=env=production --min-available=9
```
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 [-... |
Start a Jenkins pod and expose port 9092 | Command:
```bash
kubectl run hazelcast --image=jenkins --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": "--... |
Forward port 9090 from all addresses to port 9090 in the pod named security-service-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 9090:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
Update the image of all containers in the 'app-v2' daemonset to 'alpine:3.14' | Command:
```bash
kubectl set image daemonset app-v2 *=alpine:3.14
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kubec... |
Create an ingress named 'api-v1-ingress' with a rule that directs requests for 'site.com/example' to 'svc1:8082' and use the 'my-cert' TLS secret. | Command:
```bash
kubectl create ingress api-v1-ingress --rule="site.com/example=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... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=database_url --from=configmap/env-vars 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 definiti... |
Forward local port 8888 to port 3000 in the pod "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 8888: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 will be selected autom... |
Begin streaming the logs from all containers in pods that have the label "release=beta" | Command:
```bash
kubectl logs -f -l release=beta --all-containers=true
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--contai... |
Create a service for the 'wordpress' deployment in the default namespace, which listens on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose deployment wordpress --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 spec... |
Set the cluster field in the 'app-1-context' context to 'data-cluster' | Command:
```bash
kubectl config set contexts.app-1-context.cluster data-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 wa... |
View the last-applied-configuration annotations for a specific deployment in YAML format | Command:
```bash
kubectl apply view-last-applied deployment/wordpress
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-appl... |
Set the service account of deployment "notification-handler-deployment" to "flux" | Command:
```bash
kubectl set serviceaccount deployment notification-handler-deployment flux
```
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:
`... |
Get the output from running the 'irb' command in the first container of the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl exec deploy/payment-processor-deployment -- irb
```
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... |
Show the differences between the resources included in the conf.json file and the current state of the cluster | Command:
```bash
kubectl diff -f conf.json
```
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 command. ... |
Listen on the localhost IP address and the selected IP address (10.19.21.23), forwarding traffic from port 8888 to port 5000 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 8888: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 th... |
get detailed information about the pod specified in the parameters.json file | Command:
```bash
kubectl describe -f parameters.json
```
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, provide ... |
Create a pod disruption budget named logging-pdb that selects all pods with the app=nginx label and requires at least 50% of the selected pods to be available at any point in time. | Command:
```bash
kubectl create pdb logging-pdb --selector=app=nginx --min-available=50%
```
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-run=server|clie... |
Scale the deployment named frontend-rs to 3 replicas if its current size is already 3 | Command:
```bash
kubectl scale --current-replicas=3 --replicas=3 deployment/frontend-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... |
Start the mysql pod using the default command, but use custom arguments (arg1 .. argN) for that command | Command:
```bash
kubectl run nginx --image=mysql -- <arg1> <arg2> ... <argN>
```
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:
"... |
Create an ingress called 'app-loadbalancer-ingress' that directs requests for "website.com/example" to "svc1:8443" using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/example=svc1:8443,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", "defaul... |
Rename the context 'cloud-context' to 'user-b-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context cloud-context user-b-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... |
Create a hazelcast pod using the hazelcast/hazelcast image and expose port 5432. | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=5432
```
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:... |
Forward local ports to a pod | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 6379 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 ... |
Forward local port 5432 to port 9090 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-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 criteria, a pod will be selected au... |
Add a taint with the key 'dedicated' on nodes having the label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp dedicated=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... |
Update the 'api-server-deployment' deployment by setting the environment variable 'MAX_CONNECTIONS' to the value of 100. | Command:
```bash
kubectl set env deployment/api-server-deployment MAX_CONNECTIONS=100
```
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 template... |
Create a service for the 'ruby' deployment, which serves on port 80 and connects to the containers on port 543200 | Command:
```bash
kubectl expose deployment ruby --port=80 --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 specified p... |
Update the pod 'vpn' with the annotation 'criticality' and set the value to 'high', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods vpn criticality='high'
```
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 arb... |
Execute 'ruby --version' command on the first container of the analytics-service pod and display the output. | Command:
```bash
kubectl exec svc/analytics-service -- ruby --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Add a taint with key 'zone' and value 'gpu-node-12:PreferNoSchedule' on nodes having the label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth zone=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": "Outpu... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/global-config deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Update the annotation of a pod by overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods backend 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 large... |
Update the 'auth' pod by adding the label 'tier' with the value 'frontend' | Command:
```bash
kubectl label pods auth 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 new pod named "hazelcast" using the "centos" image and expose port 8443 | Command:
```bash
kubectl run hazelcast --image=centos --port=8443
```
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": "--f... |
Create a service for the replicated centos, serving on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose rc centos --port=8089 --target-port=700000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
create a job with the command 'mongo --version' using the 'mongo' image and name it 'testing' | Command:
```bash
kubectl create job testing --image=mongo -- mongo --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": "Output format. O... |
Create an ingress called 'app-ingress' that directs requests for 'testing.com/bar' to the service 'svc1:8181', and use the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress app-ingress --rule="testing.com/bar=svc1:8181,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
List deployments in YAML format for a specific API group and version. | Command:
```bash
kubectl get deployments.v2.0.0.custom-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 wil... |
Start an Ubuntu pod and expose port 8089 on the container. | Command:
```bash
kubectl run hazelcast --image=ubuntu --port=8089
```
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": "--f... |
Edit the 'monitoring-stack-deployment' deployment in YAML format and save the modified configuration in its annotation. | Command:
```bash
kubectl edit deployment/monitoring-stack-deployment -o yaml --save-config
```
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... |
Set the cluster field in a specific context to a given cluster name. | Command:
```bash
kubectl config set contexts.cloud-context.cluster cloud-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... |
Create a debug copy of the "api-service-pod" with all container images changed to "mysql" | Command:
```bash
kubectl debug api-service-pod --copy-to=debug-image-web --set-image=*=mysql
```
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 r... |
Update the deployment 'order-processing-deployment' with a new environment variable SMTP_HOST=smtp.example.com | Command:
```bash
kubectl set env deployment/order-processing-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... |
Create a cron job named "email-notifications" that runs the command "irb" every minute using the "ruby" image. | Command:
```bash
kubectl create cronjob email-notifications --image=ruby --schedule="*/1 * * * *" -- irb
```
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", "... |
View detailed information about a specific pod named "api-server-pod" | Command:
```bash
kubectl describe pods/api-server-pod
```
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, provide... |
Set the service account for the deployment "email-server-deployment" to "kube-scheduler" | Command:
```bash
kubectl set serviceaccount deployment email-server-deployment kube-scheduler
```
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:... |
Scale a resource to 1 using the parameters specified in "params.json" file | Command:
```bash
kubectl scale --replicas=1 -f params.json
```
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... |
Get the output from running the 'geth version' command inside the first container of the 'database-pod' pod. | Command:
```bash
kubectl exec database-pod -- 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 the kubectl... |
Get the output from running the 'npm --version' command in the 'astro-container' from the pod 'chat-app-pod'. | Command:
```bash
kubectl exec chat-app-pod -c astro-container -- npm --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omit... |
Create a service for the hazelcast-controller replication controller specified in the "hazelcast-controller.yaml" file | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=3001 --target-port=909100
```
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 ... |
Remove the taint with key 'datacenter' and effect 'NoExecute' from the node 'kube-master-9' if one exists | Command:
```bash
kubectl taint nodes kube-master-9 datacenter: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. One ... |
Create a single ingress called 'default-ingress' that directs requests to testing.com/input to the 'svc1' service on port 8443, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="testing.com/input=svc1:8443,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Create a service for the replicated ruby using a replica set | Command:
```bash
kubectl expose rs ruby --port=8084 --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. A... |
Set the service account of the deployment 'analytics-platform-deployment' to 'prometheus' | Command:
```bash
kubectl set serviceaccount deployment analytics-platform-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
Synta... |
Create a new NodePort service named 'log-aggregator-nodeport' with the mapping TCP 9090 to port 6379. | Command:
```bash
kubectl create service nodeport log-aggregator-nodeport --tcp=9090:6379
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "defaul... |
Copy the file named "foo" from the local machine to the "/tmp/bar" directory in a remote pod in the "logging" namespace. | Command:
```bash
kubectl cp :/tmp/foo logging/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 the kub... |
List the deployments of the "third-party-apps" API group in the "dev-2.2.0" version, and display the output in YAML format. | Command:
```bash
kubectl get deployments.dev-2.2.0.third-party-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... |
Add a taint with key 'app' on nodes having label myLabel | Command:
```bash
kubectl taint node -l myLabel app=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
Create a cluster role named "foo" with the ability to use configmaps with the resource name specified as "notification-service" and "order-fulfillment". | Command:
```bash
kubectl create clusterrole foo --verb=use --resource=configmaps --resource-name=notification-service --resource-name=order-fulfillment
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=serv... |
Create an ingress rule called 'web-ingress' that routes requests from testing.com/module to svc1:8084 with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress web-ingress --rule="testing.com/module=svc1:8084,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... |
Get the output from running the 'redis-server' command in the astro-container from the monitoring-pod. | Command:
```bash
kubectl exec monitoring-pod -c astro-container -- redis-server
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Import specific keys from a config map to the deployment's environment variables | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-settings deployment/notification-handler-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 ClusterIP service named billing-service-clusterip with port mapping TCP 7000 on the service to port 3001 on the pods. | Command:
```bash
kubectl create service clusterip billing-service-clusterip --tcp=7000:3001
```
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"... |
List the deployments in the "rc-1.1.0" version of the "external-apps" API group in YAML output format. | Command:
```bash
kubectl get deployments.rc-1.1.0.external-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... |
Create a debug copy of the 'web-app-pod' pod, changing all container images to 'nginx' | Command:
```bash
kubectl debug web-app-pod --copy-to=debug-image-web --set-image=*=nginx
```
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 resou... |
Set the resource request and limits for all containers in the python deployment | Command:
```bash
kubectl set resources deployment python --limits=cpu=200m,memory=512Mi --requests=cpu=500m,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 request... |
List all allowed actions in the "kube-dns" namespace | Command:
```bash
kubectl auth can-i --list --namespace=kube-dns
```
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 starts with ... |
Forward traffic from port 5000 on all addresses to port 5432 in the frontend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-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 will... |
Set a custom TLS server name for the edge-cluster cluster entry. | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=staging-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] [--certific... |
Add a taint with key 'zone' on nodes having label team=devops | Command:
```bash
kubectl taint node -l team=devops zone=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 form... |
Set the cluster field of a context to a given cluster name | Command:
```bash
kubectl config set contexts.admin-context.cluster star-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 wa... |
Run the 'mysql' command inside the 'time-machine' container of the 'analytics-pod' pod and get the output. | Command:
```bash
kubectl exec analytics-pod -c time-machine -- mysql
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Create a service for a replication controller specified in the yaml file, which serves on port 8082 and connects to the containers on port 800000 | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=8082 --target-port=800000
```
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 ... |
Import the SMTP_SERVER key from the app-name-config ConfigMap into the analytics-platform-deployment deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-name-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... |
Add or update the annotation 'release-notes' with the value 'https://example.com/release-notes/v2.5.1' for the pod 'vpn' | Command:
```bash
kubectl annotate --overwrite pods vpn release-notes='https://example.com/release-notes/v2.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... |
Forward the local port 8081 to the port 8081 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 8081: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 automaticall... |
Connect and interact with the terminal inside a specific container in a pod | Command:
```bash
kubectl attach payment-gateway-pod -c quantum-quark -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. ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/kube-system-config deployment/notification-handler-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 environmen... |
Forward traffic from port 8888 on localhost and IP address 10.19.21.23 to port 8888 in the pod named "api-service-pod" using the kubectl port-forward command. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 8888: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 cri... |
Execute the 'wp' command in the chat-app-pod and get the output | Command:
```bash
kubectl exec chat-app-pod -- wp
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kubernete... |
List the deployments in YAML output format using the "v1.0.0" version of the "beta-apps" API group. | Command:
```bash
kubectl get deployments.v1.0.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 ... |
Start the ethereum/client-go pod with custom arguments by running the command "kubectl run nginx --image=ethereum/client-go -- <arg1> <arg2> .. | Command:
```bash
kubectl run nginx --image=ethereum/client-go -- <arg1> <arg2> ... <argN>
```
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...]`
Hel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.