prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a service for the hazelcast deployment, which serves on port 9092 and connects to the containers on port 808300 | Command:
```bash
kubectl expose deployment hazelcast --port=9092 --target-port=808300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Forward port 5432 on localhost and IP address 10.19.21.23 to port 9090 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 5432: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 criter... |
Create a service for the replication controller specified in "python-controller.yaml" file, serving on port 8088 and connecting to the containers on port 808300. | Command:
```bash
kubectl expose -f python-controller.yaml --port=8088 --target-port=808300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Create a new ClusterIP service named catalog-service-clusterip | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=8181:8080
```
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"... |
Execute the command 'kafka-console-producer --broker-list localhost:9092 --topic test' inside the first container of the 'payment-service' service and retrieve the output. | Command:
```bash
kubectl exec svc/payment-service -- kafka-console-producer --broker-list localhost:9092 --topic test
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default"... |
View the last 20 lines of the log output for the pod named "payment-gateway-pod" | Command:
```bash
kubectl logs --tail=20 payment-gateway-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "shor... |
Add a taint to a specific node with a key, value, and effect. | Command:
```bash
kubectl taint nodes prod-node-5 special=backup: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. On... |
Forward local port 5000 to port 6379 in the pod 'proxy-server-pod' | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5000: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 a... |
Create a new config map called 'monitoring-config' using the files '/path/to/parameters/file1.txt' and '/path/to/preferences/file2.txt' as the values for the keys 'settings' and 'key2' respectively. | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/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 ... |
Set the certificate authority data for the "moon-cluster" cluster entry | Command:
```bash
kubectl config set-cluster moon-cluster --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-... |
Update the environment variables of the specified deployment with keys imported from the config map | Command:
```bash
kubectl set env --keys=log_level --from=configmap/api-config 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 defi... |
Rename the context 'testing-context' to 'service-account-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context testing-context service-account-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this fiel... |
Scale the 'frontend-rs' replica set to 3 replicas. | Command:
```bash
kubectl scale --replicas=3 rs/frontend-rs
```
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 validate... |
Copy the local file ~/.config/kube to the remote pod named worker-pod-4 in the velero namespace, and place it in the /tmp/bar directory. | Command:
```bash
kubectl cp ~/.config/kube velero/worker-pod-4::/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... |
Port forward service "analytics-service" to local port 9090, targeting the "https" port specified in the service | Command:
```bash
kubectl port-forward service/analytics-service 9090: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 sele... |
Forward port 8088 on your local machine to the targetPort of the "https" port in a pod selected by the "api-service" service | Command:
```bash
kubectl port-forward service/api-service 8088: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... |
Forward local port 6379 to port 8081 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 6379: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... |
Copy the file "foo" from the local machine to the "/tmp/bar" directory in the "message-broker-pod-15" pod in the "cert-manager" namespace. | Command:
```bash
kubectl cp :/tmp/foo cert-manager/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 th... |
import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/global-config 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 vari... |
Create a secret named "oauth-secret" using values from an environment file | Command:
```bash
kubectl create secret generic oauth-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 basename of... |
Create a job named 'batch-processing' using the 'mysql' image. The job should run the command 'mysql --version'. | Command:
```bash
kubectl create job batch-processing --image=mysql -- mysql --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output ... |
Set the CPU limits of the Redis container in the deployment to "1" and the memory limits to "256Mi" | Command:
```bash
kubectl set resources deployment redis -c=nginx --limits=cpu=1,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 requested, but may burst up to it... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-name-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Update the annotation 'team' of pod 'cdn' with the value 'frontend-team', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods cdn team='frontend-team'
```
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 a... |
Create a pod disruption budget named messaging-pdb that selects all pods with the component=web label and requires a minimum of four of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget messaging-pdb --selector=component=web --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 [-... |
Update the annotation 'env' of the pod 'cdn' with the value 'staging', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods cdn env='staging'
```
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 arbitrar... |
Create a cron job called "log-rotation" that runs the command "nginx" every minute using the nginx image. | Command:
```bash
kubectl create cronjob log-rotation --image=nginx --schedule="*/1 * * * *" -- nginx
```
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", "defa... |
Create a new config map named app-settings with keys "conf" and "data" from the specified file paths. | Command:
```bash
kubectl create configmap app-settings --from-file=conf=/path/to/settings/file1.txt --from-file=data=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a conf... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/payment-gateway-secret deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod ... |
Create a new config map named api-config with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/configs/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 creating... |
Retrieve logs from the container "auth-service-pod-1" in the deployment "authentication-service-deployment" | Command:
```bash
kubectl logs deployment/authentication-service-deployment -c auth-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]`
Helpfu... |
Forward local port to a specific port in a pod | Command:
```bash
kubectl port-forward pod/frontend-pod :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 be selected automatic... |
Create a new service that maps to an external domain name | Command:
```bash
kubectl create service externalname external-messaging-service --external-name sample-domain.net
```
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 ... |
Import the LOG_LEVEL key from the app-config config map and set it as an environment variable for the email-server-deployment deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions ... |
Create an ingress called 'app2-ingress' that directs requests to foo.com/module to the service svc1 on port 8082 | Command:
```bash
kubectl create ingress app2-ingress --rule="foo.com/module=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": ... |
Check if you have permission to list the job named "security-scan-job" in the "logging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/security-scan-job -n logging
```
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 ... |
Execute the 'go run hello.go' command in the quantum-quark container of the auth-service-pod pod and display the output. | Command:
```bash
kubectl exec auth-service-pod -c quantum-quark -- go run hello.go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
Update the CPU and memory limits for the golang container in the deployment to "2" and "2Gi" respectively | Command:
```bash
kubectl set resources deployment golang -c=nginx --limits=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, but may burst up to its... |
Return the logs from the container 'log-aggregator-pod-1' of the deployment 'web-app-deployment' | Command:
```bash
kubectl logs deployment/web-app-deployment -c log-aggregator-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... |
Forward local ports 3000 and 6000 to ports 5432 and 6000 respectively in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 3000 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 be selected... |
Forward traffic from a local port to port 5432 in the e-commerce-pod | Command:
```bash
kubectl port-forward pod/e-commerce-pod :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 be selected automat... |
Update the annotation 'custom-label' of pod 'security' with the value 'my-custom-value', even if the annotation already exists. | Command:
```bash
kubectl annotate --overwrite pods security custom-label='my-custom-value'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than label... |
Create an ingress resource named 'app-ingress' that directs requests to the service 'svc1:3306' for the 'website.com/module' URL, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress app-ingress --rule="website.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... |
Watch the rollout status of the deployment "namespace-3" | Command:
```bash
kubectl rollout status deployment/namespace-3
```
What it does:
Show the status of the rollout.
By default 'rollout status' will watch the status of the latest rollout until it's done. If you don't want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts... |
Forward local port 5000 to pod port 9090 | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5000: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... |
Import the debug_mode key from the log-config config map and set it as an environment variable in the scheduler-app-deployment deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/log-config 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 definition... |
Create a pod disruption budget named load-balancer-pdb that will select all pods with the component=web label and require a minimum of four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=component=web --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=... |
Add a taint with key 'hardware' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta hardware=gpu-node-12: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... |
Increase the number of replicas for the deployment named foo to 5, if its current size is 3. | Command:
```bash
kubectl scale --current-replicas=3 --replicas=5 deployment/foo
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
Import the keys "smtp_server" from the config map "kube-system-config" into the deployment "monitoring-stack-deployment". | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/kube-system-config deployment/monitoring-stack-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... |
Create a new secret named 'ssh-key-secret' with the specified keys | Command:
```bash
kubectl create secret generic ssh-key-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
```
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 ... |
Create a service for the replicated python using a replica set | Command:
```bash
kubectl expose rs python --port=8010 --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.... |
Forward port 8888 on your local machine to port 8888 in the 'frontend-pod' pod | Command:
```bash
kubectl port-forward pod/frontend-pod 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 will be selected autom... |
Return the logs from the container 'payment-gateway-pod-1' of the deployment named 'log-aggregator-deployment' | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c payment-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 fla... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-settings deployment/payment-processor-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 ... |
Open the `db-service` service for editing using the "code" editor | Command:
```bash
KUBE_EDITOR="code" kubectl edit svc/db-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, or ... |
Start streaming the logs of the 'time-machine' container in the 'monitoring-pod' pod | Command:
```bash
kubectl logs -f -c time-machine monitoring-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 local port 8888 to port 5432 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward pod/web-app-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 criteria, a pod will be selected automa... |
Create a new config map named 'app-config' using the files in the 'configs' folder | Command:
```bash
kubectl create configmap app-config --from-file=path/to/configs
```
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 basename of... |
Create a new NodePort service named proxy-service-nodeport | Command:
```bash
kubectl create service nodeport proxy-service-nodeport --tcp=6379:8088
```
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... |
Begin streaming the logs of the code-explorer container in the security-service-pod pod | Command:
```bash
kubectl logs -f -c code-explorer security-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": "--contai... |
Forward traffic from port 3000 on all addresses to port 8088 in the analytics-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-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 wil... |
Start a pod named 'hazelcast' using the python image, and expose port 3306 in the container. | Command:
```bash
kubectl run hazelcast --image=python --port=3306
```
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... |
Start the mongo pod using the 'mongo' image and customize the command arguments with <arg1>, <arg2>, ..., <argN> | Command:
```bash
kubectl run nginx --image=mongo -- <arg1> <arg2> ... <argN>
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"... |
Create an ingress resource called 'api-v2-ingress' that directs requests for 'testing.com/example' to the service 'svc1' on port 6379, using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress api-v2-ingress --rule="testing.com/example=svc1:6379,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Execute the 'mongo --version' command in the stardust-shuttle container of the gateway-pod pod. | Command:
```bash
kubectl exec gateway-pod -c stardust-shuttle -- mongo --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 om... |
Display the most recent 23 lines of logs for the pod named "api-service-pod" | Command:
```bash
kubectl logs --tail=23 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", "short": ... |
Copy the local directory '/tmp/foo_dir' to the '/etc/kubernetes_dir' directory in the 'database-pod-2' pod in the 'default' namespace. | Command:
```bash
kubectl cp :/tmp/foo_dir database-pod-2:/etc/kubernetes_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 kub... |
Set the cluster field in the 'my-context' context to 'staging-cluster' | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster staging-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 valu... |
Create a single ingress called 'default-ingress' that directs requests to testing.com/example to svc1:9092 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="testing.com/example=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Set the service account of the deployment "payment-processor-deployment" to "jenkins" | Command:
```bash
kubectl set serviceaccount deployment payment-processor-deployment jenkins
```
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:
`... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ file locally and paste it to the /tmp/bar directory on the admin-dashboard-pod-16 pod, specifically in the auth-service container. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ admin-dashboard-pod-16::/tmp/bar -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": "", "u... |
Set the service account of the "frontend-deployment" deployment to "kube-scheduler" | Command:
```bash
kubectl set serviceaccount deployment frontend-deployment kube-scheduler
```
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:
`ku... |
Create a service for a replicated node, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rc node --port=3001 --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 specified port. A... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/cert-manager-secret deployment/payment-processor-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... |
Forward local port 8080 to port 8081 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 8080:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a new ClusterIP service named backend-service-clusterip that maps port 8010 of the service to port 8088 of the backend pods. | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=8010:8088
```
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 traffic from port 9090 on localhost and IP 10.19.21.23 to port 5432 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 p... |
Set the cluster field of a specific context to a certain cluster name | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster cluster-alpha
```
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 ... |
Update node 'prod-node-5' with a taint with key 'cpu-type' and value 'x86' and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes prod-node-5 cpu-type=x86: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 ... |
Create a job named "deployment-rollout-job" with the image "wordpress", and run the command "mysql --version" within the job. | Command:
```bash
kubectl create job deployment-rollout-job --image=wordpress -- mysql --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Forward local ports to a pod | Command:
```bash
kubectl port-forward pod/e-commerce-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 will be selected aut... |
Start a pod named "hazelcast" using the postgres image, and expose port 9091 on the container | Command:
```bash
kubectl run hazelcast --image=postgres --port=9091
```
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": "-... |
Import environment variables starting with the prefix "MYSQL_" from the config map named "api-config" and apply them to the "frontend-deployment" deployment. | Command:
```bash
kubectl set env --from=configmap/api-config --prefix=MYSQL_ 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 on... |
Forward local port 6379 to port 8000 in the web-app-pod pod | Command:
```bash
kubectl port-forward pod/web-app-pod 6379: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... |
Set the CPU limits for the 'hazelcast' container in the 'hazelcast' deployment to '50m' and the memory limits to '2Gi' | Command:
```bash
kubectl set resources deployment hazelcast -c=nginx --limits=cpu=50m,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, but may burst up t... |
Copy the local file at ~/.config/kube to the remote pod named payment-gateway-pod-19 in the container named security-scanner, and place it at /tmp/bar | Command:
```bash
kubectl cp ~/.config/kube payment-gateway-pod-19::/tmp/bar -c security-scanner
```
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 o... |
List deployments in YAML output format, in the "beta-1.0" version of the "beta-apps" API group | Command:
```bash
kubectl get deployments.beta-1.0.beta-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 wil... |
Create a new ClusterIP service named shipping-service-clusterip listening on port 8082 and forwarding traffic to port 8181. | Command:
```bash
kubectl create service clusterip shipping-service-clusterip --tcp=8082:8181
```
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... |
List the replication controller "web", the service "media-stream-rc", and the pod "gateway-pod". | Command:
```bash
kubectl get rc/web service/media-stream-rc pods/gateway-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespace... |
Delete the pods and services with the names "payment" and "foo" | Command:
```bash
kubectl delete pod,service payment foo
```
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.
Som... |
Start streaming the logs of the "time-machine" container in the "gateway-pod" pod | Command:
```bash
kubectl logs -f -c time-machine gateway-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sho... |
List the container name and image of a specific pod | Command:
```bash
kubectl get pod proxy-server-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 ... |
Update the pod named 'proxy' with the label 'env' set to 'staging' | Command:
```bash
kubectl label pods proxy env=staging
```
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 ... |
update the pod 'log-aggregator' with the annotation 'alert-email' and set its value to 'alerts@example.com' | Command:
```bash
kubectl annotate pods log-aggregator alert-email=alerts@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 labels and ... |
Start a new pod named "hazelcast" using the Redis image, and expose port 9090 from the container. | Command:
```bash
kubectl run hazelcast --image=redis --port=9090
```
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... |
Scale the resource specified in the "settings.json" file to 7 replicas | Command:
```bash
kubectl scale --replicas=7 -f settings.json
```
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 valida... |
Create a new nginx pod with the custom arguments for the default command. Use the nginx image. | Command:
```bash
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
```
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:
"... |
Embed the certificate authority data for the cluster-alpha cluster entry. | Command:
```bash
kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/galaxy-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 ... |
Import the CONFIG_FILE_PATH key from the app-config-prod config map to the gateway-deployment deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config-prod 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 defin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.