prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the `database_url` key from the `env-vars` ConfigMap and set it as an environment variable for the `mydeployment` deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/env-vars 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 ... |
Add an annotation to the 'chat-app' pod with the key 'backup-strategy' and the value 'daily backups'. | Command:
```bash
kubectl annotate pods chat-app backup-strategy='daily backups'
```
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... |
Create a single ingress called 'app-loadbalancer-ingress' that directs requests to site.com/module to svc # svc1:8081 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="site.com/module=svc1:8081,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 copy of a pod named "mypod" and change all the container images to "ethereum/client-go" | Command:
```bash
kubectl debug mypod --copy-to=my-debugger --set-image=*=ethereum/client-go
```
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 re... |
Scale the deployment named backend-service-replicaset from its current size of 7 replicas to a new size of 3 replicas. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=3 deployment/backend-service-replicaset
```
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 --r... |
Import the 'API_KEY' key from the 'app-config' config map and set it as environment variable in the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-config 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 definition... |
Create a job named "cleanup" using the nginx image, and run the "nginx -t" command within the job | Command:
```bash
kubectl create job cleanup --image=nginx -- nginx -t
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
Create a job named test-job by copying the configuration from the cron job named weekly-summary | Command:
```bash
kubectl create job test-job --from=cronjob/weekly-summary
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One... |
Create a job named "data-migration-job" with the image "centos" and the command "sleep 3600". | Command:
```bash
kubectl create job data-migration-job --image=centos -- sleep 3600
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output fo... |
Forward traffic from local port 8088 to pod port 8088 on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8088: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 ... |
Retrieve the logs of the previous terminated "time-machine" container from the "proxy-server-pod" pod. | Command:
```bash
kubectl logs -p -c time-machine proxy-server-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",... |
Open the loadbalancer-service in the nano editor | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/loadbalancer-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 vari... |
Auto scale the replication controller "proxy-server" to have between 1 and 3 pods, with a target CPU utilization of 20%. | Command:
```bash
kubectl autoscale rc proxy-server --max=3 --cpu-percent=20
```
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... |
Set environment variables in a deployment from a secret | Command:
```bash
kubectl set env --from=secret/app-config-secret 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 definitions in one or... |
Add an annotation to a pod in the "docker-registry.yaml" file to specify the team as 'frontend team'. | Command:
```bash
kubectl annotate -f docker-registry.yaml team='frontend team'
```
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 includ... |
Create an ingress resource named 'service-ingress' that routes requests from 'foo.com/bar' to the service 'svc1' on port '3306', using the TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress service-ingress --rule="foo.com/bar=svc1:3306,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Forward traffic from local port 8088 to port 8080 in a pod selected by the monitoring-stack-deployment | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8088 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 ... |
Create a new config map with specified keys from files | Command:
```bash
kubectl create configmap app-config-dev --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 ... |
Get the output from running the 'redis-server' command in the first container of the first pod of the 'api-service' service. | Command:
```bash
kubectl exec svc/api-service -- 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 omitted, use the kube... |
Remove the label named 'tier' from the 'email' pod | Command:
```bash
kubectl label pods email 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, ... |
Import the 'log_level' key from the 'log-config' ConfigMap and set it as an environment variable in the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/log-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 environment variable defi... |
Execute the 'ash' command within the first pod of the 'logging-service' service and retrieve the output. | Command:
```bash
kubectl exec svc/logging-service -- ash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.k... |
Forward traffic from port 8888 on all addresses to port 5432 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8888: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 w... |
Get the output from the lunar-launcher container in the mypod pod. | Command:
```bash
kubectl attach mypod -c lunar-launcher
```
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... |
Describe the node dev-node-2.mycompany.net to get detailed information about it. | Command:
```bash
kubectl describe nodes dev-node-2.mycompany.net
```
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 ty... |
Create a single ingress called "default-ingress" with a rule that directs requests to "site.com/module" to "svc1:3000" and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="site.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": "", "usag... |
Import the 'secret_key' from the 'log-config' config map and set it as an environment variable for the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/log-config 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 definit... |
Attach to the log-aggregator-pod and get output from the warp-drive container | Command:
```bash
kubectl attach log-aggregator-pod -c warp-drive
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
import the specific keys "EXTERNAL_API_URL" from the "app-config-dev" configmap and apply them to the "database-deployment" deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-config-dev deployment/database-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 defin... |
Create a new LoadBalancer service named 'database-lb' and map the TCP port 8089 to port 8010 | Command:
```bash
kubectl create service loadbalancer database-lb --tcp=8089:8010
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "defaul... |
Forward local port 3000 to port 5000 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 3000: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... |
Copy the contents of the "/var/run/secrets/kubernetes.io/serviceaccount/" directory from the remote pod named "backend-pod-13" in the "kube-flannel" namespace to the "/tmp/bar" directory locally. | Command:
```bash
kubectl exec -n kube-flannel backend-pod-13 -- tar cf - /var/run/secrets/kubernetes.io/serviceaccount/ | tar xf - -C /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"... |
Update the deployment 'email-server-deployment' with a new environment variable called SMTP_USERNAME and set the value to your-username | Command:
```bash
kubectl set env deployment/email-server-deployment SMTP_USERNAME=your-username
```
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... |
Remove the "client-secret" config value for the OpenID Connect auth provider for the "service-account" entry | Command:
```bash
kubectl config set-credentials service-account --auth-provider=oidc --auth-provider-arg=client-secret-
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --cl... |
Forward local port 5000 to port 8888 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-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 a... |
Import environment variables prefixed with 'MYSQL_' from the 'app-name-config' config map and update the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --from=configmap/app-name-config --prefix=MYSQL_ deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions ... |
Start a pod named "hazelcast" with the image "postgres" and expose port 8082. | Command:
```bash
kubectl run hazelcast --image=postgres --port=8082
```
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 a local port to a pod port | Command:
```bash
kubectl port-forward pod/chat-app-pod :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 automatic... |
Forward local ports 5000 to 8081 and listen on port 8081 to/from port 6000 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5000 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... |
List specific resources by their type and names | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/frontend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespace... |
Create an ingress resource called 'private-service-ingress' with a rule that directs requests to site.com/bar to svc1 on port 7000 | Command:
```bash
kubectl create ingress private-service-ingress --rule="site.com/bar=svc1:7000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Forward local port 6379 to port 8080 in the pod "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 6379: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 auto... |
Add a taint with key 'dedicated' and value 'prod-node-5:PreferNoSchedule' on the nodes having label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster dedicated=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Add a taint with key 'environment' on nodes having label tier=frontend | Command:
```bash
kubectl taint node -l tier=frontend environment=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Import the 'CONFIG_FILE_PATH' key from the 'app-config' config map and set it as an environment variable for the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config deployment/analytics-platform-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Copy the local file "/tmp/foo" to the remote pod "openfaas/worker-pod-4" in the "/tmp/bar" directory. | Command:
```bash
kubectl cp /tmp/foo openfaas/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.kube... |
Auto scale the replication controller "web" with a target CPU utilization of 90% and a maximum of 4 pods. | Command:
```bash
kubectl autoscale rc web --max=4 --cpu-percent=90
```
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... |
expose the deployment "node" as a service on port 8888, which will connect to the containers on port 500100 | Command:
```bash
kubectl expose deployment node --port=8888 --target-port=500100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified... |
Create a new ClusterIP service named "catalog-service-clusterip" with a TCP port mapping from port 8010 to port 8000. | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=8010:8000
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Create a deployment named jenkins with the mcr.microsoft.com/dotnet/core/runtime image and expose port 5001 | Command:
```bash
kubectl create deployment jenkins --image=mcr.microsoft.com/dotnet/core/runtime --port=5001
```
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": "", "u... |
Get the output of the 'gem --version' command from the first container of the pod belonging to the 'notification-service' service. | Command:
```bash
kubectl exec svc/notification-service -- gem --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, us... |
Create a new secret named 'git-credentials-secret' with key1='supersecret' and key2='topsecret' | Command:
```bash
kubectl create secret generic git-credentials-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
```
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, ... |
Create a new config map named "app-name-config" by reading environment variables from the specified file. | Command:
```bash
kubectl create configmap app-name-config --from-env-file=path/to/options.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 th... |
Apply a taint with the key 'zone' and value 'testing-node-11:PreferNoSchedule' to the nodes that have the label 'project=project-alpha' | Command:
```bash
kubectl taint node -l project=project-alpha 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": "", "u... |
Import the 'database_url' key from the 'db-config' config map into the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/db-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 definitio... |
List a pod identified by type and name specified in "conf.yaml" in JSON output format | Command:
```bash
kubectl get -f conf.yaml -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results... |
Forward port 8888 on all addresses to port 8080 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8888: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 po... |
Create a service for a replication controller specified in a YAML file, which serves on port 8089 and connects to the containers on port 909200. | Command:
```bash
kubectl expose -f php-controller.yaml --port=8089 --target-port=909200
```
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 sp... |
Auto scale the deployment "backend" with a minimum of 1 pod and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment backend --min=1 --max=13
```
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... |
List deployments in JSON output format, specifically for the "rc-1.1.0" version of the "extensions" API group. | Command:
```bash
kubectl get deployments.rc-1.1.0.extensions -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 wi... |
Create a new ExternalName service named external-ldap-service with the external domain name sample-domain.net | Command:
```bash
kubectl create service externalname external-ldap-service --external-name sample-domain.net
```
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 reference servi... |
Forward local ports 5432 and 6000 to ports 6379 and 6000 in the pod named e-commerce-pod | Command:
```bash
kubectl port-forward pod/e-commerce-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 be selected aut... |
Create a new config map named 'app-name-config' using the files 'file1.txt' as 'conf' and 'file2.txt' as 'data' | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/properties/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... |
Change the replica count of the deployment "staging-app-rs" to match the current size of 5. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=5 deployment/staging-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-vers... |
Create a deployment named 'registry' using the 'ubuntu' image and expose port 8888. | Command:
```bash
kubectl create deployment registry --image=ubuntu --port=8888
```
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:... |
Set the service account of the deployment "cache-cluster-deployment" to "vault" | Command:
```bash
kubectl set serviceaccount deployment cache-cluster-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:
`kubect... |
Forward traffic on port 8080 from all addresses to port 5000 in the pod named proxy-server-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 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 ... |
Add a taint with key 'disktype' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 disktype=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... |
List deployments in YAML output format, in the "stable-2.0.0" version of the "api-v2" API group | Command:
```bash
kubectl get deployments.stable-2.0.0.api-v2 -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... |
Start a pod named "hazelcast" using the mcr.microsoft.com/dotnet/core/runtime image and expose port 9092. | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --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...... |
Create a service for a replication controller by specifying the YAML file and the desired port mappings | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=3001 --target-port=808400
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Forward traffic from port 8081 locally to port 6379 in a pod selected by the log-aggregator-deployment deployment | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 8081 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 wi... |
Retrieve the logs for the container proxy-service-deployment-1 in the deployment named security-service-pod | Command:
```bash
kubectl logs deployment/proxy-service-deployment -c security-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful fla... |
Delete the pod named "foo" with minimal delay | Command:
```bash
kubectl delete pod foo --now
```
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.
Some resource... |
Add an annotation 'app-version' with the value '2.5.1' to the pod named 'gateway' | Command:
```bash
kubectl annotate pods gateway 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 include arbitrary st... |
Execute the 'redis-cli' command on the first pod of the 'search-engine-deployment' deployment and retrieve the output. | Command:
```bash
kubectl exec deploy/search-engine-deployment -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a new NodePort service named 'api-service-nodeport' that maps port 9090 on the cluster to port 9092 on the service. | Command:
```bash
kubectl create service nodeport api-service-nodeport --tcp=9090:9092
```
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", "default":... |
Forward port 3000 on all addresses to port 8888 in the pod named api-service-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 3000: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 w... |
Forward traffic from port 9090 on all addresses to port 8088 inside the pod called cdn-service-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 9090: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 w... |
Add a taint with the key 'datacenter' and value 'worker-node-3:PreferNoSchedule' on nodes having the label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth datacenter=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=SMTP_SERVER --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 in... |
Retrieve the snapshot logs from the container named "frontend-pod-1" in the deployment "frontend-deployment" | Command:
```bash
kubectl logs deployment/frontend-deployment -c frontend-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "... |
Create a LoadBalancer service named media-stream-lb that directs traffic from port 3306 to port 8888. | Command:
```bash
kubectl create service loadbalancer media-stream-lb --tcp=3306:8888
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "de... |
Forward traffic from port 8080 on all addresses to port 8888 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8080: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 w... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=api_key --from=configmap/api-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Apply the configuration in the manifest.yaml file to all resources that have the label team=devops, and delete any other resources that are not in the file and also have the label app=nginx | Command:
```bash
kubectl apply --prune -f manifest.yaml -l team=devops
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'cr... |
Set the service account of the 'proxy-service-deployment' deployment to 'argocd' | Command:
```bash
kubectl set serviceaccount deployment proxy-service-deployment argocd
```
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:
`kubec... |
Import environment variables starting with "MYSQL_" from the config map "app-settings" and apply them to the "load-balancer-deployment" deployment. | Command:
```bash
kubectl set env --from=configmap/app-settings --prefix=MYSQL_ deployment/load-balancer-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 data between local port 8081 and port 3000 in a pod selected by the api-server-deployment deployment. | Command:
```bash
kubectl port-forward deployment/api-server-deployment 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 criteria, a pod will b... |
Set the resource request and limits for all containers in the Centos deployment | Command:
```bash
kubectl set resources deployment centos --limits=cpu=200m,memory=512Mi --requests=cpu=2,memory=256Mi
```
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... |
Set the resource request and limits for all containers in the php deployment | Command:
```bash
kubectl set resources deployment php --limits=cpu=200m,memory=512Mi --requests=cpu=50m,memory=4Gi
```
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, ... |
Display the most recent 5 lines of logs for the log-aggregator-pod | Command:
```bash
kubectl logs --tail=5 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": "--container", "short"... |
Get the output from running the 'nginx' command in the container named 'mycontainer' from the pod named 'monitoring-pod' | Command:
```bash
kubectl exec monitoring-pod -c mycontainer -- nginx
```
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... |
Execute the 'nginx' command in the 'warp-drive' container of the 'chat-app-pod' pod and retrieve the output | Command:
```bash
kubectl exec chat-app-pod -c warp-drive -- nginx
```
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 ... |
Scale the deployment "frontend-rs" to 7 replicas | Command:
```bash
kubectl scale --current-replicas=5 --replicas=7 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... |
Forward port 6379 from the pod named "cdn-service-pod" to port 6379 on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 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 w... |
Expose the 'chat-app-pod' pod's port 3000 by listening on port 8080 locally | Command:
```bash
kubectl port-forward pod/chat-app-pod 8080: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... |
Forward port 8888 of the pod e-commerce-pod to a random port locally | Command:
```bash
kubectl port-forward pod/e-commerce-pod :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 automat... |
Partially update a node using a strategic merge patch, specifying the patch as JSON | Command:
```bash
kubectl patch node storage-node-13 -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... |
set the resource limits and requests for all containers in the centos deployment | Command:
```bash
kubectl set resources deployment centos --limits=cpu=200m,memory=512Mi --requests=cpu=50m,memory=256Mi
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.