prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the 'debug_mode' key from the 'app-config-dev' config map and set it as an environment variable in the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/app-config-dev 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... |
Add a taint with the key 'special' and value 'app-node-6:PreferNoSchedule' on nodes that have the label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel special=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
Start streaming the logs of the "ruby" container in the "frontend-pod" pod | Command:
```bash
kubectl logs -f -c ruby frontend-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 frontend-service-clusterip with the TCP port mapping from 8083 to 9090 | Command:
```bash
kubectl create service clusterip frontend-service-clusterip --tcp=8083:9090
```
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... |
Setup autoscaling for the deployment "web", with the number of pods between 2 and 11 | Command:
```bash
kubectl autoscale deployment web --min=2 --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 uses the... |
Create a role named "custom_role" with the ResourceName specified as "audit-logger" and "cache-redis". | Command:
```bash
kubectl create role custom_role --verb=list --resource=pods --resource-name=audit-logger --resource-name=cache-redis
```
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|c... |
Update the environment variable 'SMTP_USERNAME' with your desired value for the deployment 'backend-microservice-deployment' | Command:
```bash
kubectl set env deployment/backend-microservice-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... |
List the specified resources by their respective types and names. | Command:
```bash
kubectl get rc/web service/auth-service-rc pods/media-stream-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is name... |
Set the "client-key" field for the "admin" entry in the Kubernetes configuration file, without modifying any other values | Command:
```bash
kubectl config set-credentials admin --client-key=~/.kube/admin.key
```
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 flags... |
Forward traffic from port 8080 on all addresses to port 8088 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8080: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 be sel... |
Listen on port 8888 on localhost and 10.19.21.23 IP address, and forward the traffic to port 8081 in the frontend-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 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 criter... |
Add a taint with key 'app' on nodes that have the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 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": "", "usage": "Ou... |
Set the last-applied-configuration of a resource to match the contents of a file, and create the annotation if it doesn't exist. | Command:
```bash
kubectl apply set-last-applied -f parameters.yaml --create-annotation=true
```
What it does:
Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run, without ... |
create an ingress with multiple hosts and pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:8000" \
--rule="bar.com/admin*=svc2:http"
```
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",... |
Set the last-applied-configuration of a resource to match the contents of the conf.yaml file, and create the annotation if it does not already exist. | Command:
```bash
kubectl apply set-last-applied -f conf.yaml --create-annotation=true
```
What it does:
Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run, without updati... |
Create an ingress resource called 'service-ingress' with a rule that directs requests for foo.com/bar to svc1:9092 | Command:
```bash
kubectl create ingress service-ingress --rule="foo.com/bar=svc1:9092,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": ... |
Import the 'config_file_path' key from the 'monitoring-config' config map into the 'notification-handler-deployment' deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/monitoring-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... |
Get the output from running the 'pip --version' command in the first container of the 'user-management-deployment' deployment. | Command:
```bash
kubectl exec deploy/user-management-deployment -- pip --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... |
Copy the file ~/.config/kube to the location /tmp/bar in the remote pod called "worker-pod-4" in the namespace "istio-system". | Command:
```bash
kubectl cp ~/.config/kube istio-system/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 ku... |
Create a copy of the cdn-service-pod, name it my-custom-dbg, and change all container images to confluentinc/cp-kafka | Command:
```bash
kubectl debug cdn-service-pod --copy-to=my-custom-dbg --set-image=*=confluentinc/cp-kafka
```
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 d... |
Print the supported namespaced resources | Command:
```bash
kubectl api-resources --versionspaced=true
```
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. " |
Retrieve the snapshot logs of the 'gateway-pod-1' container from the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c gateway-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fla... |
Add the label 'env' with the value 'production' to the pod named 'media-stream' | Command:
```bash
kubectl label pods media-stream 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", "us... |
Add an annotation to the 'vpn' pod with the key 'SLA' and the value '99.9% uptime'. | Command:
```bash
kubectl annotate pods vpn SLA='99.9% uptime'
```
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 strin... |
Get the output of running the command 'geth version' in the pod named api-service-pod using the container named nano-bot | Command:
```bash
kubectl exec api-service-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, ... |
Forward traffic from port 6379 on localhost and IP address 10.19.21.23 to port 8081 in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 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 cri... |
Embed the client certificate data in the "saas-admin" entry. | Command:
```bash
kubectl config set-credentials saas-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
```
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 --clien... |
Forward local port 5432 to port 9090 in the frontend-pod pod. | Command:
```bash
kubectl port-forward pod/frontend-pod 5432:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Add a taint with the key 'cpu-type' and the value 'storage-node-13:PreferNoSchedule' on all nodes that have the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 cpu-type=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Scale the 'dev-environment-rs' deployment to 3 replicas if its current size is also 3 for the mysql resource | Command:
```bash
kubectl scale --current-replicas=3 --replicas=3 deployment/dev-environment-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-... |
Delete the pods and services with the names "gateway" and "chat-app" | Command:
```bash
kubectl delete pod,service gateway chat-app
```
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... |
Retrieve the output of the 'npm --version' command from the 'code-explorer' container running in the 'api-service-pod' pod. | Command:
```bash
kubectl exec api-service-pod -c code-explorer -- npm --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Partially update the 'dev-node-4' node by setting a new password | Command:
```bash
kubectl patch node dev-node-4 -p $'stringData:\n password: new-password'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
... |
Update the pod named 'frontend' with the annotation 'compliance-level' and set its value to 'PCI-DSS', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods frontend compliance-level='PCI-DSS'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels an... |
Add a taint on nodes with a specific label | Command:
```bash
kubectl taint node -l myLabel special=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Create a golang pod named nginx with custom specifications provided in a JSON file. | Command:
```bash
kubectl run nginx --image=golang --overrides='{ "apiVersion": "custom-version", "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] --... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/db-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 defi... |
List the replication controller named 'web', the service named 'e-commerce-rc', and the pod named 'e-commerce-pod' | Command:
```bash
kubectl get rc/web service/e-commerce-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 namespac... |
List deployments from the "sandbox-apps" API group in JSON format, using the "v2.1.0" version. | Command:
```bash
kubectl get deployments.v2.1.0.sandbox-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 namespaced you wi... |
Create a new ClusterIP service named monitoring-service-clusterip, with the TCP port forwarding from local port 3000 to target port 3001. | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=3000:3001
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "... |
set the resource requests and limits for the containers in the postgres deployment | Command:
```bash
kubectl set resources deployment postgres --limits=cpu=200m,memory=512Mi --requests=cpu=1,memory=64Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource request... |
Update the deployment 'payment-processor-deployment' by setting a new environment variable S3_BUCKET with the value my-s3-bucket | Command:
```bash
kubectl set env deployment/payment-processor-deployment S3_BUCKET=my-s3-bucket
```
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 new config map named 'ui-config' with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=properties=/path/to/data/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 confi... |
Create an ingress named 'private-api-ingress' with a rule that directs requests from 'foo.com/module' to the service 'svc1' on port '8084' using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress private-api-ingress --rule="foo.com/module=svc1:8084,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Create a new ClusterIP service named 'api-service-clusterip' mapping port 5001 on the cluster to port 8888 on the service. | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=5001:8888
```
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... |
Copy the local file /tmp/foo to the remote pod named database-pod-2 in the container named task-processor, and place it at the path /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo database-pod-2::/tmp/bar -c task-processor
```
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 ... |
Set the resource request and limits for all containers in the ubuntu deployment | Command:
```bash
kubectl set resources deployment ubuntu --limits=cpu=200m,memory=512Mi --requests=cpu=100m,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 reque... |
Import environment variables from a config map with a specific prefix for a deployment. | Command:
```bash
kubectl set env --from=configmap/log-config --prefix=MYSQL_ 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 def... |
Copy the local file "/tmp/foo" to the remote pod "monitoring-agent-pod-6" in the "cert-manager" namespace, and save it as "/tmp/bar_dir". | Command:
```bash
kubectl cp /tmp/foo cert-manager/monitoring-agent-pod-6:/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, us... |
Create a service for the replicated alpine using replica set | Command:
```bash
kubectl expose rs alpine --port=5001 --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... |
Create a new config map named env-vars with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap env-vars --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/settings/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 confi... |
Roll back a daemonset to a specific revision | Command:
```bash
kubectl rollout undo daemonset/nginx --to-revision=1
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the r... |
Output the modified 'gateway-deployment' deployment in YAML format, without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/gateway-deployment MAX_CONNECTIONS=100 -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod tem... |
Update the image of a container in a pod | Command:
```bash
kubectl patch pod monitoring-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
```
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 FILEN... |
Set the resource request and limits for all containers in the mongo deployment | Command:
```bash
kubectl set resources deployment mongo --limits=cpu=200m,memory=512Mi --requests=cpu=5,memory=128Mi
```
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... |
Create an ingress with the name "ingress1" and set the class to "default" | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:8080" \
--rule="example.com/admin*=svc2:http"
```
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": "--outp... |
Create a cron job named "monthly-audit" with the provided image "mongo" and a schedule that runs every minute | Command:
```bash
kubectl create cronjob monthly-audit --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": ... |
Create a secret named docker-registry-secret with keys for each file in the specified folder | Command:
```bash
kubectl create secret generic docker-registry-secret --from-file=path/to/parameters
```
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... |
Forward ports 5000 and 8088 to a deployment named "analytics-platform-deployment" | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 5000 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a po... |
Scale the deployment named payment-service-rs to 7 replicas. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/payment-service-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-... |
Create a new config map named api-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
List deployments in YAML output format for the "v2.0.0" version of the "web-apps" API group. | Command:
```bash
kubectl get deployments.v2.0.0.web-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will o... |
Import specific keys from a config map into a deployment's environment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-config-dev 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 definitio... |
Update the description annotation of the pod that is defined in the "conf.json" configuration file | Command:
```bash
kubectl annotate -f conf.json description='Web server for marketing site'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than label... |
Partially update a node by specifying a strategic merge patch in YAML format | Command:
```bash
kubectl patch node prod-node-5 -p $'stringData:\n password: new-password'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
... |
Forward local port 8080 to port 3000 in the pod named security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-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 select... |
List deployments in YAML format in the specified API group and version | Command:
```bash
kubectl get deployments.hotfix-1.1.2.apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will... |
Execute the 'elasticsearch --version' command inside the 'time-machine' container of the 'log-aggregator-pod' pod | Command:
```bash
kubectl exec log-aggregator-pod -c time-machine -- elasticsearch --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 ... |
Create a new config map named global-config with the following keys and corresponding files: conf=/path/to/data/file1.txt and data=/path/to/parameters/file2.txt | Command:
```bash
kubectl create configmap global-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a conf... |
Import the specific key `config_file_path` from the `api-config` ConfigMap and set it as an environment variable in the `log-aggregator-deployment` deployment. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/api-config deployment/log-aggregator-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 def... |
Stream the logs of the time-machine container in the log-aggregator-pod pod | Command:
```bash
kubectl logs -f -c time-machine 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... |
Forward local port 5432 to port 8888 in the search-engine-deployment pod. | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 5432 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 wil... |
Add a taint with key 'app' on nodes having label environment=production and the node name being storage-node-13 with the taint effect of PreferNoSchedule | Command:
```bash
kubectl taint node -l environment=production app=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Auto scale the replication controller "analytics" with the following parameters: minimum of 1 pod, maximum of 4 pods, and target CPU utilization set at 50%. | Command:
```bash
kubectl autoscale rc analytics --max=4 --cpu-percent=50
```
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 us... |
Create a pod disruption budget with specific criteria | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=region=us-east --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... |
Delete the pods and services with the names "analytics" and "email" | Command:
```bash
kubectl delete pod,service analytics email
```
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.... |
Listen on a random port locally, forwarding to port 8080 in the 'analytics-pod' pod | Command:
```bash
kubectl port-forward pod/analytics-pod :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 automati... |
Create a cluster role binding for admin, devops-user, and operations-team using the bar cluster role | Command:
```bash
kubectl create clusterrolebinding bar --clusterrole=bar --user=admin --user=devops-user --group=operations-team
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--se... |
Update the CPU limit to "500m" and memory limit to "4Gi" for the 'ruby' deployment's 'nginx' container. | Command:
```bash
kubectl set resources deployment ruby -c=nginx --limits=cpu=500m,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, but may burst up to it... |
Get the output from running the 'redis-cli' command inside the first container of the first pod belonging to the 'frontend-service' service. | Command:
```bash
kubectl exec svc/frontend-service -- 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, use the ku... |
Rename the context 'on-prem-context' to 'admin-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context on-prem-context admin-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will als... |
Create a job named 'scaling-job' using the 'postgres' image, and run the 'psql' command inside the container | Command:
```bash
kubectl create job scaling-job --image=postgres -- psql
```
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 o... |
Open and edit a service using the Nano editor | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/web-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or... |
autoscale the replication controller "payment" with a target CPU utilization of 50%, allowing for a maximum of 7 pods | Command:
```bash
kubectl autoscale rc payment --max=7 --cpu-percent=50
```
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... |
Create a cluster role named "view" with the ability to create pods and specify two specific resource names: "app-worker-1" and "payment-processor" | Command:
```bash
kubectl create clusterrole view --verb=create --resource=pods --resource-name=app-worker-1 --resource-name=payment-processor
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|... |
Forward local port 8080 to the targetPort of the "https" port in the pod selected by the "gateway-service" service. | Command:
```bash
kubectl port-forward service/gateway-service 8080:https
```
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 port 8088 on all addresses and forward the traffic to port 9090 in the pod named 'security-service-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8088: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 ... |
Partially update the node 'node-1' by applying the specified JSON patch to it. | Command:
```bash
kubectl patch node node-1 -p '{"data":{"key":"new-value"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful flags:... |
Create a debug container in a pod, copy it to a new pod named "debug-image-api", and change the container images for the "worker" and "web" containers. | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=debug-image-api --image=debian --set-image=worker=my-custom-worker:1.2.3,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified... |
Forward local port 8081 to the targetPort of the "https" port in the monitoring-service service, which is selecting a pod. | Command:
```bash
kubectl port-forward service/monitoring-service 8081:https
```
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... |
Set the CPU limits of a Python container in a deployment to "200m" and the memory limits to "512Mi" | Command:
```bash
kubectl set resources deployment python -c=nginx --limits=cpu=200m,memory=512Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up t... |
Add a taint with key 'workload' on nodes having label role=database | Command:
```bash
kubectl taint node -l role=database workload=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": "Ou... |
Create a job named "backup" using the CentOS image and execute the command "yum install -y wget". | Command:
```bash
kubectl create job backup --image=centos -- yum install -y wget
```
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 forma... |
Create a copy of the email-service-pod and change all container images to mcr.microsoft.com/dotnet/core/runtime with the name debug-image-api. | Command:
```bash
kubectl debug email-service-pod --copy-to=debug-image-api --set-image=*=mcr.microsoft.com/dotnet/core/runtime
```
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. Po... |
Create a copy of the cdn-service-pod, adding a debug container and changing the container images | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=my-debugger --image=debian --set-image=scheduler=my-scheduler:1.0,proxy=nginx:1.21
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by reso... |
Forward local ports to pod ports | Command:
```bash
kubectl port-forward pod/backend-pod 5432 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 automa... |
Update the deployment 'proxy-service-deployment' by setting the environment variable SECRET_KEY to 'your-secret-key' | Command:
```bash
kubectl set env deployment/proxy-service-deployment SECRET_KEY=your-secret-key
```
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... |
Show the logs from the pod "api-service-pod" that were written in the last hour | Command:
```bash
kubectl logs --since=1h api-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":... |
Execute the 'wp' command inside the first container of the first pod of the 'scheduler-service' service, and print the output. | Command:
```bash
kubectl exec svc/scheduler-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.... |
Check if you have permission to list the job named "log-rotation-job" in the "namespace-1" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/log-rotation-job -n namespace-1
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial U... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.