prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the value of the `database_url` key from the `app-secrets` config map and set it as an environment variable for the `load-balancer-deployment` deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-secrets 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 definit... |
Forward traffic from local port 8000 to port 6379 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-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 wi... |
Create an ingress named 'private-service-ingress' with a rule that directs requests from testing.com/input to svc1:5001, and use the tls secret "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="testing.com/input=svc1:5001,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":... |
Update the scaling policy annotation to "auto-horizontal-scaling" for the pod specified in the "docker-registry.yaml" file | Command:
```bash
kubectl annotate -f docker-registry.yaml scaling-policy=auto-horizontal-scaling
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than... |
Execute the command 'yum install -y wget' inside the time-machine container of the frontend-pod and display the output. | Command:
```bash
kubectl exec frontend-pod -c time-machine -- yum install -y wget
```
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 o... |
Create a copy of the 'media-stream-pod' with a debug container, change the container images for 'app' and 'logger' to 'app:debug' and 'logging-app:debug' respectively | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-app --image=debian --set-image=app=app:debug,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by reso... |
Set the service account for the deployment "analytics-platform-deployment" to "metrics-server" | Command:
```bash
kubectl set serviceaccount deployment analytics-platform-deployment metrics-server
```
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
S... |
Create a new config map named env-vars with specified keys by providing file paths | Command:
```bash
kubectl create configmap env-vars --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/options/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... |
Switch to the moon-cluster context | Command:
```bash
kubectl config use-context moon-cluster
```
What it does:
Set the current-context in a kubeconfig file.
Syntax:
`kubectl config use-context CONTEXT_NAME` |
Forward traffic from local port 8088 to port 8000 in a pod selected by the email-server-deployment deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8088 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Add the 'last-deployment' annotation with the value '2023-03-15' to the 'auth' pod. | Command:
```bash
kubectl annotate pods auth last-deployment=2023-03-15
```
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 arbitr... |
Start a node pod with customized specifications parsed from a JSON file | Command:
```bash
kubectl run nginx --image=node --overrides='{ "apiVersion": "alpha-2.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] -- [COMMA... |
Create an interactive debugging session in a pod and attach to it | Command:
```bash
kubectl debug mypod -it --image=busybox
```
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 resource is specified.
The action tak... |
List the name and image of the container in the specified pod in custom columns | Command:
```bash
kubectl get pod vpn-service-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 -... |
Retrieve snapshot logs from the container "e-commerce-pod-1" of the deployment "mydeployment" | Command:
```bash
kubectl logs deployment/mydeployment -c e-commerce-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": "--con... |
Create an ingress called 'website-ingress' with a rule that directs requests from testing.com/input to svc1:8088, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/input=svc1:8088,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 deployment named "worker" that uses the "mongo" image and exposes port 8088 | Command:
```bash
kubectl create deployment worker --image=mongo --port=8088
```
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: js... |
Forward local traffic from port 8081 to a pod selected by a deployment on port 8080 | Command:
```bash
kubectl port-forward deployment/mydeployment 8081 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 selecte... |
Start a pod named 'nginx' using the 'node' image, but override the spec with a partial set of values parsed from the provided JSON | Command:
```bash
kubectl run nginx --image=node --overrides='{ "apiVersion": "feature-branch-2.3.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... |
Create a new ExternalName service named external-authentication-service | Command:
```bash
kubectl create service externalname external-authentication-service --external-name illustration-shop.shop
```
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 ... |
Create a new config map named env-vars with specified keys using files from disk. | Command:
```bash
kubectl create configmap env-vars --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/path/to/configs/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 ... |
Create an ingress resource called 'api-gateway-ingress' with a rule that directs requests from 'website.com/bar' to the service 'svc1' on port 3000 | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="website.com/bar=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": "", "... |
Update the 'chat-app' pod by adding the annotation 'team' with the value 'frontend team' | Command:
```bash
kubectl annotate pods chat-app 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 include arbitrar... |
Start a nginx pod with custom spec values parsed from a JSON file | Command:
```bash
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "feature-branch-2.3.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] [--comman... |
Forward local port 8888 to port 3000 on the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
List the deployments in the "v2.1.0" version of the "api-v1" API group in JSON format. | Command:
```bash
kubectl get deployments.v2.1.0.api-v1 -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will onl... |
Create a config map named monitoring-config from specified files | Command:
```bash
kubectl create configmap monitoring-config --from-file=conf=/path/to/profiles/file1.txt --from-file=data=/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 ... |
Scale the deployment named "frontend-rs" to 3 replicas if its current size is 1 | Command:
```bash
kubectl scale --current-replicas=1 --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... |
Retrieve the output of the 'elasticsearch-plugin --list' command executed in the first container of the first pod of the frontend-service service. | Command:
```bash
kubectl exec svc/frontend-service -- elasticsearch-plugin --list
```
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 o... |
Create a dockercfg secret by providing the necessary information | Command:
```bash
kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
```
What it does:
Create a new secret for use with Docker registries.
Dockercfg secrets are used to authenticate against Do... |
Import the "smtp_server" key from the "log-config" config map and set it as an environment variable in the "monitoring-stack-deployment" deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/log-config deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Retrieve the snapshot logs from the container mydeployment-1 of the deployment named analytics-pod. | Command:
```bash
kubectl logs deployment/mydeployment -c analytics-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": "--cont... |
Set the CPU and memory resource limits and requests for all containers in the redis deployment | Command:
```bash
kubectl set resources deployment redis --limits=cpu=200m,memory=512Mi --requests=cpu=2,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, ... |
Add a taint to nodes with a specific label. | Command:
```bash
kubectl taint node -l release=beta zone=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": "Output... |
Switch to a raw terminal mode and connect to the quantum-quark container in the gateway-pod pod | Command:
```bash
kubectl attach 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. If omitt... |
Create a deployment named drupal that runs the node image. | Command:
```bash
kubectl create deployment drupal --image=node
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|... |
Remove the annotation named 'description' from the 'api' pod | Command:
```bash
kubectl annotate pods api description-
```
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 string valu... |
Set the cluster of a context | Command:
```bash
kubectl config set contexts.dev-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 want... |
Create a new ClusterIP service named 'security-service-clusterip' with a tcp connection from port 3000 to port 8088. | Command:
```bash
kubectl create service clusterip security-service-clusterip --tcp=3000:8088
```
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 an ingress called 'website-ingress' with a rule that directs requests for site.com/bar to svc1:9090 and uses the tls secret named "my-cert". | Command:
```bash
kubectl create ingress website-ingress --rule="site.com/bar=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Forward local port 5000 to port 8080 in the pod "cdn-service-pod" | Command:
```bash
kubectl port-forward pod/cdn-service-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 au... |
set the service account of the deployment "load-balancer-deployment" to "jenkins" | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment jenkins
```
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... |
Force replace the resource described in the 'params.json' file by deleting it and then re-creating it | Command:
```bash
kubectl replace --force -f ./params.json
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replace -f ... |
create a job called "monitoring-job" using the centos image, with the command "bash" | Command:
```bash
kubectl create job monitoring-job --image=centos -- bash
```
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 'batch-processing' using the 'node' image and run the 'node' command | Command:
```bash
kubectl create job batch-processing --image=node -- node
```
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 ... |
Update the deployment 'database-deployment' by adding a new environment variable SMTP_USERNAME with your-username as its value | Command:
```bash
kubectl set env deployment/database-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 pod te... |
Enter a raw terminal mode and attach to the specified pod to interact with the 'bash' shell inside the 'rocket-ranger' container | Command:
```bash
kubectl attach email-service-pod -c rocket-ranger -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... |
Create an ingress resource called 'app-proxy-ingress' that routes requests from testing.com/module to the service 'svc1' on port 9000 | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="testing.com/module=svc1:9000,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": "", ... |
Execute the command `geth version` inside the first pod of the `analytics-service` service. | Command:
```bash
kubectl exec svc/analytics-service -- 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 th... |
Create an ingress called 'internal-ingress' that directs requests to 'foo.com/input' to service 'svc1:8088' with a TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress internal-ingress --rule="foo.com/input=svc1:8088,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... |
Create a pod disruption budget named api-service-pdb that selects all pods with the env=production label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-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... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/analytics-pod 6379:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/db-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 definit... |
Copy the local file ~/.config/kube to the /tmp/bar_dir directory within the remote pod named 'worker-pod-4' in the 'istio-system' namespace. | Command:
```bash
kubectl cp ~/.config/kube istio-system/worker-pod-4:/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 th... |
Update the configuration of the node specified in "containerd-config.toml" by partially merging in the strategic merge patch specified in the provided JSON file, setting the value of the 'key' field to 'new-value'. | Command:
```bash
kubectl patch -f containerd-config.toml -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]`
... |
Create a pod disruption budget named cron-jobs-pdb that will select all pods with the version=v2 label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-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 [--dr... |
Create a debug copy of the payment-gateway-pod with all container images changed to mysql. Name the debug pod debug-image-web. | Command:
```bash
kubectl debug payment-gateway-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 ... |
Forward local ports to pod ports | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8081 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 wil... |
Update the label of the 'analytics' pod with the key 'env' and the value 'production' | Command:
```bash
kubectl label pods analytics env=production
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage... |
Add a taint with the key 'disktype' on nodes that have the label app-type=microservice | Command:
```bash
kubectl taint node -l app-type=microservice disktype=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": "", "usa... |
Update the annotation 'team' of pod 'chat-app' to 'frontend-team' | Command:
```bash
kubectl annotate --overwrite pods chat-app 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 incl... |
Import environment variables from a secret into a deployment. | Command:
```bash
kubectl set env --from=secret/app-config-secret deployment/backend-microservice-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 on... |
Add a taint with key 'datacenter' and no value to node 'prod-node-5' | Command:
```bash
kubectl taint nodes prod-node-5 datacenter:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Expose a replication controller as a service, using the specifications in the "python-controller.yaml" file, with service port 8010 and container port 500100. | Command:
```bash
kubectl expose -f python-controller.yaml --port=8010 --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... |
Import the DATABASE_URL key from the log-config ConfigMap and set it as an environment variable for the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/log-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... |
Import environment variables from a config map with a specific prefix to a deployment | Command:
```bash
kubectl set env --from=configmap/app-name-config --prefix=MYSQL_ deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Create an ingress resource called 'service-ingress' that routes requests for testing.com/bar to svc1:8081 with a tls secret named "my-cert". | Command:
```bash
kubectl create ingress service-ingress --rule="testing.com/bar=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": "", "usag... |
Set the custom TLS server name to 'cluster-gamma' for the 'cluster-alpha' cluster entry. | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=cluster-gamma
```
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] [--certifica... |
Create a new config map named app-config-dev with the specified keys, where settings is set to the contents of /path/to/data/file1.txt and key2 is set to the contents of /path/to/options/file2.txt. | Command:
```bash
kubectl create configmap app-config-dev --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/options/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... |
Add a taint with the key 'workload' and value 'backup-node-14:PreferNoSchedule' on nodes with the label 'region=eu-west-2'. | Command:
```bash
kubectl taint node -l region=eu-west-2 workload=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": "", "usa... |
Update the annotation 'scaling-policy' of pod 'gateway' with the value 'auto-horizontal-scaling', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods gateway scaling-policy='auto-horizontal-scaling'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger t... |
List the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/e-commerce-rc pods/monitoring-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... |
Copy the contents of /var/run/secrets/kubernetes.io/serviceaccount/ from the remote pod "kube-proxy/image-resizer-pod-20" to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp kube-proxy/image-resizer-pod-20:/var/run/secrets/kubernetes.io/serviceaccount/ /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage... |
create a config map named api-config using specific keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/parameters/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 traffic from port 6379 on all addresses to port 9090 in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 6379: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 w... |
Create a new pod using the image "mcr.microsoft.com/dotnet/core/runtime" and expose port 9090 on the container. | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --port=9090
```
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...... |
Autoscale the deployment "proxy-server" with a minimum of 4 pods and a maximum of 11 pods. | Command:
```bash
kubectl autoscale deployment proxy-server --min=4 --max=11
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that... |
Update the 'email-server-deployment' deployment by setting the 'SMTP_PASSWORD' environment variable to 'your-password' | Command:
```bash
kubectl set env deployment/email-server-deployment SMTP_PASSWORD=your-password
```
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... |
Create a Pod Disruption Budget named elastic-search-pdb that selects all pods with the component=web label and requires a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget elastic-search-pdb --selector=component=web --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... |
List the environment variables defined on the deployment named 'user-management-deployment'. | Command:
```bash
kubectl set env deployment/user-management-deployment --list
```
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 (withi... |
Create an ingress called 'private-ingress' that directs requests to site.com/input to svc1:8010 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="site.com/input=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... |
Expose a replication controller specified in "node-controller.yaml" as a service on port 9092, with connections to the containers on port 500000. | Command:
```bash
kubectl expose -f node-controller.yaml --port=9092 --target-port=500000
```
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 s... |
Run the 'mongod' command in the nano-bot container of the chat-app-pod pod and get the output | Command:
```bash
kubectl exec chat-app-pod -c nano-bot -- mongod
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
Create a pod disruption budget named 'replica-set-pdb' that will select all pods with the 'version=v2' label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=version=v2 --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 [--... |
Set up a pod disruption budget named "cache-cluster-pdb" that selects all pods with the label "project=my-project" and ensure that at least four of those pods are always available. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=project=my-project --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-avail... |
Add the annotation 'monitoring-tool' with the value 'Prometheus' to the pod named 'api' | Command:
```bash
kubectl annotate pods api monitoring-tool=Prometheus
```
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 arbitra... |
Create a new NodePort service named proxy-service-nodeport with the TCP port mapping set to 8081:8089. | Command:
```bash
kubectl create service nodeport proxy-service-nodeport --tcp=8081:8089
```
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... |
Create a copy of the 'web-app-pod' pod and change all container images to 'mysql' | Command:
```bash
kubectl debug web-app-pod --copy-to=debug-image-api --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 resou... |
Create a ClusterIP service named my-cs that forwards traffic from port 3001 to port 5000 | Command:
```bash
kubectl create service clusterip my-cs --tcp=3001:5000
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Forward traffic from local port 8081 to port 9090 in the pod "backend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8081: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 ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/monitoring-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 defini... |
Return the snapshot logs from the container monitoring-stack-deployment-1 of the vpn-service-pod deployment | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c vpn-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags... |
Show all logs from the vpn-service-pod that have been written in the last hour | Command:
```bash
kubectl logs --since=1h vpn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short":... |
Create a new ClusterIP service named log-service-clusterip that forwards traffic from port 8081 to port 3306 | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=8081:3306
```
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", "d... |
Create an ingress resource named 'private-api-ingress' with a rule that directs requests for 'testing.com/module' to the service 'svc1' on port 8010 | Command:
```bash
kubectl create ingress private-api-ingress --rule="testing.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": ""... |
Get output from running the 'wp' command in the first container of the first pod of the 'logging-service' service. | Command:
```bash
kubectl exec svc/logging-service -- 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.ku... |
Remove all the taints with the key 'special' from the 'app-node-6' node | Command:
```bash
kubectl taint nodes app-node-6 special-
```
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|na... |
Update the annotation of the pod 'analytics' with the value 'Prometheus', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods analytics monitoring-tool='Prometheus'
```
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... |
Create a port-forward to listen on port 5000 locally and forward data to/from port 9090 in a pod selected by the email-server-deployment deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 5000 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... |
Set the cluster field in the 'client-2-context' context to 'edge-cluster' | Command:
```bash
kubectl config set contexts.client-2-context.cluster edge-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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.