prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a service for the replication controller specified in the "alpine-controller.yaml" file | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=7000 --target-port=637900
```
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... |
Auto scale the "chat-app" deployment with a minimum of 3 pods and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment chat-app --min=3 --max=10
```
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 use... |
Retrieve the output from running the 'mongo' command in the 'cyber-sleuth' container of the 'frontend-pod' pod. | Command:
```bash
kubectl exec frontend-pod -c cyber-sleuth -- mongo
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use th... |
Taint nodes with label 'release=beta' with a key 'hardware' and value 'prod-node-5:PreferNoSchedule' | Command:
```bash
kubectl taint node -l release=beta hardware=prod-node-5: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... |
Copy the ~/.config/kube file from the remote pod "logging/monitoring-agent-pod-6" to the /tmp/bar directory on the local machine. | Command:
```bash
kubectl cp logging/monitoring-agent-pod-6:~/.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, use t... |
Set the cluster field in the on-prem-context context to sun-cluster. | Command:
```bash
kubectl config set contexts.on-prem-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 w... |
Enable a new exec auth plugin for the "john.doe" entry. | Command:
```bash
kubectl config set-credentials john.doe --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1
```
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:
--... |
Execute the 'mongo' command inside the backend-pod and display the output | Command:
```bash
kubectl exec backend-pod -- mongo
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kuberne... |
Execute the 'redis-server' command in the 'lunar-launcher' container within the 'log-aggregator-pod' pod. | Command:
```bash
kubectl exec log-aggregator-pod -c lunar-launcher -- redis-server
```
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 port 5432 in the pod "proxy-server-pod" to port 9090 on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 9090: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 ... |
Create a pod disruption budget named cron-jobs-pdb that will ensure at least 9 pods with the label "role=worker" are always available | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=role=worker --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 [--d... |
Get the output from running the 'go run hello.go' command from the first pod of the scheduler-app-deployment deployment. | Command:
```bash
kubectl exec deploy/scheduler-app-deployment -- 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 om... |
Mark the node "prod-node-5" as schedulable | Command:
```bash
kubectl uncordon prod-node-5
```
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 " |
Add a taint with key 'environment' and value 'backup-node-14:PreferNoSchedule' on nodes having the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice environment=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": ... |
Adjust the replica count of the deployment named "foo" to 3 when the current size is 5 | Command:
```bash
kubectl scale --current-replicas=5 --replicas=3 deployment/foo
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
Scale the deployment named webapp-replicaset to 5 replicas, matching its current size. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=5 deployment/webapp-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-v... |
Update the environment variables of the deployment/notification-handler-deployment with the smtp_server key from the config map/app-secrets. | Command:
```bash
kubectl set env --keys=smtp_server --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 d... |
Retrieve the snapshot logs from the 'frontend-pod' pod with only one container | Command:
```bash
kubectl logs 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", "defaul... |
Update the 'cache-cluster-deployment' deployment by adding a new environment variable JWT_SECRET with the value 'your-jwt-secret' | Command:
```bash
kubectl set env deployment/cache-cluster-deployment JWT_SECRET=your-jwt-secret
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more po... |
Start a pod named 'hazelcast' using the 'mcr.microsoft.com/dotnet/core/runtime' image and expose port 27017 | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --port=27017
```
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..... |
Create a single ingress called 'private-ingress' that directs requests to 'foo.com/example' to the 'svc1' service on port 8888 with the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress private-ingress --rule="foo.com/example=svc1:8888,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Open the 'user-service' service for editing using the 'emacs' editor. | Command:
```bash
KUBE_EDITOR="emacs" kubectl edit svc/user-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, ... |
Update the label of the 'analytics' pod to set the 'tier' label to 'backend' | Command:
```bash
kubectl label pods analytics tier=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":... |
Start streaming the logs of the stardust-shuttle container in the web-app-pod pod. | Command:
```bash
kubectl logs -f -c stardust-shuttle web-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", ... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/ldap-credentials-secret deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or... |
Get the output from running the 'psql' command in the 'nano-bot' container from the 'auth-service-pod' pod | Command:
```bash
kubectl exec auth-service-pod -c nano-bot -- psql
```
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... |
Add a taint with the key 'cpu-type' to nodes having the label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack 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": "", "us... |
Get the output from running the 'geth attach' command in the time-machine container of the analytics-pod pod. | Command:
```bash
kubectl exec analytics-pod -c time-machine -- geth attach
```
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 8081 on all addresses to port 5000 in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-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 po... |
Set custom TLS server name to use for validation for the cluster-gamma cluster entry | Command:
```bash
kubectl config set-cluster cluster-gamma --tls-server-name=my-k8s-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] [--certific... |
Create a new ExternalName service named external-messaging-service with the external name as news-demo.news | Command:
```bash
kubectl create service externalname external-messaging-service --external-name news-demo.news
```
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 ser... |
Update the 'chat-app' pod with the annotation 'security-scan-status' and set the value to 'pass', overriding any existing value. | Command:
```bash
kubectl annotate --overwrite pods chat-app 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 a... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/api-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 definitions... |
Update the annotation 'release-notes' of the pod 'security' with the value 'https://example.com/release-notes/v2.5.1' and overwrite any existing value | Command:
```bash
kubectl annotate --overwrite pods security 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 tha... |
Execute the 'mysql' command in the gateway-pod and retrieve the output. | Command:
```bash
kubectl exec gateway-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.kuberne... |
Create a new config map named app-name-config with the settings key sourced from /path/to/properties/file1.txt and the key2 key sourced from /path/to/data/file2.txt | Command:
```bash
kubectl create configmap app-name-config --from-file=settings=/path/to/properties/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 ... |
Execute the command `composer --version` inside the `astro-container` from the `web-app-pod` pod and print the output. | Command:
```bash
kubectl exec web-app-pod -c astro-container -- composer --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 ... |
Retrieve the previous terminated logs of the "rocket-ranger" container from the "auth-service-pod" pod. | Command:
```bash
kubectl logs -p -c rocket-ranger auth-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"... |
display the replication controller named "web", the service named "analytics-rc", and the pod named "web-app-pod" | Command:
```bash
kubectl get rc/web service/analytics-rc pods/web-app-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 namespaced y... |
Create a new config map named global-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap global-config --from-file=properties=/path/to/preferences/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... |
Add a label 'unhealthy' with the value 'true' to the pod 'security' | Command:
```bash
kubectl label pods security unhealthy=true
```
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"... |
Forward local port 8081 to port 8000 in the pod named security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8081:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Update the annotation of pod 'security' with the key 'owner' and the value 'alice-smith', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods security owner='alice-smith'
```
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 service for the centos replication controller specified in the "centos-controller.yaml" file, which serves on port 3000 and connects to the containers on port 900000. | Command:
```bash
kubectl expose -f centos-controller.yaml --port=3000 --target-port=900000
```
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... |
Create an ingress rule named 'api-gateway-ingress' that will route requests for 'testing.com/example' to the service 'svc1' on port 6379 with TLS encryption using the secret 'my-cert'. | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="testing.com/example=svc1:6379,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": "... |
Remove the label 'app-' from the pod 'log-aggregator' if it exists | Command:
```bash
kubectl label pods log-aggregator app-
```
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": "I... |
Apply a taint with key 'workload' and value 'app-node-6:PreferNoSchedule' on nodes that have the label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack workload=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":... |
Create a new ClusterIP service named frontend-service-clusterip with a TCP port mapping from port 9000 to port 8081. | Command:
```bash
kubectl create service clusterip frontend-service-clusterip --tcp=9000:8081
```
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 service for the replication controller specified in the "php-controller.yaml" file | Command:
```bash
kubectl expose -f php-controller.yaml --port=8888 --target-port=808300
```
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 sp... |
Listen on port 8088 on all addresses and forward traffic to port 8088 in the chat-app-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 8088:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Create a deployment named my-dep with the specified ruby image and expose port 9000 | Command:
```bash
kubectl create deployment my-dep --image=ruby --port=9000
```
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: jso... |
Run the 'mongo' command in the first container of the first pod of the 'loadbalancer-service' service and display the output. | Command:
```bash
kubectl exec svc/loadbalancer-service -- mongo
```
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... |
Retrieve the previous terminated logs of the "warp-drive" container from the "media-stream-pod" pod | Command:
```bash
kubectl logs -p -c warp-drive media-stream-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", "... |
Update the node 'web-node-8' with a taint that has the key 'dedicated', the value 'special-user', and the effect 'NoSchedule' | Command:
```bash
kubectl taint nodes web-node-8 dedicated=special-user:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output for... |
Create a new secret named api-secret-key with keys for each file in the path/to/options folder | Command:
```bash
kubectl create secret generic api-secret-key --from-file=path/to/options
```
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 th... |
Create a deployment named 'mattermost' using the 'php' image and expose port 7000 | Command:
```bash
kubectl create deployment mattermost --image=php --port=7000
```
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: ... |
Auto scale the "payment" deployment with a minimum of 3 pods and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment payment --min=3 --max=15
```
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... |
Print the non-namespaced resources that are supported | Command:
```bash
kubectl api-resources --singularNamespaced=false
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Update the label of the pod 'chat-app' to 'status=unhealthy', replacing any existing value | Command:
```bash
kubectl label --overwrite pods chat-app status=unhealthy
```
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": "f... |
Forward local port 8081 to port 3000 in the pod selected by the web-app-deployment deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 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 will be s... |
List deployments in JSON output format from the "stable-2.0.0" version of the "api-v2" API group. | Command:
```bash
kubectl get deployments.stable-2.0.0.api-v2 -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 deployment called "ingress" using the "amazonlinux" image, and expose port 8084. | Command:
```bash
kubectl create deployment ingress --image=amazonlinux --port=8084
```
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... |
Forward the local ports 6379 and 6000 to the corresponding ports 3000 and 6000 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward pod/api-service-pod 6379 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 au... |
Embed certificate authority data for the testing-cluster cluster entry. | Command:
```bash
kubectl config set-cluster testing-cluster --embed-certs --certificate-authority=~/.kube/app-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 s... |
Create a job called "audit-job" using the Ruby image and run the "gem --version" command within the job. | Command:
```bash
kubectl create job audit-job --image=ruby -- gem --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. On... |
Remove the taint with key 'dedicated' and effect 'NoSchedule' from the node 'kube-master-9' if it exists. | Command:
```bash
kubectl taint nodes kube-master-9 dedicated:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Start a nginx pod with custom specifications provided in a JSON format | Command:
```bash
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "alpha-2.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMM... |
Embed the certificate authority data for the "data-cluster" cluster entry | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/my-k8s-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 s... |
Create a new config map named "app-settings" with the specified keys and their corresponding files. | Command:
```bash
kubectl create configmap app-settings --from-file=settings=/path/to/options/file1.txt --from-file=key2=/path/to/properties/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 new NodePort service named auth-service-nodeport, mapping port 8088 on the cluster to port 3001 on the service. | Command:
```bash
kubectl create service nodeport auth-service-nodeport --tcp=8088:3001
```
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"... |
Update the cluster configuration for a specific context | Command:
```bash
kubectl config set contexts.app-1-context.cluster kube-cluster-1
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you ... |
Create a cron job named 'monthly-audit' using the 'mysql' image, with a schedule set to run every minute | Command:
```bash
kubectl create cronjob monthly-audit --image=mysql --schedule="*/1 * * * *" -- mysql --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": ... |
Set the client-key-data field for the jane.smith user by providing the certificate data and specifying the --set-raw-bytes=true option. | Command:
```bash
kubectl config set users.jane.smith.client-key-data cert_data_here --set-raw-bytes=true
```
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_VALU... |
Create a new LoadBalancer service named analytics-lb with a mapping from port 6379 to port 8089 | Command:
```bash
kubectl create service loadbalancer analytics-lb --tcp=6379:8089
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "defau... |
Update the annotation 'security-scan-status' of the 'payment' pod to 'pass' | Command:
```bash
kubectl annotate pods payment 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 and include arbi... |
Delete pods and services that have the label "owner" set to "john-doe" | Command:
```bash
kubectl delete pods,services -l owner=john-doe
```
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 selec... |
Run the 'node' command in the 'quantum-quark' container of the 'email-service-pod' pod and get the output. | Command:
```bash
kubectl exec email-service-pod -c quantum-quark -- node
```
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... |
Get the output from running the 'go' command in the first pod of the 'database-deployment' deployment. | Command:
```bash
kubectl exec deploy/database-deployment -- 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 omitted, use the kub... |
Forward local ports 8080 and 6000 to ports 3000 and 6000 in the pod cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-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 selected au... |
Create a job called "testing" using the PHP image. | Command:
```bash
kubectl create job testing --image=php --
```
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: json|yaml|n... |
Run the 'geth version' command inside the 'gateway-pod' pod and retrieve the output. | Command:
```bash
kubectl exec gateway-pod -- geth version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.... |
Set a custom TLS server name for validation for the "staging-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster staging-cluster --tls-server-name=staging-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] [--certi... |
Copy the local file "/tmp/foo" to the remote pod "metrics-exporter-pod-10" in the "kube-system" namespace, and place it in the "/etc/kubernetes" directory. | Command:
```bash
kubectl cp /tmp/foo kube-system/metrics-exporter-pod-10:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Forward local port 5000 to the targetPort of the "https" service port in a pod selected by the "email-service" service. | Command:
```bash
kubectl port-forward service/email-service 5000: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... |
Create a single ingress named 'app1-ingress' that directs requests to site.com/module to the service named 'svc1' on port 27017, using the TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/module=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": "", "usage"... |
Set the cluster field in the my-context context to on-prem-cluster | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster on-prem-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... |
Copy the /tmp/foo file from the remote pod kube-proxy/admin-dashboard-pod-16 to the local machine's /tmp/bar directory. | Command:
```bash
kubectl cp kube-proxy/admin-dashboard-pod-16::/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 th... |
Import the 'api_key' key from the 'env-vars' config map into the 'load-balancer-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/env-vars 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 definitions in ... |
Start streaming the logs of the ruby container in the database-pod pod | Command:
```bash
kubectl logs -f -c ruby database-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-... |
Roll back the 'namespace-2' daemonset to revision 3 | Command:
```bash
kubectl rollout undo daemonset/namespace-2 --to-revision=3
```
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... |
Port forward the 'api-service-pod' pod, listening on port 8000 locally and forwarding to port 8080 in the pod. | Command:
```bash
kubectl port-forward pod/api-service-pod 8000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
List the replication controller with the name "web", the service with the name "email-service-rc", and the pod with the name "email-service-pod" | Command:
```bash
kubectl get rc/web service/email-service-rc pods/email-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is na... |
Add a taint to nodes labeled with 'team=devops' with key 'disktype' and value 'kube-master-9:PreferNoSchedule' | Command:
```bash
kubectl taint node -l team=devops disktype=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": "... |
Create a deployment named "cache" using the MySQL image. | Command:
```bash
kubectl create deployment cache --image=mysql
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|... |
Add a taint with key 'app' on nodes having the label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack app=prod-node-5: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... |
Copy the directory "/tmp/foo_dir" from the remote pod "api-server-pod-3" of the "ingress-nginx" deployment to the local "/etc/kubernetes" directory. | Command:
```bash
kubectl cp ingress-nginx/api-server-pod-3:/tmp/foo_dir /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Create a new pod named 'nginx' using the 'python' image, but override the pod's spec with a partially defined set of values parsed from the provided JSON. | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "legacy-1.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [... |
Update the 'gateway' pod by annotating it with the 'last-deployment' annotation and setting the value to '2023-03-15'. | Command:
```bash
kubectl annotate pods gateway last-deployment=2023-03-15
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arb... |
Set the certificate authority data for the testing-cluster cluster entry by embedding the certs and specifying the certificate authority file path as "~/.kube/testing-cluster/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster testing-cluster --embed-certs --certificate-authority=~/.kube/testing-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 conf... |
Create a pod disruption budget named api-service-pdb that will select all pods with the role=worker label and require at least 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=role=worker --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 [-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.