prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new ExternalName service named 'my-ns' with the external name 'test-site.org' | Command:
```bash
kubectl create service externalname my-ns --external-name test-site.org
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference services that exist off p... |
Add a taint with key 'datacenter' on nodes having label service=auth | Command:
```bash
kubectl taint node -l service=auth datacenter=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": "O... |
import specific keys from a config map | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/db-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Apply the configuration in the 'docker-registry.yaml' file to a pod | Command:
```bash
kubectl apply -f ./docker-registry.yaml
```
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 'create --save-co... |
Set up an autoscaling policy for the deployment "frontend" | Command:
```bash
kubectl autoscale deployment frontend --min=1 --max=9
```
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... |
Set the service account of the deployment "mydeployment" to "istio" | Command:
```bash
kubectl set serviceaccount deployment mydeployment istio
```
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:
`kubectl set servic... |
Create a new secret named aws-credentials-secret with specific keys instead of names on disk. | Command:
```bash
kubectl create secret generic aws-credentials-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
```
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... |
Get the deployments in YAML output format from the "v1.1.0" version of the "alpha-apps" API group | Command:
```bash
kubectl get deployments.v1.1.0.alpha-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... |
Forward traffic from port 9090 on all addresses to port 8088 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 9090:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wi... |
Return the snapshot of previous terminated 'stardust-shuttle' container logs from the 'chat-app-pod' pod. | Command:
```bash
kubectl logs -p -c stardust-shuttle chat-app-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",... |
Create an ingress called 'website-ingress' that directs requests to foo.com/bar to svc1:8084 with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress website-ingress --rule="foo.com/bar=svc1:8084,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-settings 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 de... |
Create a role named "default_role" with the verb "proxy" and the resource "pods" with the resource names "web-frontend" and "search-elasticsearch" | Command:
```bash
kubectl create role default_role --verb=proxy --resource=pods --resource-name=web-frontend --resource-name=search-elasticsearch
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-r... |
Forward traffic from port 8000 on all addresses to port 8888 in the backend-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8000:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
View the previous terminated logs of the cyber-sleuth container from the email-service-pod. | Command:
```bash
kubectl logs -p -c cyber-sleuth email-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"... |
Set up port forwarding to forward local port 5432 to port 5000 inside the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 5432:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Partially update the k8s-node-1 node using a strategic merge patch specified as a JSON | Command:
```bash
kubectl patch node k8s-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 fl... |
Set the custom TLS server name as "cloud-cluster" for the "sun-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster sun-cluster --tls-server-name=cloud-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate... |
Import specific keys from a config map into an environment variable | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-config-dev 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 variabl... |
Display the resource utilization metrics for the pods with the label feature=feature-xyz | Command:
```bash
kubectl top pod -l feature=feature-xyz
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl top pod [NA... |
Update the label of a pod named 'foo' to set the value of 'tier' to 'database' | Command:
```bash
kubectl label pods foo tier=database
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If ... |
Update the pod 'security' by adding or updating the annotation 'alert-email' with the value 'alerts@example.com' | Command:
```bash
kubectl annotate --overwrite pods security 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 lab... |
Copy a file named "foo" from the pod "front-end-pod-12" in the "prometheus" namespace to your local machine's "/tmp/bar" directory. | Command:
```bash
kubectl cp prometheus/front-end-pod-12:/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... |
Update the image of all the containers in the daemonset named nginx to 'postgres:13.4' | Command:
```bash
kubectl set image daemonset nginx *=postgres:13.4
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kube... |
Copy the file '~/.config/kube' from the remote pod 'ingress-controller-pod-8' in the namespace 'kube-server' to the local directory '/tmp/bar'. | Command:
```bash
kubectl cp kube-server/ingress-controller-pod-8:~/.config/kube /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,... |
Forward local port 5432 to port 5000 in the pod selected by the deployment | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 5432 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a po... |
Update the pod 'gateway' by setting the annotation 'team' to 'frontend-team', replacing any existing value for the annotation. | Command:
```bash
kubectl annotate --overwrite pods gateway 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 inclu... |
Create a copy of the cdn-service-pod with a debug container and change the container images | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=my-custom-dbg --image=debian --set-image=scheduler=my-scheduler:1.0,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified b... |
Start port forwarding from port 8081 on all addresses to port 8080 in the log-aggregator-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 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 po... |
Set new execution authorization plugin arguments for the "app-operator" entry | Command:
```bash
kubectl config set-credentials app-operator --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 tok... |
Create an ingress called 'external-ingress' with a rule that directs requests from foo.com/input to svc1:7000 | Command:
```bash
kubectl create ingress external-ingress --rule="foo.com/input=svc1:7000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Get the output from running the 'irb' command in the astro-container of the frontend-pod | Command:
```bash
kubectl exec frontend-pod -c astro-container -- irb
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Create a debug container and change container images in the 'monitoring-pod' pod | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=my-custom-dbg --image=debian --set-image=mailer=mailer:latest,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by... |
Create a new NodePort service named cdn-service-nodeport | Command:
```bash
kubectl create service nodeport cdn-service-nodeport --tcp=8181:8082
```
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":... |
Set the service account of the deployment "database-deployment" to "flux" | Command:
```bash
kubectl set serviceaccount deployment database-deployment flux
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kubectl set ... |
Forward traffic from port 3000 on localhost and the IP address 10.19.21.23 to port 5000 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 3000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Forward local port 9090 to pod port 9090 | Command:
```bash
kubectl port-forward pod/e-commerce-pod 9090:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Update environment variable of a deployment | Command:
```bash
kubectl set env deployment/frontend-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 pod templat... |
Delete the context for the "cluster-1-context" cluster | Command:
```bash
kubectl config delete-context cluster-1-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
Get the documentation for the 'volumes' field under the 'spec' field of the 'services' resource | Command:
```bash
kubectl explain resource=services.spec.volumes
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag to ... |
Create a cron job named 'cron-task' using the 'confluentinc/cp-kafka' image and schedule it to run every minute | Command:
```bash
kubectl create cronjob cron-task --image=confluentinc/cp-kafka --schedule="*/1 * * * *" -- kafka-topics --list
```
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": "--ou... |
import the 'api_key' key from the 'app-secrets' config map and set it as an environment variable in the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-secrets 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 defin... |
Create a config map named app-config-dev with specified keys and file paths | Command:
```bash
kubectl create configmap app-config-dev --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating ... |
Import the 'SECRET_KEY' key from the 'app-name-config' ConfigMap and set it as an environment variable for the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-name-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 defi... |
Import the EXTERNAL_API_URL key from the 'app-config-dev' config map into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-config-dev 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 vari... |
Apply a taint on nodes labeled with 'customer=acme-corp' with the key 'hardware' and value 'monitoring-node-15' with the effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l customer=acme-corp hardware=monitoring-node-15: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": ""... |
Create a new ClusterIP service named auth-service-clusterip, and map the TCP port 3000 to port 8083 | Command:
```bash
kubectl create service clusterip auth-service-clusterip --tcp=3000:8083
```
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", "... |
Listen on port 8888 locally, forwarding to port 8081 in the pod named 'log-aggregator-pod' | Command:
```bash
kubectl port-forward pod/log-aggregator-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 criteria, a pod will be selected... |
Update the annotation of the pod 'chat-app' with the key 'custom-label' and value 'my-custom-value' | Command:
```bash
kubectl annotate pods chat-app custom-label=my-custom-value
```
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 ... |
Create a pod disruption budget that selects frontend pods and requires a minimum of four of them to be available at any time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=tier=frontend --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=... |
Update the label of the pod named 'api' to have the label 'role' with the value 'cache' | Command:
```bash
kubectl label pods api role=cache
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If tru... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/ui-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Create a new config map named kube-system-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap kube-system-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/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 crea... |
Update the pod 'cdn' with the label 'component' and the value 'web' | Command:
```bash
kubectl label pods cdn component=web
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If ... |
delete pods and services named "database" and "auth" | Command:
```bash
kubectl delete pod,service database auth
```
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.
S... |
Begin streaming the logs of the time-machine container in the vpn-service-pod pod | Command:
```bash
kubectl logs -f -c time-machine 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", ... |
Create an ingress named "ingress1" with multiple hosts and the pathType set as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:8010" \
--rule="module.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": "--outpu... |
Forward all incoming traffic on port 5432 to port 5432 in the web-app-pod. Make sure to listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-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 ... |
Create a new config map named app-config-dev using specified keys instead of file basenames from the provided paths. | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/configs/file1.txt --from-file=key1=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Get the output of the 'dotnet --list-sdks' command from the 'analytics-pod' pod. | Command:
```bash
kubectl exec analytics-pod -- dotnet --list-sdks
```
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 ... |
Taint nodes with label 'version=v1.0.0' with a taint key 'cpu-type' and value 'node-1:PreferNoSchedule' | Command:
```bash
kubectl taint node -l version=v1.0.0 cpu-type=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Create a new configmap named "app-settings" by specifying the keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-settings --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 confi... |
forward local traffic to port 8081 in the cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod :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 automa... |
Open a raw terminal connection to the "time-machine" container in the "e-commerce-pod" pod to send stdin to the "bash" shell and receive stdout/stderr back from the shell. | Command:
```bash
kubectl attach e-commerce-pod -c time-machine -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 omi... |
Set the CPU and memory limits and requests for all containers in the 'php' deployment | Command:
```bash
kubectl set resources deployment php --limits=cpu=200m,memory=512Mi --requests=cpu=1,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 requested, ... |
Remove the environment variable ENV from the cosmic-container container in all deployment configs | Command:
```bash
kubectl set env deployments --all --containers="cosmic-container" ENV-
```
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 templa... |
Create a job named "certificate-renewal" using the "ubuntu" image and run the command "docker run -it ubuntu". | Command:
```bash
kubectl create job certificate-renewal --image=ubuntu -- docker run -it ubuntu
```
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"... |
Taint nodes with the key 'app' and value 'node-1:PreferNoSchedule' if they have the label 'role=database' | Command:
```bash
kubectl taint node -l role=database app=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output for... |
Create a copy of the cdn-service-pod called debug-image-app, changing all container images to hazelcast/hazelcast | Command:
```bash
kubectl debug cdn-service-pod --copy-to=debug-image-app --set-image=*=hazelcast/hazelcast
```
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... |
Execute the command "pg_dump --version" in the "rocket-ranger" container of the "payment-gateway-pod" pod to get its output. | Command:
```bash
kubectl exec payment-gateway-pod -c rocket-ranger -- pg_dump --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... |
Auto scale the replication controller "email" with a maximum of 8 pods and a target CPU utilization of 60%. | Command:
```bash
kubectl autoscale rc email --max=8 --cpu-percent=60
```
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 t... |
Create a Pod Disruption Budget named 'notification-service-pdb' that will select all pods with the 'app=rails' label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget notification-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-availab... |
Create a job with a command where the image is centos and the job will sleep for 3600 seconds. | Command:
```bash
kubectl create job audit-job --image=centos -- sleep 3600
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One... |
Update the pod named 'backend' with the label 'role' and the value 'backend' | Command:
```bash
kubectl label pods backend role=backend
```
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": "... |
Set the custom TLS server name to "web-cluster" for the "on-prem-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=web-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifica... |
Create a copy of the e-commerce pod with a debug container and changed container images | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=my-debugger --image=debian --set-image=mailer=mailer:latest,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resourc... |
Forward port 3000 in a pod to port 9090 locally | Command:
```bash
kubectl port-forward pod/web-app-pod 9090: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 automa... |
List the deployments in the "alpha-2.0" version of the "testing-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.alpha-2.0.testing-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... |
Set the CPU and memory limits for the PostgreSQL container in a deployment. | Command:
```bash
kubectl set resources deployment postgres -c=nginx --limits=cpu=5,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 requested, but may burst up to i... |
Create an ingress called 'public-ingress' with a rule that directs requests from site.com/example to the service svc1 running on port 8181 | Command:
```bash
kubectl create ingress public-ingress --rule="site.com/example=svc1:8181,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Create a new config map named 'db-config' using the 'settings' key from the '/path/to/properties/file1.txt' file and the 'key2' key from the '/path/to/preferences/file2.txt' file. | Command:
```bash
kubectl create configmap db-config --from-file=settings=/path/to/properties/file1.txt --from-file=key2=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
Create a debug pod named "debug-image-app" that is a copy of "cdn-service-pod" but with all container images changed to "centos" | Command:
```bash
kubectl debug cdn-service-pod --copy-to=debug-image-app --set-image=*=centos
```
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 ... |
Create an ingress named 'app2-ingress' that routes requests from 'website.com/example' to 'svc1:8088' with the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress app2-ingress --rule="website.com/example=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": "", "usa... |
Create a config map named app-config-dev from an environment file | Command:
```bash
kubectl create configmap app-config-dev --from-env-file=path/to/configurations.env
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default... |
Auto scale the "web" deployment with a minimum of 6 pods and a maximum of 11 pods | Command:
```bash
kubectl autoscale deployment web --min=6 --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... |
Apply a taint with the key 'zone' and value 'web-node-8:PreferNoSchedule' to all nodes that have the label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack zone=web-node-8: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 new config map named app-secrets using the specified keys and their corresponding file paths | Command:
```bash
kubectl create configmap app-secrets --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 confi... |
Update the pod in "config.json" by adding an annotation for the team as 'frontend team' | Command:
```bash
kubectl annotate -f config.json 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 arbitra... |
Forward the traffic from port 9090 on localhost and IP address 10.19.21.23 to port 8080 on the 'backend-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 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 criteri... |
Update the image of all containers in the 'namespace-2' daemonset to 'node:14.17.3' | Command:
```bash
kubectl set image daemonset namespace-2 *=node:14.17.3
```
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:
... |
Make node "node-2" available for scheduling | Command:
```bash
kubectl uncordon node-2
```
What it does:
Mark node as schedulable.
Syntax:
`kubectl uncordon NODE`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selector (label query) to filter on " |
Get the output from running the 'sleep 3600' command in the cosmic-container from the pod named database-pod | Command:
```bash
kubectl exec database-pod -c cosmic-container -- sleep 3600
```
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 omitte... |
Add a taint with key 'datacenter' on nodes having label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha datacenter=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": "... |
Update the image of all containers in the daemonset 'development' to 'openjdk:16.0.2' | Command:
```bash
kubectl set image daemonset development *=openjdk:16.0.2
```
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... |
Attach to the 'warp-drive' container within the 'media-stream-pod' pod and get the output. | Command:
```bash
kubectl attach media-stream-pod -c warp-drive
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Create a new secret named 'ssh-key-secret' with keys for each file in the 'bar' folder | Command:
```bash
kubectl create secret generic ssh-key-secret --from-file=path/to/data
```
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 basename of the f... |
Update the 'gateway' pod with the annotation 'security-scan-status' and set the value to 'pass', even if there is an existing value | Command:
```bash
kubectl annotate --overwrite pods gateway security-scan-status='pass'
```
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... |
Create a new secret named git-credentials-secret with keys for each file in the path/to/parameters folder | Command:
```bash
kubectl create secret generic git-credentials-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 local port 8000 to port 9090 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8000: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 a... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-config-prod 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 variabl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.