prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Add a taint with the key 'workload' on nodes that have the label app=web-app | Command:
```bash
kubectl taint node -l app=web-app workload=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Set resource requests and limits for all containers in the kafka deployment | Command:
```bash
kubectl set resources deployment kafka --limits=cpu=200m,memory=512Mi --requests=cpu=500m,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 reques... |
Create an ingress resource named 'ingtls' with TLS enabled | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="site.com/=svc:https,tls" \
--rule="foo.com/path/subpath*=othersvc:8081"
```
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... |
Create a service for the replicated nginx, which serves on port 9090 and connects to the containers on port 909000 | Command:
```bash
kubectl expose rc nginx --port=9090 --target-port=909000
```
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. ... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/gcp-service-account-secret deployment/api-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 in one... |
Set the TLS server name for the "edge-cluster" cluster entry to "cluster-beta" | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=cluster-beta
```
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... |
Display the resource usage metrics for all pods that have the label 'team=devops' | Command:
```bash
kubectl top pod -l team=devops
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl top pod [NAME | -l ... |
Partially update the storage-node-13 node by marking it as unschedulable. Use the strategic merge patch specified in the YAML. | Command:
```bash
kubectl patch node storage-node-13 -p $'spec:\n 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]`
Help... |
Set resource limits for the php container in the deployment named "php". Limit the CPU to "2" and memory to "256Mi". | Command:
```bash
kubectl set resources deployment php -c=nginx --limits=cpu=2,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 its ... |
Import the environment variables from the secret named "ssh-key-secret" into the deployment named "frontend-deployment" | Command:
```bash
kubectl set env --from=secret/ssh-key-secret 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 one or more pod t... |
get the replication controller named "web", the service named "e-commerce-rc", and the pod named "chat-app-pod" | Command:
```bash
kubectl get rc/web service/e-commerce-rc pods/chat-app-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 namespaced... |
Import the 'database_url' key from the 'app-secrets' config map into the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-secrets 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 variable defi... |
Get detailed information about the 'ingress-controller' pod | Command:
```bash
kubectl describe pods/ingress-controller
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, pro... |
Expose the replication controller specified in "ruby-controller.yaml" as a service, serving on port 80 and connecting to containers on port 8000. | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8000 --target-port=808100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Update the annotation 'custom-label' of pod 'gateway' with the value 'my-custom-value', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods gateway 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 labels... |
Add a taint with the key 'special' to nodes that have the label 'tier=frontend'. | Command:
```bash
kubectl taint node -l tier=frontend special=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Roll back the deployment in namespace-2 to the previous version | Command:
```bash
kubectl rollout undo deployment/namespace-2
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the resource t... |
Update the service account of the 'web-app-deployment' deployment to 'kube-proxy' | Command:
```bash
kubectl set serviceaccount deployment web-app-deployment 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... |
Forward traffic from port 5432 on any address to port 6379 in the backend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5432: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 ... |
Remove the 'release' label from the 'cdn' pod | Command:
```bash
kubectl label pods cdn 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 an ingress named 'app-proxy-ingress' that routes traffic from website.com/example to svc1:3001 using a TLS secret called 'my-cert' | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="website.com/example=svc1:3001,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": "",... |
Return the snapshot logs from the container named security-service-pod-1 of the analytics-platform-deployment deployment. | Command:
```bash
kubectl logs deployment/analytics-platform-deployment -c security-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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-settings 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 ... |
Start a python pod named "hazelcast" with the python image and expose port 5001 inside the container. | Command:
```bash
kubectl run hazelcast --image=python --port=5001
```
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... |
Delete the pods and services with the names "database" and "chat-app" | Command:
```bash
kubectl delete pod,service database 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... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/env-vars deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions ... |
Copy the contents of the `/var/run/secrets/kubernetes.io/serviceaccount/` directory from the `monitoring-agent-pod-6` pod in the `ingress-nginx` namespace to the `/tmp/bar_dir` directory locally. | Command:
```bash
kubectl cp ingress-nginx/monitoring-agent-pod-6:/var/run/secrets/kubernetes.io/serviceaccount/ /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": "", "... |
Set the custom TLS server name to 'web-cluster' for validation for the 'data-cluster' cluster entry. | Command:
```bash
kubectl config set-cluster data-cluster --tls-server-name=web-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-... |
Create a deployment named worker that uses the golang image and exposes port 8080 | Command:
```bash
kubectl create deployment worker --image=golang --port=8080
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Check if I have permission to list the "security-scan-job" job in the "kube-ingress" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/security-scan-job -n kube-ingress
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/env-vars deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Retrieve the logs of the first container in a job named "backup-job". | Command:
```bash
kubectl logs job/backup-job
```
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", "defa... |
Check if you have permission to list the job named "log-analysis-job" in the "testing" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/log-analysis-job -n testing
```
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 an ingress with multiple hosts and set the pathType as Prefix. | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:9091" \
--rule="module.com/admin*=svc2:http"
```
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": "--outpu... |
Create a pod disruption budget named monitoring-pdb that selects all pods with the role=worker label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget monitoring-pdb --selector=role=worker --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=N [--... |
Define new execution authentication plugin arguments for the "cloud-user" entry | Command:
```bash
kubectl config set-credentials cloud-user --exec-arg=arg1 --exec-arg=arg2
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token... |
Copy the contents of the /tmp/foo_dir directory from the 'metrics-exporter-pod-10' pod in the 'argocd' namespace to the /tmp/bar_dir directory on your local machine. | Command:
```bash
kubectl cp argocd/metrics-exporter-pod-10:/tmp/foo_dir /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Update the credentials for the "robot-user" entry by setting only the "client-key" field, without modifying any other values. | Command:
```bash
kubectl config set-credentials robot-user --client-key=~/.kube/admin.key
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token ... |
Retrieve snapshot logs from the container named notification-handler-deployment-1 in the deployment named chat-app-pod. | Command:
```bash
kubectl logs deployment/notification-handler-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 flag... |
Create a pod named nginx with the image mongo, and override the specifications with values provided in the JSON file. | Command:
```bash
kubectl run nginx --image=mongo --overrides='{ "apiVersion": "v1.1.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND... |
Get the output from running the 'docker run -it ubuntu' command in the first pod of the 'web-service' service. | Command:
```bash
kubectl exec svc/web-service -- docker run -it ubuntu
```
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... |
Update the last-deployment annotation of the pod specified in the "pod.json" file to "2023-03-15" | Command:
```bash
kubectl annotate -f pod.json last-deployment=2023-03-15
```
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 arbi... |
Update the pod named 'web' with the 'owner' annotation set to 'alice-smith', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods web owner='alice-smith'
```
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 ar... |
Get output from running the 'redis-cli' command in the 'astro-container' container from the 'monitoring-pod' pod. | Command:
```bash
kubectl exec monitoring-pod -c astro-container -- 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 omitte... |
Apply a taint to nodes labeled with 'project=project-alpha' with the key 'zone' and the value 'monitoring-node-15' indicating to the scheduler to prefer not scheduling pods on these nodes. | Command:
```bash
kubectl taint node -l project=project-alpha zone=monitoring-node-15: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": "",... |
Create a deployment named "logging" using the "postgres" image. | Command:
```bash
kubectl create deployment logging --image=postgres
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|... |
Create an ingress called 'public-service-ingress' that directs requests to testing.com/example to svc1:8010 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/example=svc1:8010,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"... |
Expose a replica set as a service with specific port configuration | Command:
```bash
kubectl expose rs wordpress --port=3306 --target-port=888800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Remove the taint with key 'cpu-type' and effect 'NoSchedule' from the node named 'edge-node-10' | Command:
```bash
kubectl taint nodes edge-node-10 cpu-type:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Add release notes annotation to a pod specified in the parameters.json file | Command:
```bash
kubectl annotate -f parameters.json release-notes='https://example.com/release-notes/v2.5.1'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can b... |
Unset the namespace in the service-account-context context. | Command:
```bash
kubectl config unset contexts.service-account-context.namespace
```
What it does:
Unset an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
Syntax:
`kubectl config unset PROP... |
Partially update a node by specifying the patch as YAML | Command:
```bash
kubectl patch node edge-node-10 -p $'spec:\n rules:\n- http:\n paths:\n - path: /\n backend:\n service:\n name: new-service'
```
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.
S... |
Start a redis pod with the name nginx and the specified image, but override the spec with a partial set of values parsed from the provided JSON | Command:
```bash
kubectl run nginx --image=redis --overrides='{ "apiVersion": "rc-1.1.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMA... |
Retrieve the list of deployments in the "rc-1.1.0" version of the "sandbox-apps" API group, and display the output in YAML format. | Command:
```bash
kubectl get deployments.rc-1.1.0.sandbox-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 ... |
Add a taint with key 'disktype' on nodes having label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 disktype=node-2:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Start a pod named "hazelcast" using the "alpine" image and expose port 8181. | Command:
```bash
kubectl run hazelcast --image=alpine --port=8181
```
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... |
Forward local port 3000 to port 8000 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 3000: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 select... |
Perform a dry-run rollback to the previous deployment of the 'app-v2' deployment. | Command:
```bash
kubectl rollout undo --dry-run=server deployment/app-v2
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying th... |
Set the custom TLS server name to use for validation for the on-prem-cluster cluster entry. | Command:
```bash
kubectl config set-cluster on-prem-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] [--certifica... |
Copy the contents of the `~/.config/kube` directory from the `openfaas/worker-pod-4` pod to the local directory `/tmp/bar_dir`. | Command:
```bash
kubectl cp openfaas/worker-pod-4:~/.config/kube /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 ku... |
Roll back the my-deployment daemonset to revision 7. | Command:
```bash
kubectl rollout undo daemonset/my-deployment --to-revision=7
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifyi... |
Create a new LoadBalancer service named frontend-lb with a TCP port mapping from 7000 to 9091. | Command:
```bash
kubectl create service loadbalancer frontend-lb --tcp=7000:9091
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "defaul... |
Forward local port 5000 to port 5000 in the specified pod | Command:
```bash
kubectl port-forward pod/api-service-pod 5000: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 au... |
Forward local port 9090 to port 3000 in the 'log-aggregator-pod' pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 9090: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 selected... |
Switch to the context of the "sun-cluster" cluster | Command:
```bash
kubectl config use-context sun-cluster
```
What it does:
Set the current-context in a kubeconfig file.
Syntax:
`kubectl config use-context CONTEXT_NAME` |
Create a service for the replication controller specified in "wordpress-controller.yaml" file with the exposed port as 8888 and the target port as 909100. | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=8888 --target-port=909100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on ... |
Listen on the local port 8081 and forward the traffic to port 6379 in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward pod/cdn-service-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 criteria, a pod will be selected au... |
Forward traffic from local port 5000 to port 8888 in the pod named 'web-app-pod' | Command:
```bash
kubectl port-forward pod/web-app-pod 5000: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 automa... |
Create a single ingress called 'private-ingress' that directs requests to website.com/input to service 'svc1' on port 5432 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="website.com/input=svc1:5432,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... |
Add a taint with the key 'hardware' on nodes having the label release=beta | Command:
```bash
kubectl taint node -l release=beta 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": "", "usage"... |
Create a pod named "hazelcast" using the image "ethereum/client-go" and expose port 3306. | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --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:
... |
Get the output of the 'geth version' command in the lunar-launcher container within the backend-pod pod | Command:
```bash
kubectl exec backend-pod -c lunar-launcher -- geth version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted... |
Start a golang pod named 'hazelcast' using the 'golang' image and expose port 6379 | Command:
```bash
kubectl run hazelcast --image=golang --port=6379
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Create a service for the 'hazelcast' deployment, which serves on port 9092 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=9092 --target-port=8000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specif... |
Forward local port 5432 to pod port 5432 | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5432 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 a... |
Execute the 'go' command inside the auth-service-pod pod | Command:
```bash
kubectl exec auth-service-pod -- 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 omitted, use the kubectl.kuber... |
Set the custom TLS server name for the star-cluster cluster entry to "cluster-gamma" | Command:
```bash
kubectl config set-cluster star-cluster --tls-server-name=cluster-gamma
```
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 an ingress called 'external-ingress' that routes requests to website.com/module to a service named svc1 on port 5001 | Command:
```bash
kubectl create ingress external-ingress --rule="website.com/module=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": "", "... |
Set the cluster field in the "team-alpha-context" context to "cloud-cluster" | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster cloud-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 ... |
Listen on port 8000 on localhost and the IP 10.19.21.23, and forward the traffic to port 8080 in the pod named 'api-service-pod'. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 8000: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 cri... |
Create a debugging copy of the 'analytics-pod' with a new container named 'debug-image-memcached' | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-memcached --image=debian --set-image=api=api:v2,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 and na... |
Import specific keys from a config map to an environment variable in a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/monitoring-config 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 definiti... |
Update the image of all containers in the 'development' daemonset to 'ruby:3.0.2' | Command:
```bash
kubectl set image daemonset development *=ruby:3.0.2
```
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:
`k... |
Forward local port 6379 to port 8088 in the pod "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 6379: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 a... |
Set the cluster field in the specified context to the desired cluster name | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster edge-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 yo... |
Import the log_level key from the api-config config map and set it as an environment variable in the log-aggregator-deployment deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/api-config deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Set the server field of the data-cluster configuration to https://1.2.3.4 | Command:
```bash
kubectl config set clusters.data-cluster.server https://1.2.3.4
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you w... |
Add a taint with key 'environment' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta environment=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Create an autoscaling policy for the "email" deployment with a minimum of 4 pods and a maximum of 12 pods. | Command:
```bash
kubectl autoscale deployment email --min=4 --max=12
```
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 t... |
Forward traffic from local port 8000 to port 6379 in a pod selected by the database-deployment deployment. | Command:
```bash
kubectl port-forward deployment/database-deployment 8000 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be ... |
Execute the command "elasticsearch --version" in the first pod of the logging-service service | Command:
```bash
kubectl exec svc/logging-service -- 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. If omitte... |
List the deployments in JSON output format, using the v3.0.0 version of the internal-apps API group. | Command:
```bash
kubectl get deployments.v3.0.0.internal-apps -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 w... |
Set a custom TLS server name to use for validation for the "sun-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster sun-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] [--certificate... |
Create a batch-processing job using the `confluentinc/cp-kafka` image and execute the command `kafka-server-start /etc/kafka/server.properties` | Command:
```bash
kubectl create job batch-processing --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",... |
Display the last 20 lines of the logs for the pod named chat-app-pod | Command:
```bash
kubectl logs --tail=20 chat-app-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... |
Forward traffic from local port 3000 to port 5000 in the specified pod | Command:
```bash
kubectl port-forward pod/backend-pod 3000 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... |
Get the output from running the 'mongod' command in the 'stardust-shuttle' container from the 'frontend-pod' pod | Command:
```bash
kubectl exec frontend-pod -c stardust-shuttle -- mongod
```
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... |
Forward ports 6379 and 6000 to a selected pod in the deployment/email-server-deployment | Command:
```bash
kubectl port-forward deployment/email-server-deployment 6379 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... |
update the 'web-app-deployment' deployment by adding a new environment variable named ENV with the value of prod | Command:
```bash
kubectl set env deployment/web-app-deployment ENV=prod
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within repl... |
Add a taint to the 'monitoring-node-15' node with the key 'dedicated' and no value. | Command:
```bash
kubectl taint nodes monitoring-node-15 dedicated: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. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.