prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Add certificate authority data to the kube-cluster-1 cluster entry by running: | Command:
```bash
kubectl config set-cluster kube-cluster-1 --embed-certs --certificate-authority=~/.kube/moon-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... |
Expose a replica set as a service, serving on port 8089 and forwarding traffic to containers on port 808000 | Command:
```bash
kubectl expose rs node --port=8089 --target-port=808000
```
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... |
Get the output from running the 'python' command in the lunar-launcher container of the api-service-pod | Command:
```bash
kubectl exec api-service-pod -c lunar-launcher -- 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, ... |
Remove the label named 'bar' from the pod 'analytics' | Command:
```bash
kubectl label pods analytics role-
```
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 tr... |
Create a single ingress called 'www-ingress' that directs requests to site.com/bar to svc1:8088 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress www-ingress --rule="site.com/bar=svc1:8088,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Use an alternative editor (e.g. gedit) to edit the email-service service. | Command:
```bash
KUBE_EDITOR="gedit" kubectl edit svc/email-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,... |
Unset the namespace in the cloud-context context. | Command:
```bash
kubectl config unset contexts.cloud-context.namespace
```
What it does:
Unset 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.
Syntax:
`kubectl config unset PROPERTY_NAME` |
Create a deployment named "web" running the "centos" image and expose port 8084. | Command:
```bash
kubectl create deployment web --image=centos --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: json... |
Import the specific key 'my-example-key' from the 'global-config' ConfigMap into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/global-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 variabl... |
Import the LOG_LEVER key from the app-config-prod config map into the frontend-deployment deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config-prod 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... |
Forward local port 8000 to port 8081 in the web-app-pod | Command:
```bash
kubectl port-forward pod/web-app-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 selected automa... |
Add a taint with key 'datacenter' on nodes having label role=database | Command:
```bash
kubectl taint node -l role=database datacenter=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Return the snapshot of previous terminated rocket-ranger container logs from the pod named "cdn-service-pod" | Command:
```bash
kubectl logs -p -c rocket-ranger cdn-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",... |
Attach to the 'rocket-ranger' container in the 'log-aggregator-pod' pod to get output from it. | Command:
```bash
kubectl attach log-aggregator-pod -c rocket-ranger
```
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 omit... |
Copy the file /tmp/foo from the local machine to the /tmp/bar_dir directory in the metrics-exporter-pod-10 pod | Command:
```bash
kubectl cp :/tmp/foo metrics-exporter-pod-10:/tmp/bar_dir -c auth-service
```
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 omitte... |
Create an ingress rule named 'website-ingress' that routes requests from foo.com/module to svc1:8181 with the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress website-ingress --rule="foo.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": "", "usage... |
Attach to a running pod named "analytics-pod" and get its output | Command:
```bash
kubectl attach analytics-pod
```
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.k... |
Set the environment variables for the "deploy-bot" entry in the exec auth plugin | Command:
```bash
kubectl config set-credentials deploy-bot --exec-env=key1=val1 --exec-env=key2=val2
```
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
Be... |
Get output from the astro-container in the analytics-pod pod. | Command:
```bash
kubectl attach analytics-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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/global-config 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 definiti... |
Auto scale the deployment named "auth" with the number of pods set to be between 2 and 9. | Command:
```bash
kubectl autoscale deployment auth --min=2 --max=9
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Return snapshot logs from the container "gateway-pod-1" of the "order-processing-deployment" deployment. | Command:
```bash
kubectl logs deployment/order-processing-deployment -c gateway-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"f... |
Display only the last 3 lines of logs for the pod named 'proxy-server-pod' | Command:
```bash
kubectl logs --tail=3 proxy-server-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": ... |
Set the cluster field in the user-b-context context to web-cluster | Command:
```bash
kubectl config set contexts.user-b-context.cluster web-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... |
Create a cron job named "alerts-cleanup" that runs the command "yum install -y aws-cli" every minute | Command:
```bash
kubectl create cronjob alerts-cleanup --image=amazonlinux --schedule="*/1 * * * *" -- yum install -y aws-cli
```
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": "--outp... |
Add a taint to nodes with the label 'role=database' | Command:
```bash
kubectl taint node -l role=database hardware=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Copy the file /tmp/foo from the remote pod api-server-pod-3 in the kube-dns namespace to the local directory /tmp/bar | Command:
```bash
kubectl cp kube-dns/api-server-pod-3:/tmp/foo /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.... |
Create a deployment named "ingress" running the "node" image | Command:
```bash
kubectl create deployment ingress --image=node
```
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... |
Create a new resource quota named 'my-quota' with the following limits: cpu=1, memory=1G, pods=2, services=3, replicationcontrollers=2, resourcequotas=1, secrets=5, persistentvolumeclaims=10. | Command:
```bash
kubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10
```
What it does:
Create a resource quota with the specified name, hard limits, and optional scopes.
Syntax:
`kubectl create quota NAME [--hard=key1=val... |
Create a new ClusterIP service named frontend-service-clusterip that listens on TCP port 9090 and forwards traffic to port 6379. | Command:
```bash
kubectl create service clusterip frontend-service-clusterip --tcp=9090:6379
```
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 new LoadBalancer service named e-commerce-lb, and forward traffic from port 8083 to port 8089 | Command:
```bash
kubectl create service loadbalancer e-commerce-lb --tcp=8083: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", "defa... |
Create a new config map named 'namespace-config' with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap namespace-config --from-file=properties=/path/to/settings/file1.txt --from-file=key1=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When c... |
Set the custom TLS server name to "moon-cluster" for the "testing-cluster" cluster entry | Command:
```bash
kubectl config set-cluster testing-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] [--certific... |
create a debug container for the cdn-service-pod with modified container images | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=debug-image-memcached --image=debian --set-image=cache=redis:alpine,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 ide... |
Update the pod 'chat-app' with the annotation 'backup-strategy' and the value 'daily-backups', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods chat-app backup-strategy='daily-backups'
```
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 labe... |
Create a pod disruption budget named critical-services-pdb that selects all pods with the owner=team-1 label and ensures that at least one of them is available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=owner=team-1 --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-availab... |
Update the server field for the staging-cluster cluster entry while keeping other values intact | Command:
```bash
kubectl config set-cluster staging-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-au... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/web-app-pod 8000 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 automa... |
Edit the data in the parameters.json file in JSON format, then create the Kubernetes resource using the edited data | Command:
```bash
kubectl create -f parameters.json --edit -o json
```
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... |
Set the service account of the log-aggregator-deployment deployment to argocd | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-deployment argocd
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kube... |
Forward local port 5432 to port 8080 in the mypod pod | Command:
```bash
kubectl port-forward pod/mypod 5432: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 automaticall... |
Forward local port 8888 and IP 10.19.21.23 to port 5432 in the cdn-service-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 8888: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 cri... |
Return the snapshot logs from the container "order-processing-deployment-1" of the deployment named "frontend-pod" | Command:
```bash
kubectl logs deployment/order-processing-deployment -c frontend-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"... |
Create a new config map named monitoring-config in the current namespace, using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap monitoring-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/profiles/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 creatin... |
Create a Pod Disruption Budget named critical-services-pdb that will select all pods with the role=worker label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=role=worker --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-availabl... |
Listen on port 8088 locally and forward data to/from port 8000 in the 'web-app-pod' pod | Command:
```bash
kubectl port-forward pod/web-app-pod 8088 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 automa... |
Start a proxy to the Kubernetes API server on port 27017, serving static content from the ./local/www/ directory. | Command:
```bash
kubectl proxy --port=27017 --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 remot... |
Create a debug copy of the frontend-pod and change all container images to "docker.elastic.co/elasticsearch/elasticsearch" | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-app --set-image=*=docker.elastic.co/elasticsearch/elasticsearch
```
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.... |
Embed the certificate authority data for the "edge-cluster" cluster entry | Command:
```bash
kubectl config set-cluster edge-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-... |
Add a taint with the key 'hardware' and the value 'node-2:PreferNoSchedule' on nodes that have the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace 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"... |
Expose the replicated Wordpress service, serving on port 8080, and connecting to the containers on port 8000 | Command:
```bash
kubectl expose rc wordpress --port=8080 --target-port=800000
```
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 po... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/security-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 will be select... |
Create a cron job with a specified schedule and command | Command:
```bash
kubectl create cronjob cron-task --image=alpine --schedule="*/1 * * * *" -- ash
```
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": "-o", "default"... |
Set up automatic scaling for the "frontend" replication controller with a range of 1 to 5 pods, targeting a CPU utilization of 50%. | Command:
```bash
kubectl autoscale rc frontend --max=5 --cpu-percent=50
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
Delete the pods and services with the names "web" and "analytics" | Command:
```bash
kubectl delete pod,service web analytics
```
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 a cron job called "monthly-audit" with an image of "mysql" and a schedule of running every minute, and execute the command "mysql" within the job. | Command:
```bash
kubectl create cronjob monthly-audit --image=mysql --schedule="*/1 * * * *" -- mysql
```
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": "-o", "def... |
Set the cluster field in the specified context to the provided cluster name | Command:
```bash
kubectl config set contexts.team-beta-context.cluster web-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... |
Delete the pods and services named "web" and "proxy" | Command:
```bash
kubectl delete pod,service web proxy
```
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.
Some ... |
Import the environment from the 'api-key-secret' secret and set it for the 'backend-microservice-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/api-key-secret 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 variable definitions in one o... |
Create an ingress called 'rontend-ingress' that routes requests for foo.com/example to the service 'svc1' on port 8888 | Command:
```bash
kubectl create ingress rontend-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... |
Create a debug container from the email-service-pod and copy it to a new container named dgb-img | Command:
```bash
kubectl debug email-service-pod --copy-to=dgb-img --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 default... |
Start a pod named nginx with the centos image, but modify the pod specification by providing a partial set of values parsed from the specified JSON in the --overrides flag. | Command:
```bash
kubectl run nginx --image=centos --overrides='{ "apiVersion": "v2.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] -- [COMMAN... |
create a new ExternalName service named external-identity-provider-service that points to the external name news-demo.news. | Command:
```bash
kubectl create service externalname external-identity-provider-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 refer... |
Execute the command 'gem --version' in the first container of the 'monitoring-stack-deployment' deployment and display the output. | Command:
```bash
kubectl exec deploy/monitoring-stack-deployment -- 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 deployment named "db" using the "php" image and expose port number "5000" | Command:
```bash
kubectl create deployment db --image=php --port=5000
```
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|yam... |
Listen on port 8000 on all addresses and forward the traffic to port 5000 in the 'cdn-service-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-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 criteria, a pod w... |
Forward traffic from a randomly chosen local port to port 8888 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward pod/proxy-server-pod :8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create a single ingress called 'web-ingress' that directs requests to "testing.com/example" to "svc1:9090" with a tls secret "my-cert". | Command:
```bash
kubectl create ingress web-ingress --rule="testing.com/example=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": "", "usag... |
Update the annotation 'app-version' of pod 'frontend' to '2.5.1' | Command:
```bash
kubectl annotate pods frontend app-version=2.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 than labels and include arbitrary s... |
Set the service account of the deployment "log-aggregator-deployment" to "cert-manager" | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-deployment cert-manager
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:... |
Auto scale the "backend" deployment with the number of pods between 7 and 14. | Command:
```bash
kubectl autoscale deployment backend --min=7 --max=14
```
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 "CONFIG_FILE_PATH" key from the "db-config" config map and set it as an environment variable for the "log-aggregator-deployment" deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/db-config deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
import the specific keys `external_api_url` from the `app-settings` config map and set them as environment variables for the `mydeployment` deployment. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-settings 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... |
Create a new secret named ssl-key-secret from an environment file | Command:
```bash
kubectl create secret generic ssl-key-secret --from-env-file=path/to/properties.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 bas... |
Copy the '/tmp/foo' file from the 'task-processor-pod-17' pod to the '/tmp/bar_dir' directory locally. | Command:
```bash
kubectl cp kubeapps/task-processor-pod-17:/tmp/foo /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Create an ingress called 'service-ingress' that directs requests from foo.com/example to a service named svc1 running on port 9091, using the tls certificate named "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="foo.com/example=svc1:9091,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... |
Import environment variables with a prefix 'MYSQL_' from the 'api-config' ConfigMap into the 'authentication-service-deployment' deployment | Command:
```bash
kubectl set env --from=configmap/api-config --prefix=MYSQL_ deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Get the output from running the 'jenkins-plugin-cli' command in the pod named 'proxy-server-pod' | Command:
```bash
kubectl exec proxy-server-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 t... |
Execute the 'redis-cli' command in the 'backend-pod' pod and retrieve the output. | Command:
```bash
kubectl exec backend-pod -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kub... |
Create a new config map named 'namespace-config' using the specified keys for the configurations | Command:
```bash
kubectl create configmap namespace-config --from-file=settings=/path/to/configurations/file1.txt --from-file=key2=/path/to/profiles/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 ... |
Output the modified deployment configuration in YAML format without actually making changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/gateway-deployment MONGO_URI=mongodb://localhost:27017/mydb -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Get the output from the stardust-shuttle container within the web-app-pod | Command:
```bash
kubectl attach web-app-pod -c stardust-shuttle
```
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,... |
Retrieve the logs from the container 'log-aggregator-deployment-1' of the deployment 'proxy-service-pod' | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c proxy-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags... |
Execute the 'geth' command in the backend-pod and provide the output. | Command:
```bash
kubectl exec backend-pod -- geth
```
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.kubernet... |
Forward port 8088 on all addresses to port 8000 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8088: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 wi... |
Create a debug copy of the media-stream-pod by adding a debug container and changing container images | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-api --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 objec... |
Scale a resource to a specific number of replicas by specifying the number in the command. | Command:
```bash
kubectl scale --replicas=7 -f preferences.yaml
```
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 specified, it is val... |
Copy the file '/tmp/foo' from the 'backend-pod-13' pod to the '/etc/kubernetes' directory locally | Command:
```bash
kubectl cp velero/backend-pod-13:/tmp/foo /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 the kubec... |
Create a pod disruption budget named frontend-pdb that will select all pods with the tier=frontend label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget frontend-pdb --selector=tier=frontend --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--... |
Add a taint with key 'datacenter' on nodes labeled 'owner=john-doe' | Command:
```bash
kubectl taint node -l owner=john-doe datacenter=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": "", "usag... |
Create a copy of the chat-app-pod by adding a debug container and changing the container images | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=dgb-img --image=debian --set-image=worker=my-custom-worker:1.2.3,cache=redis:alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resour... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/chat-app-pod :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 automatic... |
Begin streaming logs from all containers in pods with the label component=proxy | Command:
```bash
kubectl logs -f -l component=proxy --all-containers=true
```
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": "--con... |
Copy the local file `~/.config/kube` to `/tmp/bar` in the remote pod `file-server-pod-14` in the `openfaas` namespace. | Command:
```bash
kubectl cp ~/.config/kube openfaas/file-server-pod-14::/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... |
View the snapshot logs from the container "database-pod-1" of the deployment named "scheduler-app-deployment" | Command:
```bash
kubectl logs deployment/scheduler-app-deployment -c database-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fla... |
Create a deployment named "grafana" using the NGINX image and provide the command "-t" to the NGINX container. | Command:
```bash
kubectl create deployment grafana --image=nginx -- nginx -t
```
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: j... |
Open the proxy-service service for editing using the sublime editor | Command:
```bash
KUBE_EDITOR="sublime" 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 variable... |
Create a pod running an Alpine image with port 8089 exposed | Command:
```bash
kubectl run hazelcast --image=alpine --port=8089
```
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": "--f... |
Create a job named "audit-job" using the image "confluentinc/cp-kafka" and the command "kafka-topics --list" | Command:
```bash
kubectl create job audit-job --image=confluentinc/cp-kafka -- kafka-topics --list
```
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": "", "usa... |
Create a cluster role named "admin_role" with the ability to update configmaps and specific resource names. | Command:
```bash
kubectl create clusterrole admin_role --verb=update --resource=configmaps --resource-name=app-worker-2 --resource-name=web-frontend
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.