prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create an ingress called 'website-ingress' with a rule that directs requests from website.com/input to svc1:8082 | Command:
```bash
kubectl create ingress website-ingress --rule="website.com/input=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": "", "us... |
Remove the taint with the key 'special' from node 'edge-node-10' | Command:
```bash
kubectl taint nodes edge-node-10 special-
```
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: json|yaml|... |
Create a service for the replicated alpine pods with the following specifications: | Command:
```bash
kubectl expose rc alpine --port=8082 --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.... |
Forward port 8080 on all addresses to port 9090 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 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 wi... |
Create an ingress called 'public-ingress' that directs requests to foo.com/bar to svc1 on port 8000, and use the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="foo.com/bar=svc1:8000,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 a file from a pod to a local directory | Command:
```bash
kubectl cp ingress-nginx/metrics-exporter-pod-10:/tmp/foo /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Set a custom TLS server name for the "app-cluster" cluster entry in the kubeconfig file. | Command:
```bash
kubectl config set-cluster app-cluster --tls-server-name=dev-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] [--certificate-a... |
Import the SMTP_SERVER key from the app-settings config map and set it as an environment variable for the order-processing-deployment deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-settings deployment/order-processing-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... |
Set the resource requests and limits for all containers in a deployment named "node". | Command:
```bash
kubectl set resources deployment node --limits=cpu=200m,memory=512Mi --requests=cpu=2,memory=4Gi
```
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, b... |
Open a raw terminal connection to the code-explorer container in the proxy-server-pod and send input from the client to 'bash', while receiving output from 'bash' back to the client. | Command:
```bash
kubectl attach proxy-server-pod -c code-explorer -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 ... |
import the SMTP_SERVER key from the config map 'monitoring-config' and set it as an environment variable for the 'web-app-deployment' deployment | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/monitoring-config 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 definiti... |
Retrieve the logs from the previous terminated 'time-machine' container in the 'security-service-pod' pod | Command:
```bash
kubectl logs -p -c time-machine 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": "--contain... |
Add a taint with key 'hardware' on nodes having label 'project=project-alpha' | Command:
```bash
kubectl taint node -l project=project-alpha hardware=testing-node-11: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": ""... |
Copy the local file /tmp/foo to the remote pod backend-pod-13 in the rook-ceph namespace, and save it as /tmp/bar_dir | Command:
```bash
kubectl cp :/tmp/foo rook-ceph/backend-pod-13:/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 kube... |
Execute the 'redis-cli' command inside the 'database-pod' pod to interact with Redis. | Command:
```bash
kubectl exec database-pod -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.ku... |
Forward traffic from port 8088 on localhost and IP address 10.19.21.23 to port 8080 in the pod named security-service-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 8088: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 th... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/monitoring-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 d... |
Update the cluster role binding "admin" by adding the service account "namespace:istio" | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:istio
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespac... |
Retrieve information about a specific type of resource, using their names as the filter. | Command:
```bash
kubectl get rc/web service/email-service-rc pods/log-aggregator-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 n... |
Create a new secret named jwt-secret using the key-value pairs in the preferences.env file | Command:
```bash
kubectl create secret generic jwt-secret --from-env-file=path/to/preferences.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... |
Forward local port 8000 to pod port 5000 of a specific deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8000 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Forward local port 5000 to port 8088 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 5000 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 aut... |
Retrieve the phase value of a specific pod. | Command:
```bash
kubectl get -o template pod/log-aggregator-pod --template={{.status.phase}}
```
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 t... |
Set the custom TLS server name to "cluster-alpha" for the cluster entry "on-prem-cluster" | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=cluster-alpha
```
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... |
Create an ingress with a default backend and a rule for forwarding traffic to a specific service and port. | Command:
```bash
kubectl create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="foo.com/*=svc:7000,tls=secret1"
```
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": "--ou... |
Copy the ~/.config/kube file from a remote pod named "argocd/worker-pod-4" to the local directory /tmp/bar. | Command:
```bash
kubectl cp argocd/worker-pod-4:~/.config/kube :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl... |
Create a cron job called 'metrics-collection' that runs the 'jenkins-plugin-cli' command every minute, using the 'jenkins' image. | Command:
```bash
kubectl create cronjob metrics-collection --image=jenkins --schedule="*/1 * * * *" -- jenkins-plugin-cli
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output",... |
Create an ingress that directs requests to a specific service with TLS encryption. | Command:
```bash
kubectl create ingress private-service-ingress --rule="site.com/module=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": "... |
Start a pod named 'hazelcast' using the 'mcr.microsoft.com/dotnet/core/runtime' image, and configure the container to expose port 3306. | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --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...... |
Create a deployment named "my-dep" using the "amazonlinux" image and expose port 5000. | Command:
```bash
kubectl create deployment my-dep --image=amazonlinux --port=5000
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Set the custom TLS server name to use for validation for the "app-cluster" cluster entry | Command:
```bash
kubectl config set-cluster app-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] [--certificat... |
Create a copy of the payment-gateway-pod by adding a debug container and changing container images | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=debug-image-web --image=debian --set-image=proxy=nginx:1.21,api=api:v2
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and... |
Forward local port 8888 to port 5000 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod 8888:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Delete the pods and services with the names "analytics" and "gateway" | Command:
```bash
kubectl delete pod,service analytics gateway
```
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... |
Partially update the node specified in the "kubelet-config.yaml" file by setting the "unschedulable" field to true using a strategic merge patch. | Command:
```bash
kubectl patch -f kubelet-config.yaml -p '{"spec":{"unschedulable":true}}'
```
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 FILE]`
... |
Update the pod specified in the "setup.json" file by adding the annotation "contact-email" with the value "support@example.com". | Command:
```bash
kubectl annotate -f setup.json contact-email=support@example.com
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and inc... |
Create a new NodePort service named my-ns with port forwarding from local port 8081 to target port 8088 | Command:
```bash
kubectl create service nodeport my-ns --tcp=8081: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": "", "usage": "... |
Forward data between local port 8000 and port 9090 in the pod named 'proxy-server-pod' | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8000 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 a... |
Import specific keys from a config map for a deployment "database-deployment" | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/db-config deployment/database-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... |
Copy the directory '/tmp/foo_dir' from the 'front-end-pod-12' pod in the 'kubeapps' namespace to the '/tmp/bar' directory on your local machine. | Command:
```bash
kubectl cp kubeapps/front-end-pod-12:/tmp/foo_dir /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kube... |
Import specific keys from a config map to the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-config-dev deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Add a taint with key 'app' on nodes having label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 app=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Create a new config map named env-vars with the specified keys mapped to the contents of the corresponding files | Command:
```bash
kubectl create configmap env-vars --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/configurations/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... |
Forward traffic from port 8081 on all addresses to port 8080 in the backend-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 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 ... |
Set the service account of the deployment "log-aggregator-deployment" to "gitlab-runner" | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-deployment gitlab-runner
```
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... |
Set the user field on the admin-context context entry without modifying other values | Command:
```bash
kubectl config set-context admin-context --user=cluster-admin
```
What it does:
Set a context 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-context [NAME | --current] [--cluster=cluster_nickname... |
Update the 'proxy' pod by adding the annotation 'monitoring-tool' with the value 'Prometheus' | Command:
```bash
kubectl annotate pods proxy 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 include arbit... |
Forward local port 8088 to port 6379 in the pod named 'analytics-pod' | Command:
```bash
kubectl port-forward pod/analytics-pod 8088: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 auto... |
Create a new ClusterIP service named database-service-clusterip, with the TCP port 8443 on the service mapping to the TCP port 5432 on the pods. | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=8443:5432
```
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... |
Add a taint with the key 'hardware' to nodes labeled with 'release=beta'. | Command:
```bash
kubectl taint node -l release=beta hardware=app-node-6: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... |
Rename a context in your kubeconfig file | Command:
```bash
kubectl config rename-context prod-context admin-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 b... |
Start a pod using the amazonlinux image and expose port 8443 on the container | Command:
```bash
kubectl run hazelcast --image=amazonlinux --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":... |
Create a new ExternalName service named 'external-cloud-storage-service' with the external name 'placeholder-app.app' | Command:
```bash
kubectl create service externalname external-cloud-storage-service --external-name placeholder-app.app
```
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 refe... |
Execute 'go version' command in the 'time-machine' container of the 'proxy-service-pod' pod and get the output. | Command:
```bash
kubectl exec proxy-service-pod -c time-machine -- go 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 omitt... |
Create a copy of vpn-service-pod and change all container images to mongo. The debug container will be called debug-image-api. | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-api --set-image=*=mongo
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no r... |
View the deployments in YAML format for the "feature-branch-2.3.0" version of the "alpha-apps" API group | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.alpha-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 names... |
Set the service account of the 'mydeployment' deployment to 'kube-proxy' | Command:
```bash
kubectl set serviceaccount deployment mydeployment kube-proxy
```
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:
`kubectl set s... |
Update the specified node by applying a strategic merge patch in JSON format | Command:
```bash
kubectl patch node node-2 -p '{"spec":{"replicas":3}'
```
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 FILE]`
Helpful flags:
"fla... |
Import environment variables from a configmap, with a specific prefix, for a deployment. | Command:
```bash
kubectl set env --from=configmap/log-config --prefix=MYSQL_ deployment/user-management-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... |
Import the specific keys 'my-example-key' from the 'kube-system-config' config map into the 'mydeployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/kube-system-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 definition... |
Copy the local file /tmp/foo_dir to the remote pod metrics-exporter-pod-10 in the container admin-dashboard | Command:
```bash
kubectl cp /tmp/foo_dir metrics-exporter-pod-10:/tmp/bar_dir -c admin-dashboard
```
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 ... |
Set the certificate-authority-data field on the on-prem-cluster cluster using the provided certificate data | Command:
```bash
kubectl config set clusters.on-prem-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 conta... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-config-dev 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 d... |
Add the label 'role=cache' to the pod named 'monitoring' | Command:
```bash
kubectl label pods monitoring 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": ... |
Open a local port forwarding to a pod's port | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Start a postgres pod and expose port 8088 | Command:
```bash
kubectl run hazelcast --image=postgres --port=8088
```
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": "-... |
Create a new config map named 'app-secrets' using the contents of the 'path/to/preferences.env' file. | Command:
```bash
kubectl create configmap app-secrets --from-env-file=path/to/preferences.env
```
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 th... |
List the deployments in the "v1.1.0" version of the "custom-deployments" API group in JSON output format. | Command:
```bash
kubectl get deployments.v1.1.0.custom-deployments -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 ... |
Forward local port 3000 to port 8081 in the frontend-pod pod | Command:
```bash
kubectl port-forward pod/frontend-pod 3000 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... |
create a deployment named registry with the specified image and expose the designated port | Command:
```bash
kubectl create deployment registry --image=confluentinc/cp-kafka --port=9091
```
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 ... |
Apply a taint to a specific node with a specific key and no value. | Command:
```bash
kubectl taint nodes db-node-7 datacenter: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 of: ... |
Remove the label 'release-' from the 'auth' pod if it exists | Command:
```bash
kubectl label pods auth release-
```
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 true... |
Create a config map named app-settings from an env file | Command:
```bash
kubectl create configmap app-settings --from-env-file=path/to/properties.env
```
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 th... |
Update the environment of a pod using an annotation in a JSON file | Command:
```bash
kubectl annotate -f pod.json 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 arbitrary string va... |
Create a new secret named encryption-key-secret with keys for each file in folder bar by specifying the path to the folder containing the files. | Command:
```bash
kubectl create secret generic encryption-key-secret --from-file=path/to/parameters
```
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 base... |
Create a new ClusterIP service named shipping-service-clusterip, forwarding incoming traffic on port 5432 to port 5000 | Command:
```bash
kubectl create service clusterip shipping-service-clusterip --tcp=5432:5000
```
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... |
Get output from running the 'wp' command from pod email-service-pod. | Command:
```bash
kubectl exec email-service-pod -- wp
```
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... |
Create a new config map named app-name-config using the specified keys instead of the file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/parameters/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 ... |
create a service for a replicated Ruby application that serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose rc ruby --port=8084 --target-port=543200
```
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... |
Create an ingress resource named 'app-proxy-ingress' and configure it to route requests from 'site.com/bar' to 'svc1:9000' using the TLS secret "my-cert". | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="site.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... |
Add a taint with the key 'datacenter' and value 'node-1:PreferNoSchedule' on the nodes that have the label 'tier=frontend'. | Command:
```bash
kubectl taint node -l tier=frontend datacenter=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": "Out... |
Listen on port 8088 on all addresses and forward the traffic to port 8081 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8088: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 sel... |
Create a copy of the 'chat-app-pod' pod with a debug container and changed container images to 'debian' | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=debug-image-memcached --image=debian --set-image=database=mysql:5.7,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource... |
Forward local port 8081 to pod port 8888 for the frontend-pod, listening on localhost and IP 10.19.21.23. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 8081: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 criter... |
Import environment from the aws-credentials-secret secret into the order-processing-deployment deployment | Command:
```bash
kubectl set env --from=secret/aws-credentials-secret deployment/order-processing-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 o... |
Add a taint with key 'workload' on nodes having label 'stack=tech-stack' using the command 'kubectl taint node -l stack=tech-stack workload=web-node-8:PreferNoSchedule' | Command:
```bash
kubectl taint node -l stack=tech-stack workload=web-node-8: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":... |
Set the service account of deployment "gateway-deployment" to "dashboard" | Command:
```bash
kubectl set serviceaccount deployment gateway-deployment dashboard
```
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:
`kubectl ... |
Create a single ingress called 'app1-ingress' that directs requests to site.com/bar to the service svc1:8081, and use the TLS secret "my-cert" | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/bar=svc1:8081,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Forward traffic from local port 6379 to port 9090 in the pod named "mypod", allowing access from both localhost and IP address 10.19.21.23. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 6379: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 p... |
Retrieve the snapshot logs from the container "search-engine-deployment-1" of the deployment named "chat-app-pod". | Command:
```bash
kubectl logs deployment/search-engine-deployment -c chat-app-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fla... |
Create a role named "view" with the verb "connect" and the resource "pods" with the specified resource names "blog-backend" and "load-balancer" | Command:
```bash
kubectl create role view --verb=connect --resource=pods --resource-name=blog-backend --resource-name=load-balancer
```
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|cli... |
Listen on port 8088 on localhost and IP 10.19.21.23, and forward the traffic to port 3000 in the web-app-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-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 criteri... |
Get the output from the 'cyber-sleuth' container running in the 'e-commerce-pod' pod. | Command:
```bash
kubectl attach e-commerce-pod -c cyber-sleuth
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Retrieve the logs from the previous terminated 'time-machine' container in the 'database-pod' pod. | Command:
```bash
kubectl logs -p -c time-machine database-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", "sh... |
Get output from the 'quantum-quark' container in the 'vpn-service-pod' pod | Command:
```bash
kubectl attach vpn-service-pod -c quantum-quark
```
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 pod disruption budget named critical-services-pdb that selects all pods with the project=my-project 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=project=my-project --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-a... |
Retrieve the output of the 'psql' command from the first container of the 'order-processing-deployment' deployment. | Command:
```bash
kubectl exec deploy/order-processing-deployment -- psql
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
List deployments in YAML output format for the "beta-1.0" version of the "api-v2" API group. | Command:
```bash
kubectl get deployments.beta-1.0.api-v2 -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 o... |
Update a node with specific changes using a patch command and a JSON file as input | Command:
```bash
kubectl patch -f kubeadm-config.yaml -p '{"spec":{"replicas":3}'
```
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 FILE]`
Helpful ... |
Create a ClusterIP service named billing-service-clusterip that will forward traffic from port 5000 to port 8443 | Command:
```bash
kubectl create service clusterip billing-service-clusterip --tcp=5000:8443
```
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"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.