prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Get output from running 'go' command from the first pod of the deployment user-management-deployment, using the first container by default. | Command:
```bash
kubectl exec deploy/user-management-deployment -- 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 ... |
Forward local port 8888 to port 3000 in the log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8888: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... |
Display the last 5 lines of logs for the pod named payment-gateway-pod | Command:
```bash
kubectl logs --tail=5 payment-gateway-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short... |
Remove the label 'release-' from the 'foo' pod | Command:
```bash
kubectl label pods foo 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,... |
Check if you have permission to list the cron-jobs in the staging namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cron-job -n staging
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that star... |
Create an ingress with multiple hosts and pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="testing.com/path*=svc:8081" \
--rule="example.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": "--outp... |
Taint nodes with the label 'myLabel' and add a taint with the key 'disktype' and value 'testing-node-11:PreferNoSchedule' | Command:
```bash
kubectl taint node -l myLabel disktype=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": "Ou... |
Create a new config map named global-config using the key=value pairs from the preferences file located at path/to/preferences. | Command:
```bash
kubectl create configmap global-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 base... |
Create a pod using the Ruby image, with a container that exposes port 8081. | Command:
```bash
kubectl run hazelcast --image=ruby --port=8081
```
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... |
Execute the 'jenkins-plugin-cli' command in the cyber-sleuth container of the api-service-pod pod and retrieve the output. | Command:
```bash
kubectl exec api-service-pod -c cyber-sleuth -- jenkins-plugin-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Attach to the 'nano-bot' container in the 'analytics-pod' and interact with the terminal | Command:
```bash
kubectl attach analytics-pod -c nano-bot -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Taint nodes with label 'stack=tech-stack' and add a taint with key 'zone' and value 'k8s-node-1:PreferNoSchedule' | Command:
```bash
kubectl taint node -l stack=tech-stack zone=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": "Ou... |
Create a role named "foo" with specified resource names, allowing the "watch" verb for the "pods" resource with the resource names "audit-logger" and "api-server" | Command:
```bash
kubectl create role foo --verb=watch --resource=pods --resource-name=audit-logger --resource-name=api-server
```
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|client|no... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/namespace-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 variabl... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/private-key-secret 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 definitions in one o... |
Create a secret named azure-storage-secret from an environment file | Command:
```bash
kubectl create secret generic azure-storage-secret --from-env-file=path/to/properties.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 t... |
Get documentation for the "template" field within the "spec" field of the "services" resource | Command:
```bash
kubectl explain resource=services.spec.template
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag to... |
Forward traffic from port 8888 on localhost and IP address 10.19.21.23 to port 9090 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8888:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the ... |
Listen on port 8081 locally, forwarding data to/from port 3000 in the 'analytics-pod' pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 8081 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 auto... |
Update the image of all containers in the daemonset 'namespace-3' to 'wordpress:5.8.1'. | Command:
```bash
kubectl set image daemonset namespace-3 *=wordpress:5.8.1
```
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)
Synta... |
Copy the file "foo" from the local "/tmp" directory to the "/etc/kubernetes" directory in the remote pod "auth-service-pod-11" in the "kubeapps" namespace. | Command:
```bash
kubectl cp /tmp/foo kubeapps/auth-service-pod-11:/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, use th... |
Remove the 'api-user' user in the kubectl config | Command:
```bash
kubectl config delete-user api-user
```
What it does:
Delete the specified user from the kubeconfig.
Syntax:
`kubectl config delete-user NAME` |
Create a new ClusterIP service named 'order-service-clusterip' that maps port 9090 to port 8082 | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=9090:8082
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", ... |
Forward port 9090 on localhost and IP 10.19.21.23 to port 6379 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 9090: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 cri... |
Embed the certificate authority data for the cluster entry named "kube-cluster-2" by running the command `kubectl config set-cluster kube-cluster-2 --embed-certs --certificate-authority=~/.kube/my-k8s-cluster/kubernetes.ca.crt` | Command:
```bash
kubectl config set-cluster kube-cluster-2 --embed-certs --certificate-authority=~/.kube/my-k8s-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... |
Embed the certificate authority data for the cloud-cluster cluster entry, ensuring to include the --embed-certs flag and specify the path to the certificate authority file using the --certificate-authority flag. | Command:
```bash
kubectl config set-cluster cloud-cluster --embed-certs --certificate-authority=~/.kube/prod-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 se... |
Create a Pod Disruption Budget (PDB) named payment-gateway-pdb that selects all pods with the app=nginx label and requires at least 70% of the selected pods to be available at any point in time. | Command:
```bash
kubectl create pdb payment-gateway-pdb --selector=app=nginx --min-available=70%
```
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 [--dry-run=ser... |
Remove the label named 'bar' from the pod 'gateway' | Command:
```bash
kubectl label pods gateway 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 t... |
Check if the current user has permission to list the "security-scan-job" job in the "kube-dns" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/security-scan-job -n kube-dns
```
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... |
List the deployments in the "feature-branch-2.3.0" version of the "custom-deployments" API group and output the result in JSON format. | Command:
```bash
kubectl get deployments.feature-branch-2.3.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 ... |
Add a taint with the key 'app' and value 'edge-node-10:PreferNoSchedule' on nodes that have the label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops app=edge-node-10:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output... |
Forward traffic from port 5000 on localhost and IP 10.19.21.23 to port 3000 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 5000: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... |
Apply the taint with key 'dedicated' on the nodes that have the label 'instance=app-instance-1' | Command:
```bash
kubectl taint node -l instance=app-instance-1 dedicated=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Update node 'gpu-node-12' with a taint with key 'workload', value 'high-priority', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes gpu-node-12 workload=high-priority: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 fo... |
Set the custom TLS server name to 'cluster-alpha' for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --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-authori... |
Add a taint to nodes with the label 'app-type=microservice' with the key 'workload' and value 'web-node-8:PreferNoSchedule' | Command:
```bash
kubectl taint node -l app-type=microservice 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": "", "us... |
Get output from running the 'bash' command in a pod named web-app-pod, using the first container by default | Command:
```bash
kubectl exec web-app-pod -- bash
```
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.kubernet... |
Create an ingress named 'ingtls' with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="foo.com/=svc:https,tls" \
--rule="website.com/path/subpath*=othersvc:8010"
```
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": "-... |
Import specific keys from a config map to environment variables | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/namespace-config 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 d... |
Copy the file `/tmp/foo` from your local machine to `/tmp/bar` in the `openfaas/image-resizer-pod-20` pod in the specified namespace. | Command:
```bash
kubectl cp :/tmp/foo openfaas/image-resizer-pod-20::/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ku... |
Enable the Google Compute Platform auth provider for the "saas-admin" entry by running the command 'kubectl config set-credentials saas-admin --auth-provider=gcp' | Command:
```bash
kubectl config set-credentials saas-admin --auth-provider=gcp
```
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 flags:
--... |
Create a copy of the 'cdn-service-pod', but change the command of the 'rocket-ranger' container to 'sh'. | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=debug-image-web --container=rocket-ranger -- 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... |
Set the cluster field in the "team-beta-context" context to "my-k8s-cluster" | Command:
```bash
kubectl config set contexts.team-beta-context.cluster my-k8s-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 ... |
Execute the 'node' command in the warp-drive container within the chat-app-pod and display the output. | Command:
```bash
kubectl exec chat-app-pod -c warp-drive -- node
```
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 k... |
Set up autoscaling for the deployment "cdn" with a minimum of 7 pods and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment cdn --min=7 --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 uses the... |
Display the last 53 lines of logs for the pod named 'cdn-service-pod' | Command:
```bash
kubectl logs --tail=53 cdn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": ... |
Forward local port 8888 to port 8000 in the cdn-service-pod pod, and listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8888: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 w... |
Create a cron job named "cleanup-task" that runs every minute using the busybox image. | Command:
```bash
kubectl create cronjob cleanup-task --image=busybox --schedule="*/1 * * * *"
```
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", "default": "... |
Forward local port 5432 to port 5432 in the web-app-pod | Command:
```bash
kubectl port-forward pod/web-app-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 automa... |
Create an ingress named 'ingress1' with multiple hosts and set the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:3000" \
--rule="example.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": "--output",... |
Forward traffic from port 9090 on both localhost and IP address 10.19.21.23 to port 6379 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 9090: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 p... |
Apply the configuration file ./conf.json to a pod. | Command:
```bash
kubectl apply -f ./conf.json
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
JSON... |
Remove the taints with key 'special' from node 'node-1' | Command:
```bash
kubectl taint nodes node-1 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|name|g... |
Update the pod 'monitoring' by adding the label 'tier' with the value 'database'. | Command:
```bash
kubectl label pods monitoring tier=database
```
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... |
Run the 'wp' command inside the 'astro-container' container of the 'analytics-pod' pod and retrieve the output. | Command:
```bash
kubectl exec analytics-pod -c astro-container -- 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 t... |
Update the node specified in the "node.json" file by partially merging the changes specified in the "kubeadm-config.yaml" file using strategic merge patch | Command:
```bash
kubectl patch -f kubeadm-config.yaml -p '{"spec":{"type":"LoadBalancer"}'
```
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]`
... |
Delete the pods and services with the names "foo" and "frontend" | Command:
```bash
kubectl delete pod,service foo frontend
```
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... |
List the replication controller named web, the service named gateway-rc, and the pod named email-service-pod | Command:
```bash
kubectl get rc/web service/gateway-rc pods/email-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespac... |
Create a new config map named monitoring-config using the specified files | Command:
```bash
kubectl create configmap monitoring-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a co... |
Add the label 'env=staging' to the pod named 'vpn' | Command:
```bash
kubectl label pods vpn env=staging
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If tr... |
Create a service for a replica set named "ruby" that serves traffic on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose rs ruby --port=8010 --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 the specified port. A... |
Forward local ports to a pod selected by a deployment | Command:
```bash
kubectl port-forward deployment/api-server-deployment 9090 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 b... |
Create a pod named "hazelcast" using the Golang image and expose port 7000 | Command:
```bash
kubectl run hazelcast --image=golang --port=7000
```
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... |
Add a taint with the key 'cpu-type' on nodes that have the label team=devops | Command:
```bash
kubectl taint node -l team=devops cpu-type=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": "Out... |
Start a new pod named "nginx" using the "python" image, but override its specification using the provided JSON. | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "feature-branch-2.3.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] [--comma... |
Forward traffic from local port 6379 to port 8088 in the pod named "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 custom TLS server name to use for validation for the 'cluster-gamma' cluster entry to 'cluster-beta' | Command:
```bash
kubectl config set-cluster cluster-gamma --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] [--certificat... |
Update the image of all containers in the daemonset "app-v2" to "wordpress:5.8.1" | Command:
```bash
kubectl set image daemonset app-v2 *=wordpress:5.8.1
```
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... |
Add a taint with the key 'hardware' and value 'kube-master-9:PreferNoSchedule' on nodes having the label 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 hardware=kube-master-9: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"... |
Forward local port 5000 to port 8088 in the pod named 'cdn-service-pod' | Command:
```bash
kubectl port-forward pod/cdn-service-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 au... |
List the replication controller, service, and pods for the 'web' and 'database' resources | Command:
```bash
kubectl get rc/web service/database-rc pods/database-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 y... |
Start streaming the logs of the "nebula-navigator" container in the "api-service-pod" pod. | Command:
```bash
kubectl logs -f -c nebula-navigator api-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--containe... |
Create a new ClusterIP service named monitoring-service-clusterip with the TCP port 8888 forwarding to port 27017 | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=8888:27017
```
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": ... |
Create a new ClusterIP service named messaging-service-clusterip and map the port 8000 on the service to the port 5432 on the backend. | Command:
```bash
kubectl create service clusterip messaging-service-clusterip --tcp=8000: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": "-... |
Create a service for the replicated python deployment with the following parameters: | Command:
```bash
kubectl expose rc python --port=8084 --target-port=637900
```
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 copy of the auth-service-pod with a debug container and updated container images | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=debug-image-web --image=debian --set-image=worker=my-custom-worker:1.2.3,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects ... |
Set up local port forwarding to listen on port 8888 and forward data to port 8081 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 8888 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 au... |
Set the CPU and memory limits to 200m and 512Mi respectively, and set the CPU and memory requests to 2 and 256Mi respectively for all containers in the go deployment. | Command:
```bash
kubectl set resources deployment go --limits=cpu=200m,memory=512Mi --requests=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, b... |
Create a deployment named prometheus with the postgres image | Command:
```bash
kubectl create deployment prometheus --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|ya... |
Forward local port 8888 to the targetPort of the "https" port in the selected pod of the "email-service" service | Command:
```bash
kubectl port-forward service/email-service 8888:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Create an ingress named "web-ingress" that routes requests to "site.com/module" to the service "svc1" on port 8088, using the TLS secret "my-cert". | Command:
```bash
kubectl create ingress web-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": "", "usage": ... |
Set the cluster field in a specific context to a given cluster | Command:
```bash
kubectl config set contexts.client-2-context.cluster web-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you ... |
Update the image of all containers in the daemonset "namespace-1" to "node:14.17.3" | Command:
```bash
kubectl set image daemonset namespace-1 *=node:14.17.3
```
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:
... |
Start a golang pod named 'hazelcast' with the image 'golang' and expose port 8082 | Command:
```bash
kubectl run hazelcast --image=golang --port=8082
```
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... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/env-vars deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions ... |
Create a deployment named "app" using the "mongo" image and expose port 8888 | Command:
```bash
kubectl create deployment app --image=mongo --port=8888
```
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|... |
Execute the command "pip --version" in the first pod of the "scheduler-service" service. | Command:
```bash
kubectl exec svc/scheduler-service -- pip --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/git-credentials-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 ... |
Describe a specific node in the cluster | Command:
```bash
kubectl describe nodes controller-node-10.controller-cluster.net
```
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 o... |
Set or update exec auth plugin environment variables for the "system" entry | Command:
```bash
kubectl config set-credentials system --exec-env=key1=val1 --exec-env=key2=val2
```
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... |
Forward local ports to a pod. | Command:
```bash
kubectl port-forward pod/security-service-pod 8000 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 select... |
Forward traffic from port 5432 on all addresses to port 8088 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 5432: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 po... |
Change the cluster field of the service-account-context context to "moon-cluster". | Command:
```bash
kubectl config set contexts.service-account-context.cluster moon-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new va... |
Retrieve the snapshot logs from the container named 'api-service-pod-1' of the 'order-processing-deployment' deployment. | Command:
```bash
kubectl logs deployment/order-processing-deployment -c api-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... |
Copy the contents of the /var/run/secrets/kubernetes.io/serviceaccount/ directory from the remote pod "payment-gateway-pod-19" in the "rook-ceph" namespace to the /tmp/bar directory on your local machine. | Command:
```bash
kubectl cp rook-ceph/payment-gateway-pod-19:/var/run/secrets/kubernetes.io/serviceaccount/ /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": ... |
forward port 9090 on all addresses to port 6379 in the backend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 9090: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 ... |
Forward traffic from port 6379 on all addresses to port 8081 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 6379:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wi... |
Create a job that runs a Python command using the Python image. | Command:
```bash
kubectl create job indexing --image=python -- python
```
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: ... |
Forward port 8088 in the e-commerce-pod to port 6379 locally for listening | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
Retrieve the snapshot logs from the container load-balancer-deployment-1 of the auth-service-pod deployment using the command 'kubectl logs deployment/load-balancer-deployment -c auth-service-pod-1' | Command:
```bash
kubectl logs deployment/load-balancer-deployment -c auth-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.