prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward local ports 8888 and 6000 to ports 8888 and 6000 in a selected pod of the 'search-engine-deployment' deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8888 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 wil... |
Set the certificate-authority-data field on the 'prod-cluster' cluster with the provided base64 encoded certificate data | Command:
```bash
kubectl config set clusters.prod-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
```
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 ... |
Create a secret named private-key-secret from an environment file | Command:
```bash
kubectl create secret generic private-key-secret --from-env-file=path/to/options.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 ba... |
List deployments in YAML output format, using the "beta-1.0" version of the "apps" API group. | Command:
```bash
kubectl get deployments.beta-1.0.apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will onl... |
Delete the pods and services with the names "vpn" and "media-stream" | Command:
```bash
kubectl delete pod,service vpn media-stream
```
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... |
Enable the OpenID Connect auth provider for the "saas-admin" entry with additional arguments | Command:
```bash
kubectl config set-credentials saas-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
```
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:
--... |
Create a new ExternalName service named external-messaging-service that points to the external host named mockup-cloud.cloud | Command:
```bash
kubectl create service externalname external-messaging-service --external-name mockup-cloud.cloud
```
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... |
Check if the current user has the permission to list the cron-job job in the kube-public namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cron-job -n kube-public
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that ... |
Create a new config map named global-config using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap global-config --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creatin... |
Set the cluster field of the testing-context context to moon-cluster | Command:
```bash
kubectl config set contexts.testing-context.cluster moon-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 ... |
Remove the label named 'bar' from the pods with the name 'analytics' | Command:
```bash
kubectl label pods analytics 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": "If tru... |
Get the output from the astro-container within the web-app-pod | Command:
```bash
kubectl attach web-app-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, ... |
Create a copy of the "monitoring-pod" pod, replacing the command of the "lunar-launcher" container with a shell session. | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-web --container=lunar-launcher -- 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... |
Remove a particular taint from a node | Command:
```bash
kubectl taint nodes k8s-node-1 hardware:NoExecute-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Create a deployment named my-dep that runs the node image and exposes port 5432. | Command:
```bash
kubectl create deployment my-dep --image=node --port=5432
```
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... |
Display the most recent 23 lines of logs for a specific pod | Command:
```bash
kubectl logs --tail=23 log-aggregator-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 resource limits for a specific container in a deployment | Command:
```bash
kubectl set resources deployment runtime -c=nginx --limits=cpu=200m,memory=128Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up ... |
Run the 'python --version' command in the first container of the 'search-service' service. | Command:
```bash
kubectl exec svc/search-service -- python --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 t... |
Get the output from running the command '/bin/bash -c "echo 'Hello, Amazon Linux'"' within the quantum-quark container from the pod named proxy-service-pod. | Command:
```bash
kubectl exec proxy-service-pod -c quantum-quark -- /bin/bash -c "echo 'Hello, Amazon Linux'"
```
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": "", "u... |
Forward traffic from local ports 8080 to 9090, and 6000 to 6000, to a pod selected by the 'api-server-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8080 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 b... |
Attach to the pod 'mypod' and interact with the 'lunar-launcher' container | Command:
```bash
kubectl attach mypod -c lunar-launcher -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Create a new secret named 'app-config-secret' from the environment file located at 'path/to/data.env' | Command:
```bash
kubectl create secret generic app-config-secret --from-env-file=path/to/data.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 basena... |
Retrieve the logs of the previous terminated cosmic-container container from the payment-gateway-pod pod. | Command:
```bash
kubectl logs -p -c cosmic-container payment-gateway-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--cont... |
Update the deployment 'database-deployment' with a new environment variable named JWT_SECRET | Command:
```bash
kubectl set env deployment/database-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 tem... |
Create an autoscaling policy for the 'cdn' replication controller | Command:
```bash
kubectl autoscale rc cdn --max=5 --cpu-percent=90
```
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... |
Start streaming the logs of the 'quantum-quark' container in the 'proxy-service-pod' pod. | Command:
```bash
kubectl logs -f -c quantum-quark proxy-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container... |
Set the service account of the deployment 'order-processing-deployment' to 'istio' | Command:
```bash
kubectl set serviceaccount deployment order-processing-deployment istio
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kub... |
Create a cluster role named "admin_role" with NonResourceURL specified | Command:
```bash
kubectl create clusterrole "admin_role" --verb=create --non-resource-url=/debug/pprof/*
```
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": "--out... |
Forward port 8081 on your local machine to port 8000 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward pod/backend-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 automa... |
Create a service for the replication controller specified in the "wordpress-controller.yaml" file | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=3000 --target-port=909200
```
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 ... |
Import specific keys from a config map for a deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/log-config 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 definition... |
Get the logs from the container "cdn-service-pod-1" of the deployment "authentication-service-deployment". | Command:
```bash
kubectl logs deployment/authentication-service-deployment -c cdn-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... |
Describe a specific pod or a pod managed by a load balancer | Command:
```bash
kubectl describe pods/load-balancer
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide ... |
Start a pod named "hazelcast" using the "centos" image and expose port 8000 within the container. | Command:
```bash
kubectl run hazelcast --image=centos --port=8000
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Get the output from running the 'docker run ubuntu echo "Hello, World"' command in the first container of the first pod of the web-service service. | Command:
```bash
kubectl exec svc/web-service -- docker run ubuntu echo "Hello, World"
```
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.... |
Forward local port 8888 to the targetPort of the "https" port in a pod selected by the "api-service" service. | Command:
```bash
kubectl port-forward service/api-service 8888: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 a... |
Create a deployment named 'prometheus' using the 'wordpress' image and expose port 8010 | Command:
```bash
kubectl create deployment prometheus --image=wordpress --port=8010
```
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. On... |
Expose a service for a replication controller specified in a YAML file with the given port and target port | Command:
```bash
kubectl expose -f python-controller.yaml --port=9092 --target-port=808100
```
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... |
Switch to raw terminal mode and attach to the "cyber-sleuth" container of the "mypod" pod | Command:
```bash
kubectl attach mypod -c cyber-sleuth -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Listen on port 8888 on all addresses and forward the traffic to port 9090 in the 'api-service-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8888: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 w... |
Delete the pods and services named "vpn" and "monitoring" | Command:
```bash
kubectl delete pod,service vpn monitoring
```
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.
... |
Create a cluster role named "reader" with the ability to update specific configmaps named "payment-processor" and "error-logger" | Command:
```bash
kubectl create clusterrole reader --verb=update --resource=configmaps --resource-name=payment-processor --resource-name=error-logger
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server... |
Forward port 8081 on all addresses to port 8080 in the mypod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8081:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Change the service account of the 'backend-microservice-deployment' deployment to 'tekton'. | Command:
```bash
kubectl set serviceaccount deployment backend-microservice-deployment tekton
```
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 replication controller "media-stream" with a target CPU utilization of 20% | Command:
```bash
kubectl autoscale rc media-stream --max=6 --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... |
Create a pod disruption budget named notification-service-pdb that will select all pods with the tier=frontend label and require at least 9 of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=tier=frontend --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-ava... |
delete pods and services named "web" and "auth" | Command:
```bash
kubectl delete pod,service web auth
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
Some r... |
Remove taint from node 'backup-node-14' with key 'cpu-type' and effect 'NoSchedule' if present. | Command:
```bash
kubectl taint nodes backup-node-14 cpu-type: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 ... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/ui-config deployment/cache-cluster-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... |
Copy the ~/.config/kube file from your local machine to the /tmp/bar directory inside the security-scanner-pod-18 pod in the kubeapps namespace. | Command:
```bash
kubectl cp ~/.config/kube kubeapps/security-scanner-pod-18:/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... |
Import the environment variables from the aws-credentials-secret secret to the web-app-deployment deployment. | Command:
```bash
kubectl set env --from=secret/aws-credentials-secret deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or mor... |
Start streaming the logs of the "time-machine" container in the pod named "api-service-pod" | Command:
```bash
kubectl logs -f -c time-machine api-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", ... |
Forward traffic from local port 8000 to port 6379 in the pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8000:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Set the resource requests and limits for all containers in the hazelcast deployment | Command:
```bash
kubectl set resources deployment hazelcast --limits=cpu=200m,memory=512Mi --requests=cpu=500m,memory=512Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource re... |
Execute the 'mongo' command inside the 'e-commerce-pod' pod, using the first container by default, and retrieve the output | Command:
```bash
kubectl exec e-commerce-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.kube... |
Execute the 'jenkins-plugin-cli' command on the first pod of the 'gateway-deployment' deployment to retrieve the output. | Command:
```bash
kubectl exec deploy/gateway-deployment -- 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 omitt... |
Set a custom TLS server name for the cluster-alpha cluster entry in the kubeconfig file. | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=data-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] [--certificat... |
Set the certificate authority data for the "moon-cluster" cluster | Command:
```bash
kubectl config set clusters.moon-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
```
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 ... |
Create a service for the replication controller specified in the "php-controller.yaml" file, which will serve on port 8088 and connect to the containers on port 300100. | Command:
```bash
kubectl expose -f php-controller.yaml --port=8088 --target-port=300100
```
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... |
list specific resources by their types and names | Command:
```bash
kubectl get rc/web service/api-service-rc pods/cdn-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 namesp... |
Add a taint with the key 'cpu-type' on nodes that have the label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack cpu-type=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": "", "usa... |
Import specific keys from a config map into a deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/ui-config 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 de... |
Add a taint with key 'zone' and value 'prod-node-5:PreferNoSchedule' on nodes having the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production zone=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": "", "usag... |
Execute the 'mysql' command in the 'astro-container' container from the 'e-commerce-pod' pod and retrieve the output. | Command:
```bash
kubectl exec e-commerce-pod -c astro-container -- 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, u... |
Show the resource usage metrics for the pods that have the label 'zone' set to 'us-east-1' | Command:
```bash
kubectl top pod -l zone=us-east-1
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl top pod [NAME | ... |
Import the SMTP_SERVER key from the 'app-name-config' ConfigMap and set it as an environment variable in the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-name-config deployment/cache-cluster-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... |
Forward local port 3000 to port 8088 in the frontend-pod pod | Command:
```bash
kubectl port-forward pod/frontend-pod 3000: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 autom... |
Import the environment from the encryption-key-secret secret into the authentication-service-deployment deployment | Command:
```bash
kubectl set env --from=secret/encryption-key-secret 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 definitions... |
Create a new ClusterIP service named catalog-service-clusterip with a TCP port mapping from 8081 on the service to 8084 on the pods. | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=8081:8084
```
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"... |
forward the local port 9090 to the 8081 port of the pod/frontend-pod pod. | Command:
```bash
kubectl port-forward pod/frontend-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 autom... |
Get output from running the 'geth attach' command in code-explorer from the pod named api-service-pod | Command:
```bash
kubectl exec api-service-pod -c code-explorer -- 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 omitt... |
Import the 'redis_host' key from the 'app-secrets' config map into the 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-secrets deployment/gateway-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 ... |
Create a service for the wordpress replication controller using the configuration specified in the "wordpress-controller.yaml" file | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=7000 --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 ... |
Listen on a random port locally and forward it to the pod 'chat-app-pod' on port 6379 | Command:
```bash
kubectl port-forward pod/chat-app-pod :6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automatic... |
Create an ingress named 'private-api-ingress' that routes requests from testing.com/example to the service svc1:8181 with the TLS secret named "my-cert" | Command:
```bash
kubectl create ingress private-api-ingress --rule="testing.com/example=svc1:8181,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Forward local port 9090 to port 9090 in the email-server deployment pod. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 9090 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Forward traffic from local port 3000 to port 6379 in the e-commerce-pod. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 3000:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Create a new secret named tls-certificate-secret with two key-value pairs: key1=supersecret and key2=topsecret | Command:
```bash
kubectl create secret generic tls-certificate-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
```
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, ... |
Create a deployment named 'monitoring' using the 'php' image and expose port 9092. | Command:
```bash
kubectl create deployment monitoring --image=php --port=9092
```
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: ... |
Create a service for the replicated python using the replica set 'python' that serves on port 3000 and connects to the containers on port 8000. | Command:
```bash
kubectl expose rs python --port=3000 --target-port=8000
```
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... |
Copy the directory "/tmp/foo_dir" from the remote pod "api-server-pod-3" in the "istio-system" namespace to the local directory "/tmp/bar_dir". | Command:
```bash
kubectl cp istio-system/api-server-pod-3:/tmp/foo_dir /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 ... |
Update the image of all containers in the daemonset named "test" to "java:11.0.12". | Command:
```bash
kubectl set image daemonset test *=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:
`kubect... |
Auto scale the deployment "gateway" with a minimum of 2 pods and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment gateway --min=2 --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 mydeployment deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/db-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in on... |
Add a taint with key 'app' and value 'k8s-node-1:PreferNoSchedule' on nodes having label 'owner=john-doe' | Command:
```bash
kubectl taint node -l owner=john-doe app=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outpu... |
Add a taint with the key 'datacenter' and the value 'worker-node-3:PreferNoSchedule' on nodes that have the label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel 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": "", "usage": "Ou... |
Import specific keys from a config map into an environment variable for a deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config-prod deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Create a job named 'indexing' with the 'alpine' image, and execute the 'sleep 3600' command. | Command:
```bash
kubectl create job indexing --image=alpine -- sleep 3600
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Add a taint with the key 'special' on nodes that have the label namespace=mynamespace | Command:
```bash
kubectl taint node -l namespace=mynamespace special=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": "", "usag... |
Create a deployment named "my-dep" using the Jenkins image and expose port 9092. | Command:
```bash
kubectl create deployment my-dep --image=jenkins --port=9092
```
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: ... |
Create a config map named app-name-config with the specified keys and corresponding values specified in the files. | Command:
```bash
kubectl create configmap app-name-config --from-file=settings=/path/to/configurations/file1.txt --from-file=key2=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When c... |
List deployments in YAML output format, using the "legacy-1.0.0" version of the "apps" API group | Command:
```bash
kubectl get deployments.legacy-1.0.0.apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will... |
Create a role named "view" with the following permissions: | Command:
```bash
kubectl create role view --verb=connect --resource=pods --resource-name=file-storage --resource-name=image-processor
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|c... |
Check if you have permission to list the job named "virus-scan-job" in the "namespace-1" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/virus-scan-job -n namespace-1
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL... |
Create an ingress resource named 'private-ingress' with a rule that directs requests from foo.com/bar to svc1:9000, and uses the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress private-ingress --rule="foo.com/bar=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": ... |
Copy the local file "/tmp/foo" to the remote pod "message-broker-pod-15" in the "logging" namespace, and save it as "/tmp/bar". | Command:
```bash
kubectl cp :/tmp/foo logging/message-broker-pod-15::/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 ku... |
Add a taint with key 'disktype' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 disktype=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Update the 'analytics-platform-deployment' deployment by adding a new environment variable named ENV with the value prod | Command:
```bash
kubectl set env deployment/analytics-platform-deployment ENV=prod
```
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 templates (... |
Scale the deployment named db-migration-replicaset's current size to 7 replicas | Command:
```bash
kubectl scale --current-replicas=1 --replicas=7 deployment/db-migration-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 --reso... |
Partially update a node's configuration by patching it with a new password. | Command:
```bash
kubectl patch -f node-config.toml -p '{"stringData":{"password":"new-password"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.