prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a service for the replicated python using a replica set | Command:
```bash
kubectl expose rs python --port=8088 --target-port=844300
```
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.... |
Partially update the worker-node-3 node by patching its "spec" field with a JSON merge patch that sets the "type" field to "LoadBalancer". | Command:
```bash
kubectl patch node worker-node-3 -p '{"spec":{"type":"LoadBalancer"}'
```
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]`
Hel... |
Add a taint with the key 'app' on nodes that have the label 'stack=tech-stack' and the node name is 'db-node-7'. | Command:
```bash
kubectl taint node -l stack=tech-stack app=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Create an ingress named 'private-service-ingress' with a rule that directs requests for site.com/input to svc1:8888 | Command:
```bash
kubectl create ingress private-service-ingress --rule="site.com/input=svc1:8888,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": ""... |
List the deployments in JSON output format for the "feature-branch-2.3.0" version of the "backup-apps" API group. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.backup-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is name... |
create a secret named ssh-key-secret from an environment file | Command:
```bash
kubectl create secret generic ssh-key-secret --from-env-file=path/to/properties.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the bas... |
Import the specific key from a config map to a deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Apply the configuration in the manifest.yaml file, but only for resources that have the label version=v1.0.0 | Command:
```bash
kubectl apply --prune -f manifest.yaml -l version=v1.0.0
```
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 ... |
Run the 'mysqld' command in the 'astro-container' from the 'auth-service-pod' pod and get the output. | Command:
```bash
kubectl exec auth-service-pod -c astro-container -- mysqld
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
Retrieve output from running the 'elasticsearch-plugin --list' command in the container named 'mycontainer' within the pod named 'frontend-pod'. | Command:
```bash
kubectl exec frontend-pod -c mycontainer -- 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 nam... |
Copy a file named "foo" from a remote pod to a local directory named "bar" | Command:
```bash
kubectl cp default/image-resizer-pod-20:/tmp/foo /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 kubec... |
import the specific key 'MAX_CONNECTIONS' from the config map 'api-config' and set it as an environment variable in the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/api-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... |
Create a cluster role named "bar" with the non-resource URL "/readyz" and the verb "list". | Command:
```bash
kubectl create clusterrole "bar" --verb=list --non-resource-url=/readyz
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "... |
Create a pod disruption budget named auth-service-pdb that will select all pods with the owner=team-1 label and require a minimum of four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget auth-service-pdb --selector=owner=team-1 --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 ... |
Check the rollout status of the 'services' daemonset | Command:
```bash
kubectl rollout status daemonset/services
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Retrieve information about specific resources by their type and name. | Command:
```bash
kubectl get rc/web service/payment-gateway-rc pods/email-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is ... |
Remove all the taints with the key 'dedicated' from the node 'monitoring-node-15' | Command:
```bash
kubectl taint nodes monitoring-node-15 dedicated-
```
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: js... |
Create a new LoadBalancer service named e-commerce-lb using the command `kubectl create service loadbalancer e-commerce-lb --tcp=8082:8083`. | Command:
```bash
kubectl create service loadbalancer e-commerce-lb --tcp=8082:8083
```
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", "defa... |
Retrieve the output of the 'elasticsearch-plugin --list' command from the 'email-service-pod' pod, using the 'warp-drive' container. | Command:
```bash
kubectl exec email-service-pod -c warp-drive -- 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... |
Print the supported non-namespaced resources | Command:
```bash
kubectl api-resources --shortnamesspaced=false
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Apply the configuration in manifest.yaml and delete all other resources that are not in the file and match label app=web-app | Command:
```bash
kubectl apply --prune -f manifest.yaml -l app=web-app
```
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... |
Create a service for a replicated php application, serving on port 8088, that connects to the containers on port 8000 | Command:
```bash
kubectl expose rc php --port=8088 --target-port=8000
```
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 de... |
Create a deployment named scheduler with 4 replicas running the centos image | Command:
```bash
kubectl create deployment scheduler --image=centos --replicas=4
```
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 o... |
Retrieve the password for the "cluster-beta" user in the kubectl configuration | Command:
```bash
kubectl config view -o jsonpath='{.users[?(@.name == "cluster-beta")].user.password}'
```
What it does:
Display merged kubeconfig settings or a specified kubeconfig file.
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.
Syntax:
`kubectl config view`
Helpful... |
Update pod 'foo' with a new annotation | Command:
```bash
kubectl annotate --overwrite pods foo alert-email='alerts@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 a... |
Create a new config map named "app-config-dev" with the specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap app-config-dev --from-file=settings=/path/to/options/file1.txt --from-file=key2=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-secrets 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 definition... |
Forward local ports to a pod's ports | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 5000 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 wi... |
Execute the 'postgres' command in the 'code-explorer' container of the 'chat-app-pod' pod | Command:
```bash
kubectl exec chat-app-pod -c code-explorer -- postgres
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Create a pod disruption budget named load-balancer-pdb that selects all pods with the owner=team-1 label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=owner=team-1 --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... |
Create a deployment named 'mattermost' with 3 replicas, running the 'docker.elastic.co/elasticsearch/elasticsearch' image | Command:
```bash
kubectl create deployment mattermost --image=docker.elastic.co/elasticsearch/elasticsearch --replicas=3
```
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", "defa... |
Set new exec auth plugin arguments for the "prod-user" entry by running the command `kubectl config set-credentials prod-user --exec-arg=arg1 --exec-arg=arg2`. | Command:
```bash
kubectl config set-credentials prod-user --exec-arg=arg1 --exec-arg=arg2
```
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 --client-key=keyfile
Bearer token ... |
Update the 'vpn' pod by setting the annotation 'alert-email' to 'alerts@example.com', overwrite any existing value | Command:
```bash
kubectl annotate --overwrite pods vpn alert-email='alerts@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 a... |
Create a pod disruption budget named 'database-pdb' that will select all pods with the 'version=v2' label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget database-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 [--dry... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/password-secret deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod t... |
import the environment variables from the 'encryption-key-secret' secret to the 'backend-microservice-deployment' deployment | Command:
```bash
kubectl set env --from=secret/encryption-key-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 i... |
Update the image of all containers in the namespace-3 daemonset to 'golang:1.17'. | Command:
```bash
kubectl set image daemonset namespace-3 *=golang:1.17
```
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:
`... |
List deployments in YAML output format for the "feature-branch-2.3.0" version of the "experimental-apps" API group. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.experimental-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type i... |
List the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/media-stream-rc pods/e-commerce-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 namesp... |
Create a role named "foo" with the verb "patch" and the resource "pods" with the resource name "file-uploader" | Command:
```bash
kubectl create role foo --verb=patch --resource=pods --resource-name=file-uploader --resource-name=file-uploader
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|clien... |
Start a hazelcast pod with specified overrides from a JSON file. | Command:
```bash
kubectl run nginx --image=hazelcast/hazelcast --overrides='{ "apiVersion": "rc-1.1.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] [--comm... |
Start a wordpress pod named "hazelcast" with the image "wordpress" and expose port 8084 | Command:
```bash
kubectl run hazelcast --image=wordpress --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": "... |
Forward the local port 8088 and IP 10.19.21.23 to port 5432 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 8088: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 criter... |
Forward traffic from port 8888 on all addresses to port 8081 in the pod named "mypod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8888:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Create a deployment named "grafana" running the "amazonlinux" image with 3 replicas. | Command:
```bash
kubectl create deployment grafana --image=amazonlinux --replicas=3
```
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. On... |
Create a cron job named 'data-processing' with the image 'mongo' that runs the command 'mongo --version' every minute. | Command:
```bash
kubectl create cronjob data-processing --image=mongo --schedule="*/1 * * * *" -- mongo --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short"... |
Set the environment variable DATABASE_URL in the deployment/user-management-deployment to the value from the config map named namespace-config | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/namespace-config 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 ... |
Listen on port 6379 locally and forward traffic to port 8000 in the security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 6379:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Listen on all addresses for incoming traffic on port 6379, and forward it to port 8081 in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 6379:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Execute the command 'node --version' in the container 'quantum-quark' from the pod 'cdn-service-pod' and display the output. | Command:
```bash
kubectl exec cdn-service-pod -c quantum-quark -- node --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Create a deployment named 'registry' with the 'mongo' image and 6 replicas. | Command:
```bash
kubectl create deployment registry --image=mongo --replicas=6
```
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 environment variable in the api-server-deployment deployment from the password-secret secret. | Command:
```bash
kubectl set env --from=secret/password-secret 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 one or more po... |
Start streaming the logs of the rocket-ranger container in the database-pod pod | Command:
```bash
kubectl logs -f -c rocket-ranger database-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", "s... |
Create a new config map named app-name-config with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap app-name-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/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 c... |
Create an ingress named 'ingtls' with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="website.com/=svc:https,tls" \
--rule="website.com/path/subpath*=othersvc:5432"
```
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"... |
Listen on port 9090 on all addresses and forward traffic to port 8000 inside the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 9090: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 w... |
Create a role named "default_role" with the API Group "deployments.apps" specified, allowing the verbs "patch", "proxy", and "delete". | Command:
```bash
kubectl create role default_role --verb=patch,proxy,delete --resource=deployments.apps
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"... |
Create a new NodePort service named media-stream-nodeport mapping TCP port 3000 of the cluster to TCP port 6379 of the service. | Command:
```bash
kubectl create service nodeport media-stream-nodeport --tcp=3000: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", "default"... |
create a pod disruption budget with a specific selector and minimum availability requirement | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=app=rails --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 [--d... |
Copy the kube config file from your local machine to the /etc/kubernetes directory inside a remote pod in the kube-server/backend-pod-13 namespace. | Command:
```bash
kubectl cp ~/.config/kube kube-server/backend-pod-13:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Create a Pod Disruption Budget (PDB) named "payment-gateway-pdb" that selects all pods with the "release=1.0.0" label and ensures that at least one of them is always available. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-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-availabl... |
Forward traffic from port 3000 on all addresses to port 8888 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-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... |
Apply a taint to nodes with a specific label | Command:
```bash
kubectl taint node -l feature=feature-xyz disktype=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": "", "u... |
Listen on all IP addresses on port 8088, and forward incoming traffic to port 8080 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 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 will ... |
Create an ingress called 'api-v2-ingress' that directs requests to testing.com/module to svc1:5432, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v2-ingress --rule="testing.com/module=svc1:5432,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... |
Forward traffic from local port 9090 to port 8081 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 9090: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 au... |
Create a new ClusterIP service named catalog-service-clusterip with TCP port mapping from local port 5001 to target port 8089 | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=5001:8089
```
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"... |
Port forward local ports 8080 and 6000 to corresponding ports in the specified pod "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 8080 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 autom... |
Forward local ports to a pod | Command:
```bash
kubectl port-forward pod/analytics-pod 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 auto... |
Retrieve the output from the 'quantum-quark' container in the 'security-service-pod' pod. | Command:
```bash
kubectl attach security-service-pod -c quantum-quark
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Update the pod 'auth' by removing the annotation named 'description' if it exists. | Command:
```bash
kubectl annotate pods auth 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 val... |
Partially update the storage-node-13 node by applying the specified YAML patch | Command:
```bash
kubectl patch node storage-node-13 -p $'spec:\n containers:\n- name: container-name\n resources:\n limits:\n cpu: 200m'
```
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 (... |
Execute the 'kafka-server-start /etc/kafka/server.properties' command in the 'time-machine' container of the 'cdn-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec cdn-service-pod -c time-machine -- kafka-server-start /etc/kafka/server.properties
```
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": "",... |
Configure autoscaling for the 'cdn' replication controller with a target CPU utilization of 90% and a maximum of 8 pods. | Command:
```bash
kubectl autoscale rc cdn --max=8 --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... |
Create a pod disruption budget named batch-processing-pdb that will select all pods with the release=1.0.0 label and require a minimum availability of four pods at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=release=1.0.0 --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-availab... |
Add a taint with key 'app' on nodes having label environment=production. | Command:
```bash
kubectl taint node -l environment=production app=kube-master-9: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... |
Execute the command 'apache2ctl -D FOREGROUND' within the container named 'code-explorer' running in the 'auth-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec auth-service-pod -c code-explorer -- apache2ctl -D FOREGROUND
```
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 ... |
Copy a file from a remote pod to your local system | Command:
```bash
kubectl cp logging/cache-pod-5:/tmp/foo /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.kubern... |
Set the cluster field in the my-context context to cluster-beta in the client-1-context. | Command:
```bash
kubectl config set contexts.client-1-context.cluster cluster-beta
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you... |
Create a deployment named "ingress" that uses the "centos" image with 5 replicas. | Command:
```bash
kubectl create deployment ingress --image=centos --replicas=5
```
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:... |
Start a mongo pod and expose port 8082 | Command:
```bash
kubectl run hazelcast --image=mongo --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": "--fi... |
List the deployments in the "third-party-apps" API group with the version "custom-version" in JSON output format. | Command:
```bash
kubectl get deployments.custom-version.third-party-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is names... |
Execute the 'mysql' command in the 'time-machine' container of the 'web-app-pod' pod and retrieve the output. | Command:
```bash
kubectl exec web-app-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 the... |
Forward local port 3000 to port 8000 in the pod/analytics-pod, enabling you to access the analytics service locally | Command:
```bash
kubectl port-forward pod/analytics-pod 3000:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Create a job with the name 'image-build-job' using the 'node' image and execute the command 'node --version' | Command:
```bash
kubectl create job image-build-job --image=node -- node --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 for... |
import the "DATABASE_URL" key from the "app-settings" config map to the "cache-cluster-deployment" deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-settings 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 defini... |
Forward traffic from local port 3000 to port 9090 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 3000: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 wi... |
Forward traffic from port 8081 on all addresses to port 8088 in the frontend-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8081:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Create a pod disruption budget named ingress-controller-pdb that will select all pods with the role=worker label and require at least four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=role=worker --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-availab... |
Get the output from running the 'elasticsearch-plugin --list' command in the rocket-ranger container of the proxy-server-pod pod. | Command:
```bash
kubectl exec proxy-server-pod -c rocket-ranger -- 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": "Contain... |
Create a new config map named 'monitoring-config' using the specified keys instead of file basenames | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When c... |
Get the output from running the 'geth version' command in the nano-bot container of the frontend-pod pod. | Command:
```bash
kubectl exec frontend-pod -c nano-bot -- 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... |
Scale the deployment named "backend-service-replicaset" to 7 replicas if its current size is 1. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=7 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... |
Get the output from the 'wp' command running in the monitoring-pod pod using the first container. | Command:
```bash
kubectl exec monitoring-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.kuberne... |
Forward local port 3000 to port 6379 in the 'log-aggregator-pod' pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 3000:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Forward traffic from local ports 9090 and 6000 to ports 8080 and 6000 in a pod selected by the 'database-deployment' deployment | Command:
```bash
kubectl port-forward deployment/database-deployment 9090 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 ... |
Start the mcr.microsoft.com/dotnet/core/runtime pod with custom arguments | Command:
```bash
kubectl run nginx --image=mcr.microsoft.com/dotnet/core/runtime -- <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] -- [COMMA... |
Set the resource request and limits for all containers in the 'nginx' deployment | Command:
```bash
kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,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 requeste... |
Create a service for a replicated nginx using replica set, which serves on port 5000 and connects to the containers on port 8443. | Command:
```bash
kubectl expose rs nginx --port=5000 --target-port=844300
```
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 service for the replicated 'alpine' resource, which will serve on port 3001 and connect to the containers on port 9092. | Command:
```bash
kubectl expose rc alpine --port=3001 --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 specified port.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.