prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Update the taint on a node to prefer no scheduling for a specific app | Command:
```bash
kubectl taint nodes monitoring-node-15 app=backend: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 ... |
Start port forwarding to access a pod locally | Command:
```bash
kubectl port-forward pod/frontend-pod 6379 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create a debug container in the frontend-pod by copying its configuration and changing the container images. | Command:
```bash
kubectl debug frontend-pod -it --copy-to=dgb-img --image=debian --set-image=mailer=mailer:latest,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource ... |
Create a pod named 'hazelcast' using the 'hazelcast/hazelcast' image and have the container within the pod expose port 9000. | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=9000
```
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:... |
Create a single ingress called 'public-api-ingress' that directs requests to site.com/example to svc1:9092 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress public-api-ingress --rule="site.com/example=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": "", "... |
Create a new config map named `namespace-config` with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap namespace-config --from-file=settings=/path/to/parameters/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... |
Create a deployment named wordpress with 6 replicas | Command:
```bash
kubectl create deployment wordpress --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... |
Update the pod named 'cdn' with the annotation 'contact-email' and the value 'support@example.com', ensuring that any existing value is overwritten. | Command:
```bash
kubectl annotate --overwrite pods cdn contact-email='support@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 label... |
Create a debug version of the api-service-pod by adding a debug container and changing the container images | Command:
```bash
kubectl debug api-service-pod -it --copy-to=debug-image-app --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 re... |
Retrieve the output of the 'dotnet --list-sdks' command from within the quantum-quark container in the proxy-server-pod pod. | Command:
```bash
kubectl exec proxy-server-pod -c quantum-quark -- 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. ... |
Get output from the nano-bot container in the auth-service-pod | Command:
```bash
kubectl attach auth-service-pod -c nano-bot
```
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, us... |
Create a new config map named "env-vars" by specifying key-value pairs from files on disk | Command:
```bash
kubectl create configmap env-vars --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/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 config ... |
Copy a file from the local system to a remote pod in a specified namespace | Command:
```bash
kubectl cp :/tmp/foo kube-dns/web-app-pod-1:/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.ku... |
Create a new ClusterIP service named 'order-service-clusterip' with port mapping from local port 9090 to target port 8888. | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=9090: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", ... |
create a pod using a JSON file provided through stdin | Command:
```bash
cat preferences.json | kubectl create -f -
```
What it does:
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
Syntax:
`kubectl create -f FILENAME`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files to us... |
Create a service for the replicated 'php' resource, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rc php --port=8181 --target-port=543200
```
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 an ingress called 'website-ingress' that directs requests to 'site.com/example' to the service 'svc1:27017' with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="site.com/example=svc1:27017,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... |
Attach to the first pod of the replica set named "hazelcast" and get its output | Command:
```bash
kubectl attach rs/hazelcast
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.ku... |
Set the resource requests and limits for all containers in the 'mongo' deployment to allocate CPU and memory resources. | Command:
```bash
kubectl set resources deployment mongo --limits=cpu=200m,memory=512Mi --requests=cpu=10,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 requeste... |
Update the annotation 'scaling-policy' of pod 'cdn' with the value 'auto-horizontal-scaling' | Command:
```bash
kubectl annotate --overwrite pods cdn scaling-policy='auto-horizontal-scaling'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than ... |
update the 'user-management-deployment' deployment by setting the environment variable 'GOOGLE_API_KEY' with your Google API key | Command:
```bash
kubectl set env deployment/user-management-deployment GOOGLE_API_KEY=your-google-api-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 ... |
Add a taint with the key 'hardware' on nodes having the label namespace=mynamespace | Command:
```bash
kubectl taint node -l namespace=mynamespace hardware=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": "", "us... |
list the deployments in the "apps" API group with the version "stable-2.0.0" in JSON format | Command:
```bash
kubectl get deployments.stable-2.0.0.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 will... |
Execute the 'gem --version' command in the web-app-pod and display the output. | Command:
```bash
kubectl exec web-app-pod -- gem --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl... |
Update the image of the container named "kubernetes-serve-hostname" in the proxy-service-pod pod with the new image | Command:
```bash
kubectl patch pod proxy-service-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 FI... |
Create a pod disruption budget that selects pods with the "env=production" label, and requires at least 9 of them to be available at any point in time | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=env=production --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--... |
List the deployments in the "dev-2.2.0" version of the "api-v1" API group in YAML output format. | Command:
```bash
kubectl get deployments.dev-2.2.0.api-v1 -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 ... |
Apply a taint with the key 'workload' on the nodes that have the label owner=john-doe | Command:
```bash
kubectl taint node -l owner=john-doe workload=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Delete both the pod and service with the name "security", as well as the pod and service with the name "auth" | Command:
```bash
kubectl delete pod,service security 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... |
Create an ingress resource named 'default-ingress' with a rule that directs requests from website.com/bar to svc1:9092 | Command:
```bash
kubectl create ingress default-ingress --rule="website.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": "", "usag... |
Create a new config map named 'api-config' with the keys 'conf' and 'data' using the files '/path/to/data/file1.txt' and '/path/to/data/file2.txt' as the values. | Command:
```bash
kubectl create configmap api-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/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 config map ba... |
Create a deployment named gitlab using the postgres image and expose port 8088 | Command:
```bash
kubectl create deployment gitlab --image=postgres --port=8088
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Configure the Google Compute Platform auth provider for the "operator" entry. | Command:
```bash
kubectl config set-credentials operator --auth-provider=gcp
```
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:
--to... |
Create a job named 'batch-processing' with a centos image to execute the 'sleep 3600' command. | Command:
```bash
kubectl create job batch-processing --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 form... |
Execute the 'mysql' command within the pod named 'proxy-service-pod' and retrieve the output | Command:
```bash
kubectl exec proxy-service-pod -- 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 kubectl.k... |
Execute the command 'go run hello.go' inside the 'rocket-ranger' container of the 'auth-service-pod' pod. | Command:
```bash
kubectl exec auth-service-pod -c rocket-ranger -- go run hello.go
```
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 ... |
Forward traffic from port 6379 on all addresses to port 8888 in the 'cdn-service-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 6379: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... |
Add a taint with key 'dedicated' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 dedicated=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Import the smtp_server key from the monitoring-config ConfigMap to the mydeployment deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/monitoring-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in... |
Start a hazelcast pod and expose port 8081 on the container | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=8081
```
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:... |
Create a debug copy of a pod and modify container images | Command:
```bash
kubectl debug frontend-pod -it --copy-to=my-debugger --image=debian --set-image=worker=my-custom-worker:1.2.3,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects ident... |
Display the last 12 lines of logs for a pod | Command:
```bash
kubectl logs --tail=12 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": "-c... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/cdn-service-rc pods/frontend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespace... |
Embed the certificate authority data for the "cloud-cluster" cluster entry | Command:
```bash
kubectl config set-cluster cloud-cluster --embed-certs --certificate-authority=~/.kube/sun-cluster/kubernetes.ca.crt
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/app-config-dev deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or... |
Create a new config map named namespace-config with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap namespace-config --from-file=conf=/path/to/configs/file1.txt --from-file=data=/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 c... |
Forward local port 6379 to port 8080 in the 'analytics-pod' and start listening on ports 6379 and 6000 locally, forwarding data to/from ports 8080 and 6000 in the pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 6379 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Create a new config map named monitoring-config using the files file1.txt and file2.txt as the values for the keys conf and data respectively. | Command:
```bash
kubectl create configmap monitoring-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/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.
Wh... |
Execute the command 'redis-server --version' inside the 'warp-drive' container of the 'monitoring-pod' and get the output | Command:
```bash
kubectl exec monitoring-pod -c warp-drive -- redis-server --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. I... |
Update the user field on the testing-context context entry to "cluster-admin" without modifying any other values. | Command:
```bash
kubectl config set-context testing-context --user=cluster-admin
```
What it does:
Set a context 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-context [NAME | --current] [--cluster=cluster_nickna... |
Get the output from running the 'irb' command in the cosmic-container from the cdn-service-pod | Command:
```bash
kubectl exec cdn-service-pod -c cosmic-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, u... |
Create a new ClusterIP service named 'frontend-service-clusterip' that forwards TCP traffic from port 9092 to port 5000. | Command:
```bash
kubectl create service clusterip frontend-service-clusterip --tcp=9092:5000
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o... |
Start a Jenkins pod and expose port 8000 | Command:
```bash
kubectl run hazelcast --image=jenkins --port=8000
```
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": "--... |
Create a new ClusterIP service named backend-service-clusterip that forwards traffic from port 8088 to port 3001 | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=8088: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": "-o"... |
Create a copy of a pod named log-aggregator-pod and change all container images to use the node image | Command:
```bash
kubectl debug log-aggregator-pod --copy-to=debug-image-1 --set-image=*=node
```
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 r... |
Switch to the context of the galaxy-cluster cluster | Command:
```bash
kubectl config use-context galaxy-cluster
```
What it does:
Set the current-context in a kubeconfig file.
Syntax:
`kubectl config use-context CONTEXT_NAME` |
Start a postgres pod named nginx using the postgres image, and override the spec with a partial set of values parsed from a JSON file or string | Command:
```bash
kubectl run nginx --image=postgres --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] ... |
Set the cluster field in the dev-context context to sun-cluster | Command:
```bash
kubectl config set contexts.dev-context.cluster sun-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you want ... |
Forward traffic from port 8000 on localhost and IP address 10.19.21.23 to port 5000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 8000: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 crite... |
Add the annotation "SLA='99.9% uptime'" to the pod specified by the type and name in the "settings.json" file. | Command:
```bash
kubectl annotate -f settings.json 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 arbitra... |
Create a new ExternalName service named external-dns-service and provide the external name as "education-edu.edu" | Command:
```bash
kubectl create service externalname external-dns-service --external-name education-edu.edu
```
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 servic... |
Create a job named "audit-job" with the "postgres" image. The job should run the "postgres" command. | Command:
```bash
kubectl create job audit-job --image=postgres -- postgres
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One... |
Create a config map named app-config with specified keys from files located at /path/to/settings/file1.txt and /path/to/configurations/file2.txt | Command:
```bash
kubectl create configmap app-config --from-file=conf=/path/to/settings/file1.txt --from-file=data=/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 creating a... |
Forward port 5000 locally to port 8080 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Create a service for a replication controller specified in a YAML file, exposing it on port 3001 and connecting to the containers on port 543200 | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=3001 --target-port=543200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Forward local port 8888 to pod port 8080 | Command:
```bash
kubectl port-forward pod/frontend-pod 8888:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Set the monitoring tool to Prometheus for the pod specified in "preferences.json" | Command:
```bash
kubectl annotate -f preferences.json monitoring-tool=Prometheus
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and incl... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-name-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Create an ingress resource called 'app2-ingress' that directs requests to the URL 'website.com/example' to the service 'svc1' on port 5001 | Command:
```bash
kubectl create ingress app2-ingress --rule="website.com/example=svc1:5001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Listen on port 8080 on localhost and IP 10.19.21.23, and forward the traffic to port 8081 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 8080: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... |
Execute the 'kafka-console-producer' command inside the 'analytics-pod' and provide input for producing messages to the 'test' topic in Kafka | Command:
```bash
kubectl exec analytics-pod -- kafka-console-producer --broker-list localhost:9092 --topic test
```
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": "", ... |
Update the 'email' pod by adding the annotation 'release-notes' with the value 'https://example.com/release-notes/v2.5.1' | Command:
```bash
kubectl annotate pods email release-notes='https://example.com/release-notes/v2.5.1'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger... |
Import the DATABASE_URL key from the app-config-dev config map and set it as an environment variable in the analytics-platform-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_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 variable... |
Create a job named "audit-job" with the image "nginx" and run the command "nginx -t" | Command:
```bash
kubectl create job audit-job --image=nginx -- nginx -t
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Read the most recent 53 lines of logs for pod payment-gateway-pod. | Command:
```bash
kubectl logs --tail=53 payment-gateway-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", "shor... |
Get output from running the 'postgres' command in the first pod of the deployment 'analytics-platform-deployment'. | Command:
```bash
kubectl exec deploy/analytics-platform-deployment -- 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 omit... |
Create a single ingress called 'public-ingress' that directs requests to foo.com/input to svc1:9090 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="foo.com/input=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Forward traffic from local port 8088 to port 5432 on a selected pod in the deployment "api-server-deployment" | Command:
```bash
kubectl port-forward deployment/api-server-deployment 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 criteria, a pod will b... |
Run the 'python' command inside the pod cdn-service-pod. | Command:
```bash
kubectl exec cdn-service-pod -- python
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.ku... |
Set the cluster field in the user-a-context context to app-cluster | Command:
```bash
kubectl config set contexts.user-a-context.cluster app-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you wa... |
Port forward the local port 8081 to the pod's port 6379 for the security-service-pod pod. | Command:
```bash
kubectl port-forward pod/security-service-pod 8081:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Create a service for the replicated node named "node" that serves on port 8010 and connects to the containers on port 801000 | Command:
```bash
kubectl expose rc node --port=8010 --target-port=801000
```
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... |
Add a taint with key 'hardware' and value 'worker-node-3:PreferNoSchedule' on the nodes with the label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel hardware=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Use an alternative editor to edit a service using the kubectl command | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/proxy-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, ... |
Create an ingress named 'api-v1-ingress' that routes requests from foo.com/module to the service 'svc1' on port 5432 | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.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": "", "usage"... |
Import specific keys from a config map into an environment variable in a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-config-prod 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 v... |
Forward traffic from port 8081 on all addresses to port 5000 in the cdn-service-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8081: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 w... |
Get output from the "astro-container" in the pod named "frontend-pod" | Command:
```bash
kubectl attach frontend-pod -c astro-container
```
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,... |
Execute the 'ruby --version' command inside the e-commerce-pod pod, specifically in the nano-bot container, to retrieve the output. | Command:
```bash
kubectl exec e-commerce-pod -c nano-bot -- ruby --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 the port 8081 on all addresses to port 3000 in the 'api-service-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8081:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Create a copy of the backend-pod, making changes to the command for the quantum-quark container. | Command:
```bash
kubectl debug backend-pod -it --copy-to=my-custom-dbg --container=quantum-quark -- sh
```
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 defau... |
Create a copy of the 'database-pod' with the addition of a debug container and changes to the container images | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-app --image=debian --set-image=cache=redis:alpine,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and n... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/global-config 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 def... |
Remove all taints with key 'special' from node 'testing-node-11' | Command:
```bash
kubectl taint nodes testing-node-11 special-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|ya... |
Forward local port 5432 to the targetPort of the "https" port in the "user-service" service, selected by the service. | Command:
```bash
kubectl port-forward service/user-service 5432: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 selected ... |
Expose a replication controller for WordPress on port 80 and connect to containers on port 543200 | Command:
```bash
kubectl expose rc wordpress --port=80 --target-port=543200
```
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... |
Forward local ports to a selected pod's ports | Command:
```bash
kubectl port-forward deployment/email-server-deployment 8081 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... |
Get output from running the 'jenkins-plugin-cli' command from the pod named 'analytics-pod', using the first container by default | Command:
```bash
kubectl exec analytics-pod -- jenkins-plugin-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 ... |
Create a pod disruption budget named 'monitoring-pdb' that will select all pods with the 'app=nginx' label and require at least half of the pods selected to be available at any point in time. | Command:
```bash
kubectl create pdb monitoring-pdb --selector=app=nginx --min-available=50%
```
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-run=server|c... |
forward port 8080 on localhost and IP address 10.19.21.23 to port 5432 in the frontend-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 8080: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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.