prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a Pod Disruption Budget named auth-service-pdb that specifies that at least four pods with the label app=rails should be available at all times. | Command:
```bash
kubectl create poddisruptionbudget auth-service-pdb --selector=app=rails --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--... |
Create a single ingress called 'service-ingress' with the rule that directs requests from testing.com/input to svc # svc1:8888 and use the tls secret "my-cert". | Command:
```bash
kubectl create ingress service-ingress --rule="testing.com/input=svc1:8888,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
List all deployments in the "hotfix-1.1.2" version of the "web-apps" API group, and display the output in YAML format. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.web-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you ... |
Create a cluster role binding for admin, devops-user, and operations-team with the view cluster role | Command:
```bash
kubectl create clusterrolebinding view --clusterrole=view --user=admin --user=devops-user --group=operations-team
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--... |
Create a cluster role named "bar" with the ability to perform patch operations on NonResourceURLs that match "/logs/*" | Command:
```bash
kubectl create clusterrole "bar" --verb=patch --non-resource-url=/logs/*
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": ... |
Set the resource request and limits for all containers in the php deployment | Command:
```bash
kubectl set resources deployment php --limits=cpu=200m,memory=512Mi --requests=cpu=2,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, bu... |
Create a pod disruption budget named "load-balancer-pdb" that will select all pods with the "release=1.0.0" label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=release=1.0.0 --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=... |
Retrieve the output after running the 'elasticsearch-plugin --list' command in the pod 'vpn-service-pod' using the container 'cyber-sleuth' | Command:
```bash
kubectl exec vpn-service-pod -c cyber-sleuth -- elasticsearch-plugin --list
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container... |
Forward port 6379 on your local machine to port 8088 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 6379:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Create a deployment named 'grafana' using the 'alpine' image and expose port 8084 | Command:
```bash
kubectl create deployment grafana --image=alpine --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 of: ... |
Copy the ~/.config/kube file from the 'metallb-system/metrics-exporter-pod-10' pod to the /tmp/bar_dir directory locally. | Command:
```bash
kubectl cp metallb-system/metrics-exporter-pod-10:~/.config/kube /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Create an ingress named 'myapp-ingress' with a rule that directs requests from foo.com/example to svc1:8082 | Command:
```bash
kubectl create ingress myapp-ingress --rule="foo.com/example=svc1:8082,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"... |
Wait for the pod "web-app-pod" to be deleted, with a timeout of 60s, after issuing the "delete" command. | Command:
```bash
kubectl delete pod/web-app-pod
kubectl wait --for=delete pod/busybox1 --timeout=60s
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.
... |
Create a new config map 'kube-system-config' using the key=value pairs from the file located at 'path/to/settings' | Command:
```bash
kubectl create configmap kube-system-config --from-file=path/to/settings
```
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 to the ba... |
Update the annotation of the 'api' pod with the key 'contact-email' and the value 'support@example.com', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods api 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... |
Install curl in the warp-drive container of the log-aggregator-pod and get the output from running the command. | Command:
```bash
kubectl exec log-aggregator-pod -c warp-drive -- apk add curl
```
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... |
Update the deployment 'web-app-deployment' by setting a new environment variable | Command:
```bash
kubectl set env deployment/web-app-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 pod temp... |
Import the `smtp_server` key from the config map `log-config` to the deployment `frontend-deployment`. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/log-config deployment/frontend-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... |
Import specific keys from a config map into an environment variable for a deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-settings 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 defi... |
Add a taint with key 'app' on nodes having the label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth app=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": "", "usage": "Out... |
Create a deployment named "cache" using the nginx image and exposing port 8888 | Command:
```bash
kubectl create deployment cache --image=nginx --port=8888
```
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... |
Start a pod with a custom spec, overriding some values using JSON | Command:
```bash
kubectl run nginx --image=docker.elastic.co/elasticsearch/elasticsearch --overrides='{ "apiVersion": "hotfix-1.1.2", "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] [--... |
Copy the contents of the local file `/var/run/secrets/kubernetes.io/serviceaccount/` to the remote pod `ingress-controller-pod-8` in the specific container `monitoring-agent` at the location `/tmp/bar`. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ ingress-controller-pod-8::/tmp/bar -c monitoring-agent
```
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": ... |
Forward the local port 3000 to the targetPort of the service's port named "https" in a selected pod through port forwarding | Command:
```bash
kubectl port-forward service/database-service 3000: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 selec... |
Retrieve the previous terminated logs from the "warp-drive" container in the "web-app-pod" pod | Command:
```bash
kubectl logs -p -c warp-drive 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", "short... |
Get the output from running the 'psql' command from the first pod of the 'proxy-service-deployment' deployment using the first container | Command:
```bash
kubectl exec deploy/proxy-service-deployment -- 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 ... |
Create a new ClusterIP service named billing-service-clusterip with the TCP port mapping from 9090 to 8000. | Command:
```bash
kubectl create service clusterip billing-service-clusterip --tcp=9090:8000
```
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 the pod "api-service-pod" adding a debug container and changing container images. | Command:
```bash
kubectl debug api-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=cache=redis:alpine,api=api:v2
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and nam... |
Copy the local file /tmp/foo to the remote pod monitoring-agent-pod-6's /tmp/bar directory in the monitoring namespace. | Command:
```bash
kubectl cp /tmp/foo monitoring/monitoring-agent-pod-6::/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... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/app-config-secret deployment/search-engine-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 mo... |
Create an ingress called 'api-gateway-ingress' directing requests to website.com/module to svc1:8181 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="website.com/module=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": ""... |
Expose a replica set named "ruby" as a service with port 3306 and target port 8080. | Command:
```bash
kubectl expose rs ruby --port=3306 --target-port=808400
```
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... |
Update the image of all containers in the daemonset named 'app-v2' to 'java:11.0.12' | Command:
```bash
kubectl set image daemonset app-v2 *=java:11.0.12
```
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... |
Set the custom TLS server name to "on-prem-cluster" for the cluster entry with the name "prod-cluster" | Command:
```bash
kubectl config set-cluster prod-cluster --tls-server-name=on-prem-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... |
Copy the directory /tmp/foo_dir from the api-server-pod-3 pod in the default namespace to the /tmp/bar directory on your local machine. | Command:
```bash
kubectl cp default/api-server-pod-3:/tmp/foo_dir :/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 kube... |
Create a pod named "hazelcast" using the redis image and expose port 3000 on the container. | Command:
```bash
kubectl run hazelcast --image=redis --port=3000
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Forward traffic from port 5000 on all addresses to port 8888 in the pod named cdn-service-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 5000: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... |
Create a debug copy of the chat-app-pod with all container images changed to hazelcast/hazelcast | Command:
```bash
kubectl debug chat-app-pod --copy-to=debug-image-api --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 defa... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/api-config 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 defini... |
Create an ingress called 'web-ingress' that routes requests to website.com/bar to a service called svc1 on port 8181 | Command:
```bash
kubectl create ingress web-ingress --rule="website.com/bar=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": "", "usage": ... |
Listen on port 9090 locally and forward the traffic to port 8081 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 9090:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Create a new NodePort service named api-service-nodeport that maps port 3000 of the service to port 8181 of the pods | Command:
```bash
kubectl create service nodeport api-service-nodeport --tcp=3000:8181
```
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":... |
Copy file from local machine to a specific directory in a remote pod and container | Command:
```bash
kubectl cp :/tmp/foo database-pod-2:/tmp/bar_dir -c monitoring-agent
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Autoscale the "backend" deployment with a minimum of 3 pods and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment backend --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 uses... |
Import the value of the 'my-example-key' key from the 'app-name-config' ConfigMap and set it as an environment variable in the 'load-balancer-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-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 d... |
Get the output from running the 'elasticsearch --version' command in the 'cyber-sleuth' container of the 'proxy-service-pod' pod. | Command:
```bash
kubectl exec proxy-service-pod -c cyber-sleuth -- elasticsearch --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container n... |
Create a new ClusterIP service named `analytics-service-clusterip` that maps port 3306 of the service to port 8083 of the pods | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=3306: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": "-... |
Create a LoadBalancer service named log-aggregator-lb that balances traffic from port 5001 to port 8089. | Command:
```bash
kubectl create service loadbalancer log-aggregator-lb --tcp=5001: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", "... |
Get output from nano-bot in pod proxy-service-pod | Command:
```bash
kubectl attach proxy-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, u... |
Copy the local file /var/run/secrets/kubernetes.io/serviceaccount/ to the remote pod auth-service-pod-11, in the /tmp/bar_dir directory, specifically in the payment-gateway container. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ auth-service-pod-11:/tmp/bar_dir -c payment-gateway
```
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": "",... |
Add a taint with key 'environment' on nodes having label 'myLabel' and set the value to 'worker-node-3:PreferNoSchedule' | Command:
```bash
kubectl taint node -l myLabel environment=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": "O... |
Update the nginx container image from the local file specified in 'path/to/file.yaml' to 'httpd:2.4.48' without making any changes on the server and print the resulting changes in YAML format. | Command:
```bash
kubectl set image -f path/to/file.yaml httpd=httpd:2.4.48 --local -o yaml
```
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), replic... |
Create an ingress named 'internal-ingress' and configure it to direct requests for 'testing.com/input' to 'svc1:7000' with the TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress internal-ingress --rule="testing.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": "", "u... |
Embed the certificate authority data for the staging-cluster cluster entry. | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/kube-cluster-1/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 confi... |
Autoscale the replication controller "email" with a target CPU utilization of 20% and a maximum of 8 pods | Command:
```bash
kubectl autoscale rc email --max=8 --cpu-percent=20
```
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 new ClusterIP service named 'monitoring-service-clusterip' that maps port 6379 on the service to port 8888 on the target container | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=6379: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": "... |
Execute the command 'gem --version' in the pod named 'monitoring-pod' with the container 'nebula-navigator' and retrieve the output. | Command:
```bash
kubectl exec monitoring-pod -c nebula-navigator -- 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 o... |
Create a debug copy of mypod with modified container images | Command:
```bash
kubectl debug mypod -it --copy-to=my-custom-dbg --image=debian --set-image=app=app:debug,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 and name... |
Create a service for the replicated node called 'node', which serves on port 3000 and connects to the containers on port 818100. | Command:
```bash
kubectl expose rc node --port=3000 --target-port=818100
```
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... |
Forward local port 8000 to port 8081 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 8000: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 select... |
List deployments in JSON output format for the "feature-branch-2.3.0" version of the "custom-apps" API group. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.custom-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is name... |
Copy the file "foo" from the local machine to the "/etc/kubernetes" directory in a remote pod named "web-app-pod-1" within the container named "load-balancer". | Command:
```bash
kubectl cp :/tmp/foo web-app-pod-1:/etc/kubernetes -c load-balancer
```
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... |
Embed certificate authority data for the cluster-alpha cluster entry | Command:
```bash
kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/cloud-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... |
Run the 'go' command in the code-explorer container of the pod named proxy-server-pod | Command:
```bash
kubectl exec proxy-server-pod -c code-explorer -- 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 ... |
Create a new secret named 'oauth-secret' using the parameters in the 'path/to/parameters.env' file | Command:
```bash
kubectl create secret generic oauth-secret --from-env-file=path/to/parameters.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basen... |
Import the environment variables from the secret "my-secret" into the "proxy-service-deployment" deployment | Command:
```bash
kubectl set env --from=secret/my-secret deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod t... |
Set the custom TLS server name to "moon-cluster" for the "galaxy-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster galaxy-cluster --tls-server-name=moon-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... |
List deployments in JSON output format, specifically for the "dev-2.2.0" version of the "backup-apps" API group. | Command:
```bash
kubectl get deployments.dev-2.2.0.backup-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you ... |
Update the deployment 'email-server-deployment' by setting the environment variable S3_BUCKET to 'my-s3-bucket' | Command:
```bash
kubectl set env deployment/email-server-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 tem... |
Create a deployment named 'api' with 5 replicas running the 'nginx' image. | Command:
```bash
kubectl create deployment api --image=nginx --replicas=5
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json... |
create a new ClusterIP service named messaging-service-clusterip, mapping port 3306 on the service to port 8888 on the backend | Command:
```bash
kubectl create service clusterip messaging-service-clusterip --tcp=3306: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": "-... |
Create a new config map named kube-system-config with specified keys using files as input | Command:
```bash
kubectl create configmap kube-system-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/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.
Whe... |
Display the non-namespaced resources supported by the Kubernetes API | Command:
```bash
kubectl api-resources --storageVersionHashspaced=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. " |
Create a debug copy of the vpn-service-pod with all container images changed to ethereum/client-go | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-memcached --set-image=*=ethereum/client-go
```
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... |
Create an ingress named 'ingress1' with multiple hosts and set the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:8010" \
--rule="input.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output... |
Copy the local file /tmp/foo to the remote pod named image-resizer-pod-20 in the default namespace, and place it at the path /etc/kubernetes. | Command:
```bash
kubectl cp /tmp/foo default/image-resizer-pod-20:/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, use th... |
Expose a replicated php service on port 80, with connections to the containers on port 8000. | Command:
```bash
kubectl expose rc php --port=5432 --target-port=330600
```
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 ... |
Update the server field for the my-k8s-cluster cluster entry | Command:
```bash
kubectl config set-cluster my-k8s-cluster --server=https://1.2.3.4
```
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-aut... |
Create an ingress named 'api-ingress' with a rule that directs requests from testing.com/input to service svc1 on port 9000 | Command:
```bash
kubectl create ingress api-ingress --rule="testing.com/input=svc1:9000,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"... |
Create a copy of a pod called chat-app-pod and change the command of a container within the pod named mycontainer in order to debug it. | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=my-debugger --container=mycontainer -- 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 default ... |
Auto scale the replication controller "security" with a target CPU utilization of 20% and a maximum of 2 pods | Command:
```bash
kubectl autoscale rc security --max=2 --cpu-percent=20
```
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... |
Execute the 'composer --version' command in the first container of the 'load-balancer-deployment' deployment and get the output. | Command:
```bash
kubectl exec deploy/load-balancer-deployment -- 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... |
Start a proxy to the Kubernetes API server on port 8081, and serve static content from the './local/www/' directory. | Command:
```bash
kubectl proxy --port=8081 --www=./local/www/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote... |
Get output from running the 'nginx' command from the 'frontend-pod' pod, using the first container by default | Command:
```bash
kubectl exec frontend-pod -- nginx
```
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.kubern... |
Create a deployment named "web" using the "mongo" image and expose port 27017. | Command:
```bash
kubectl create deployment web --image=mongo --port=27017
```
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... |
Create a copy of the database-pod by adding a debug container and changing the container images | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-app --image=debian --set-image=cache=redis:alpine,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource ... |
Create an ingress called 'www-ingress' with the following rule: redirect requests from testing.com/module to svc1:3306 | Command:
```bash
kubectl create ingress www-ingress --rule="testing.com/module=svc1:3306,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 local port 8081 to port 8000 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward pod/log-aggregator-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 selected... |
Add the label 'tier=database' to the pod named 'web' | Command:
```bash
kubectl label pods web 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 ... |
Embed the certificate authority data for the e2e cluster entry. | Command:
```bash
kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/dev-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-cluster N... |
Create an ingress resource named 'rontend-ingress' with a rule that directs requests from site.com/example to svc1:8084 | Command:
```bash
kubectl create ingress rontend-ingress --rule="site.com/example=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": "", "usa... |
Create a cluster role named "default_role" with specific resource names | Command:
```bash
kubectl create clusterrole default_role --verb=patch --resource=services --resource-name=app-analytics --resource-name=app-worker-2
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Set the resource requests and limits for all containers in the 'amazonlinux' deployment | Command:
```bash
kubectl set resources deployment amazonlinux --limits=cpu=200m,memory=512Mi --requests=cpu=10,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 re... |
Generate a YAML file for updating rolebinding subjects from a local source without making changes to the server. | Command:
```bash
kubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--u... |
Add a taint with key 'hardware' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta hardware=node-2: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... |
Create an ingress resource named 'frontend-ingress' that will route requests from site.com/module to the service 'svc1' on port 8081 | Command:
```bash
kubectl create ingress rontend-ingress --rule="site.com/module=svc1:8081,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... |
Forward all traffic from port 9090 on all addresses to port 5432 in the security-service-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-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 ... |
Create a secret named app-config-secret and populate it with the contents of each file in the folder specified by path/to/data. | Command:
```bash
kubectl create secret generic app-config-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 th... |
Check the rollout status of a daemonset named test | Command:
```bash
kubectl rollout status daemonset/test
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Forward traffic from port 8000 on all addresses to port 5432 in the web-app-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8000: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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.