prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
create a service for the replication controller specified in "ruby-controller.yaml", serving on port 5000 and connecting to the containers on port 500000 | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=5000 --target-port=500000
```
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 s... |
Set the custom TLS server name 'staging-cluster' for the 'cluster-alpha' cluster entry. | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=staging-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifi... |
Retrieve the previous terminated logs of the container named "mycontainer" from the pod named "proxy-server-pod" | Command:
```bash
kubectl logs -p -c mycontainer 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", ... |
Create a new config map named app-config with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap app-config --from-file=conf=/path/to/options/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 creating a config... |
Execute the 'redis-server' command in the first container of the 'database-deployment' deployment. | Command:
```bash
kubectl exec deploy/database-deployment -- redis-server
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/kube-system-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 varia... |
Set custom TLS server name for a cluster | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=kube-cluster-1
```
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... |
Expose the ubuntu deployment as a service on port 8083, connecting to the containers on port 808000. | Command:
```bash
kubectl expose deployment ubuntu --port=8083 --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 specifi... |
Expose a replicated centos container on port 80 | Command:
```bash
kubectl expose rc centos --port=8089 --target-port=500000
```
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.... |
Copy the local file ~/.config/kube to the remote pod front-end-pod-12 in the container load-balancer at the path /tmp/bar | Command:
```bash
kubectl cp ~/.config/kube front-end-pod-12::/tmp/bar -c load-balancer
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
create an ingress named 'api-ingress' that directs requests from "testing.com/example" to "svc1:7000" with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="testing.com/example=svc1:7000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
create a cron job named 'monthly-audit' with an image of 'golang' that runs the command 'go version' every minute. | Command:
```bash
kubectl create cronjob monthly-audit --image=golang --schedule="*/1 * * * *" -- go version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Create a cluster role named "admin_role" with ResourceName specified for the "dev-database" and "cdn-proxy" resources with create permission for pods. | Command:
```bash
kubectl create clusterrole admin_role --verb=create --resource=pods --resource-name=dev-database --resource-name=cdn-proxy
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|no... |
Create a new config map named env-vars using the specified keys and file paths | Command:
```bash
kubectl create configmap env-vars --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a... |
Create a job named "data-migration-job" using the image "mcr.microsoft.com/dotnet/core/runtime" | Command:
```bash
kubectl create job data-migration-job --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-sdks
```
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": "... |
Execute the 'kafka-server-start /etc/kafka/server.properties' command in the 'nano-bot' container of the 'frontend-pod' pod and display the output | Command:
```bash
kubectl exec frontend-pod -c nano-bot -- kafka-server-start /etc/kafka/server.properties
```
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... |
Forward local port 8088 to port 3000 in the pod "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 8088 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... |
Set the service account for the deployment named "payment-processor-deployment" to "vault" | Command:
```bash
kubectl set serviceaccount deployment payment-processor-deployment vault
```
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... |
Add a taint with the key 'special' on nodes having the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend special=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... |
Copy the file /tmp/foo from your local machine to /tmp/bar in the remote pod named backend-pod-13 in the namespace openfaas. | Command:
```bash
kubectl cp /tmp/foo openfaas/backend-pod-13:/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.ku... |
Scale the 'web' deployment's size from 7 replicas to 1 replica | Command:
```bash
kubectl scale --current-replicas=7 --replicas=1 deployment/web
```
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... |
Return the snapshot logs from the 'email-service-pod-1' container of the 'search-engine-deployment' deployment. | Command:
```bash
kubectl logs deployment/search-engine-deployment -c email-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:... |
Import environment variables from a secret and set them for a deployment | Command:
```bash
kubectl set env --from=secret/ssl-key-secret deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one o... |
List the pod specified in "settings.yaml" in JSON output format | Command:
```bash
kubectl get -f settings.yaml -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see res... |
Run a golang pod with specified labels | Command:
```bash
kubectl run hazelcast --image=golang --labels="app=golang,env=prod"
```
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 ... |
Create a pod disruption budget that selects all pods with the "app=rails" label and requires a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=app=rails --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=... |
Create a new ClusterIP service named 'api-service-clusterip' with a TCP port mapping of 3001 to 8888. | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=3001:8888
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Forward local port 3000 to port 9090 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 3000: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 auto... |
Add the label 'role=cache' to the pod named 'email'. | Command:
```bash
kubectl label pods email role=cache
```
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 t... |
Forward port 3000 on all addresses to port 8888 in the "frontend-pod" pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 3000: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... |
Copy the file /tmp/foo from the worker-pod-4 pod in the kube-node-lease namespace to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp kube-node-lease/worker-pod-4::/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 ... |
Set the cluster field in the my-context context to staging-cluster. | Command:
```bash
kubectl config set contexts.cluster-2-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 value... |
Output the modified YAML definition of the 'notification-handler-deployment' deployment by setting the 'SECRET_KEY' environment variable to 'your-secret-key' | Command:
```bash
kubectl set env deployment/notification-handler-deployment SECRET_KEY=your-secret-key -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 in... |
Copy a file from your local machine to a remote pod | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ monitoring/ingress-controller-pod-8::/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": "", "usag... |
Configure autoscaling for the deployment named "monitoring" | Command:
```bash
kubectl autoscale deployment monitoring --min=4 --max=13
```
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 u... |
Open a raw terminal connection to the astro-container in the vpn-service-pod and send stdin to 'bash', while receiving stdout/stderr from 'bash' back to the client | Command:
```bash
kubectl attach vpn-service-pod -c astro-container -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... |
Create a job named security-scan-job using the nginx image. The job should run the command "nginx -g 'daemon off;'" | Command:
```bash
kubectl create job security-scan-job --image=nginx -- nginx -g "daemon off;"
```
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": ... |
Copy the local file "/tmp/foo" to the remote pod "monitoring-agent-pod-6" in the "ingress-nginx" namespace, and save it as "/tmp/bar". | Command:
```bash
kubectl cp /tmp/foo ingress-nginx/monitoring-agent-pod-6:/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Forward traffic from port 8081 on localhost and IP 10.19.21.23 to port 6379 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 8081: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 cr... |
Start port forwarding from port 6379 on all addresses to port 5432 in the backend-pod pod. Listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 6379: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 ... |
Embed the certificate authority data for the data-cluster cluster entry by running the command: | Command:
```bash
kubectl config set-cluster data-cluster --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 s... |
Begin streaming the logs of the 'quantum-quark' container in the 'auth-service-pod' pod | Command:
```bash
kubectl logs -f -c quantum-quark auth-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container"... |
Create a copy of the "auth-service-pod" pod with the container "cyber-sleuth" and change the command to start an interactive shell session | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=my-custom-dbg --container=cyber-sleuth -- 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 d... |
Import the environment variables from the 'database-secret' secret and update the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/database-secret deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one ... |
Run the 'elasticsearch --version' command in the first container of the email-server-deployment deployment and display the output. | Command:
```bash
kubectl exec deploy/email-server-deployment -- elasticsearch --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name... |
Create a service for the replicated 'centos' using replica set | Command:
```bash
kubectl expose rs centos --port=8083 --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 specified port.... |
Create a new config map named log-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap log-config --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creat... |
Annotate the pod 'media-stream' with the annotation 'monitoring-tool' and the value 'Prometheus' | Command:
```bash
kubectl annotate pods media-stream monitoring-tool=Prometheus
```
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 includ... |
Copy the local file /tmp/foo_dir to the /etc/kubernetes directory in the metrics-exporter-pod-10 pod in the openfaas namespace. | Command:
```bash
kubectl cp /tmp/foo_dir openfaas/metrics-exporter-pod-10:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
Forward traffic from port 8081 on your local machine to port 5432 in the chat-app-pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 8081: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 autom... |
Create a debug container in a copy of the 'frontend-pod' pod, using the 'debian' image | Command:
```bash
kubectl debug frontend-pod -it --copy-to=debug-image-api --image=debian --set-image=cache=redis:alpine,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 resource ... |
Create a deployment using the specified image and command. | Command:
```bash
kubectl create deployment registry --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch-plugin --list
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "sho... |
Update the image of all containers in the daemonset named "staging" to "postgres:13.4" | Command:
```bash
kubectl set image daemonset staging *=postgres:13.4
```
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:
`ku... |
Copy the directory /var/run/secrets/kubernetes.io/serviceaccount/_dir from the local machine to the /tmp/bar_dir directory in the cache-pod-5 pod in the default namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/_dir cache-pod-5:/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 na... |
Generate the diff for the docker-registry.yaml file by running "cat docker-registry.yaml | kubectl diff -f -" | Command:
```bash
cat docker-registry.yaml | kubectl diff -f -
```
What it does:
Diff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied.
The output is always YAML.
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your... |
Create a deployment named "jenkins" running the "ubuntu" image and expose port 3306 for the deployment. | Command:
```bash
kubectl create deployment jenkins --image=ubuntu --port=3306
```
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: ... |
Taint node 'node-1' with key 'app' and value 'backend' with effect 'PreferNoSchedule' | Command:
```bash
kubectl taint nodes node-1 app=backend:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Import specific keys from a config map into deployment's environment variables | Command:
```bash
kubectl set env --keys=api_key --from=configmap/log-config deployment/analytics-platform-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Apply a taint with key 'hardware' on nodes that have the label zone=us-east-1 | Command:
```bash
kubectl taint node -l zone=us-east-1 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": "O... |
Create a cluster role named "reader" with specified API Group, verbs, and resources. | Command:
```bash
kubectl create clusterrole reader --verb=proxy,get,update --resource=rolebindings.rbac.authorization.k8s.io
```
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 f... |
Start a pod using the "ruby" image and expose port 8443 | Command:
```bash
kubectl run hazelcast --image=ruby --port=8443
```
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": "--fil... |
Create a Jenkins pod and expose port 3306 in the container. | Command:
```bash
kubectl run hazelcast --image=jenkins --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": "--... |
Forward traffic from port 5000 on all addresses to port 6379 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-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 ... |
Import the `secret_key` from the `log-config` config map and set it as an environment variable in the `frontend-deployment` deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/log-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in ... |
Create an ingress named 'app-gateway-ingress' with a rule that directs requests to 'testing.com/example' path to the service 'svc1' on port 8082 | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="testing.com/example=svc1:8082,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Start a pod using the `confluentinc/cp-kafka` image and expose port 8000. | Command:
```bash
kubectl run hazelcast --image=confluentinc/cp-kafka --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 flag... |
Create a new config map named ui-config based on the preferences folder located at path/to/preferences | Command:
```bash
kubectl create configmap ui-config --from-file=path/to/preferences
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/global-config 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 variab... |
Retrieve the previous logs of a terminated Ruby container in the backend-pod pod. | Command:
```bash
kubectl logs -p -c ruby backend-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-c... |
Delete the pods and services with the names "gateway" and "log-aggregator" | Command:
```bash
kubectl delete pod,service gateway log-aggregator
```
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 se... |
Import the CONFIG_FILE_PATH key from the app-config config map into the environment variables of the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-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 vari... |
Create an ingress called 'public-service-ingress' with a rule that directs requests to foo.com/bar to svc1:5000, and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="foo.com/bar=svc1:5000,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... |
Delete the pods and services with the same name "chat-app" and "chat-app". | Command:
```bash
kubectl delete pod,service chat-app chat-app
```
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 selecto... |
Create an ingress resource named 'api-gateway-ingress' with the following rule: redirect requests from 'site.com/module' to the service 'svc1' on port '8088' using the TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/module=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": "", "... |
Run the 'yum install -y aws-cli' command in the astro-container from the monitoring-pod and get the output | Command:
```bash
kubectl exec monitoring-pod -c astro-container -- yum install -y aws-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 na... |
Unset the namespace in the 'foo' context. | Command:
```bash
kubectl config unset contexts.foo.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` |
Delete pods and services with names "foo" and "database" | Command:
```bash
kubectl delete pod,service foo database
```
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.
So... |
Delete the pods and services named "backend" and "payment" | Command:
```bash
kubectl delete pod,service backend payment
```
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.... |
Attach to the "time-machine" container in the "database-pod" pod. | Command:
```bash
kubectl attach database-pod -c time-machine
```
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, us... |
Add a taint with key 'disktype' on nodes having label owner=john-doe | Command:
```bash
kubectl taint node -l owner=john-doe disktype=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": "... |
Create a cron job called 'backup-job' using the ethereum/client-go image, with a schedule of running every minute | Command:
```bash
kubectl create cronjob backup-job --image=ethereum/client-go --schedule="*/1 * * * *" -- geth attach
```
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", "sh... |
set the service account of the deployment "user-management-deployment" to "my-service-account" | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment my-service-account
```
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
... |
Create a service for a replication controller specified in "nginx-controller.yaml", serving on port 8010 and connecting to containers on port 700000. | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=8010 --target-port=700000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the ... |
Create an ingress called 'myapp-ingress' that directs requests to 'site.com/input' to a service named 'svc1' running on port 9090 | Command:
```bash
kubectl create ingress myapp-ingress --rule="site.com/input=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": "", "usage":... |
Create a job named "cleanup" using the Centos image, and running the "bash" command. | Command:
```bash
kubectl create job cleanup --image=centos -- bash
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: jso... |
Scale the deployment named app-v2-replicaset by changing the replicas from 1 to 7. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=7 deployment/app-v2-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-v... |
Execute the command 'mysql --version' in the 'lunar-launcher' container of the 'vpn-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec vpn-service-pod -c lunar-launcher -- mysql --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 ... |
set environment variables for a deployment from the local shell environment | Command:
```bash
env | grep RAILS_ | kubectl set env -e - 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 in one or ... |
Return previous terminated logs of code-explorer container in the pod named proxy-server-pod | Command:
```bash
kubectl logs -p -c code-explorer 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"... |
Automatically scale the deployment named "frontend" with a minimum of 2 pods and a maximum of 8 pods | Command:
```bash
kubectl autoscale deployment frontend --min=2 --max=8
```
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... |
Listen on port 3000 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 3000: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... |
Retrieve snapshot logs from the container named backend-microservice-deployment-1 of a deployment called gateway-pod | Command:
```bash
kubectl logs deployment/backend-microservice-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... |
List the replication controller "web", the service "email-service-rc", and the pod "frontend-pod" | Command:
```bash
kubectl get rc/web service/email-service-rc pods/frontend-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 namespa... |
Import the secret_key from the configmap 'env-vars' and set it as an environment variable in the 'gateway-deployment' deployment | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/env-vars 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 one... |
Rename the context 'old-name' to 'user-b-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context old-name user-b-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 field will also be u... |
Check if you have permissions to list the "load-testing-job" job in the "logging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/load-testing-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 t... |
Create a job named 'audit-job' using the 'confluentinc/cp-kafka' image and run the command 'kafka-server-start /etc/kafka/server.properties' | Command:
```bash
kubectl create job audit-job --image=confluentinc/cp-kafka -- kafka-server-start /etc/kafka/server.properties
```
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... |
Create a new config map named namespace-config using the properties from file1.txt and preferences from file2.txt. | Command:
```bash
kubectl create configmap namespace-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/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 creat... |
Set the service account of the deployment named 'analytics-platform-deployment' to 'kube-controller-manager' | Command:
```bash
kubectl set serviceaccount deployment analytics-platform-deployment kube-controller-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), state... |
Create an ingress called 'app-proxy-ingress' with a rule that directs requests for site.com/example to svc1:5001 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="site.com/example=svc1:5001,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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.