prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Update the pod named 'backend' by adding a label 'tier' with the value 'frontend' | Command:
```bash
kubectl label pods backend tier=frontend
```
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": ... |
Remove the 'release' label from the 'vpn' pod | Command:
```bash
kubectl label pods vpn 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 log-config with specified keys from given files | Command:
```bash
kubectl create configmap log-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/properties/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 c... |
Begin streaming the logs of the warp-drive container in the chat-app-pod pod | Command:
```bash
kubectl logs -f -c warp-drive 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", "shor... |
Create a new config map named kube-system-config with two keys: 'conf' and 'data', which contain the contents of the specified files '/path/to/properties/file1.txt' and '/path/to/parameters/file2.txt', respectively. | Command:
```bash
kubectl create configmap kube-system-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When crea... |
Add a taint with the key 'dedicated' on nodes having the label feature=feature-xyz | Command:
```bash
kubectl taint node -l feature=feature-xyz dedicated=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Remove the annotation named 'description' from the pod named 'monitoring' | Command:
```bash
kubectl annotate pods monitoring description-
```
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 stri... |
Display the metrics for the storage-node-13 node. | Command:
```bash
kubectl top node storage-node-13
```
What it does:
Display resource (CPU/memory) usage of nodes.
The top-node command allows you to see the resource consumption of nodes.
Syntax:
`kubectl top node [NAME | -l label]`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selecto... |
Create a new pod named "hazelcast" using the amazonlinux image, and configure the container within the pod to expose port 8181. | Command:
```bash
kubectl run hazelcast --image=amazonlinux --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":... |
Scale the replica set named 'mysql' to 7 replicas | Command:
```bash
kubectl scale --replicas=7 rs/mysql
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is validated befo... |
Import specific keys from a configmap into a deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/monitoring-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 de... |
List a single pod in YAML format | Command:
```bash
kubectl get -o yaml pod analytics-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 you will only see re... |
List deployments in YAML output format, specifically for the "feature-branch-2.3.0" version of the "sandbox-apps" API group. | Command:
```bash
kubectl get deployments.feature-branch-2.3.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 nam... |
List the resources of different types by their names | Command:
```bash
kubectl get rc/web service/database-rc pods/security-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 name... |
Set the resource request and limits for all containers in a deployment named "go". | Command:
```bash
kubectl set resources deployment go --limits=cpu=200m,memory=512Mi --requests=cpu=500m,memory=512Mi
```
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... |
Add a taint with key 'disktype' on nodes having label service=auth | Command:
```bash
kubectl taint node -l service=auth disktype=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": "Ou... |
Remove all the taints with the key 'workload' from the node 'backup-node-14' | Command:
```bash
kubectl taint nodes backup-node-14 workload-
```
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|ya... |
Create a pod named "hazelcast" using the "mongo" image and expose port 9091 | Command:
```bash
kubectl run hazelcast --image=mongo --port=9091
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Display only the most recent 20 lines of logs for the "analytics-pod" pod. | Command:
```bash
kubectl logs --tail=20 analytics-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": "-... |
Create a service for the replicated hazelcast using the replica set 'hazelcast', to serve on port 8081 and connect to the containers on port 9092. | Command:
```bash
kubectl expose rs hazelcast --port=8081 --target-port=909200
```
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... |
Create a role named "admin_role" with "ResourceName" specified | Command:
```bash
kubectl create role admin_role --verb=get --resource=pods --resource-name=order-fulfillment --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=ser... |
Create a job with a command | Command:
```bash
kubectl create job scaling-job --image=ubuntu -- docker run -it ubuntu
```
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": "Outpu... |
Forward local port 5000 to port 8088 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-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 a... |
Apply the annotation 'security-scan-status=pass' to the pod 'auth' | Command:
```bash
kubectl annotate pods auth security-scan-status=pass
```
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 arbitra... |
Create a role named 'admin_role' with the API Group specified by allowing patch, watch, and exec verbs on the 'tokenreviews.authentication.k8s.io' resource. | Command:
```bash
kubectl create role admin_role --verb=patch,watch,exec --resource=tokenreviews.authentication.k8s.io
```
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|none]`
He... |
Create an ingress called 'web-ingress' that redirects requests for foo.com/bar to svc1 on port 5001 | Command:
```bash
kubectl create ingress web-ingress --rule="foo.com/bar=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": "", "usage": "Out... |
Forward local ports to a pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8888 5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Create a new ExternalName service named "external-dns-service" with the external name "document-company.com" | Command:
```bash
kubectl create service externalname external-dns-service --external-name document-company.com
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference ser... |
Create a job named 'indexing' with the nginx image, running the command "nginx" | Command:
```bash
kubectl create job indexing --image=nginx -- nginx
```
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: js... |
Create a deployment named 'ingress' with 6 replicas, running the 'jenkins' image. | Command:
```bash
kubectl create deployment ingress --image=jenkins --replicas=6
```
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... |
Copy the local file "/tmp/foo" to the remote pod "security-scanner-pod-18" in the "kube-proxy" namespace, and save it as "/tmp/bar". | Command:
```bash
kubectl cp /tmp/foo kube-proxy/security-scanner-pod-18::/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use th... |
Check if you have permission to list the "load-testing-job" job in the "namespace-1" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/load-testing-job -n namespace-1
```
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 U... |
Forward traffic from local port 8888 to port 8088 in a pod selected by the deployment "search-engine-deployment" | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8888 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Add a taint with the key 'cpu-type' on nodes that have the label zone=us-east-1. | Command:
```bash
kubectl taint node -l zone=us-east-1 cpu-type=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": "... |
Return the snapshot logs of the container monitoring-stack-deployment-1 in the e-commerce-pod deployment. | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c e-commerce-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:... |
Start streaming the logs of the astro-container container in the proxy-server-pod pod. | Command:
```bash
kubectl logs -f -c astro-container proxy-server-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--containe... |
Return the snapshot of the previous terminated "nebula-navigator" container logs from the "proxy-server-pod" pod. | Command:
```bash
kubectl logs -p -c nebula-navigator proxy-server-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--contain... |
Forward local port to a specific port in the pod | Command:
```bash
kubectl port-forward pod/mypod :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 automatically. T... |
Forward local port 8888 to port 8088 in the pod selected by the authentication-service-deployment deployment | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 8888 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, ... |
Add a taint with key 'disktype' on nodes having label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp disktype=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": "", "usag... |
Set the custom TLS server name to "testing-cluster" for the cluster entry "cluster-alpha" | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=testing-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifi... |
Forward traffic from port 8888 on all addresses to port 8000 in the pod named "log-aggregator-pod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-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 po... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/ldap-credentials-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 m... |
Import the CONFIG_FILE_PATH key from the log-config config map into the web-app-deployment deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/log-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 definition... |
Create a deployment named 'jenkins' using the 'ethereum/client-go' image and expose port 6379 | Command:
```bash
kubectl create deployment jenkins --image=ethereum/client-go --port=6379
```
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 form... |
Forward port 8000 on your localhost and IP 10.19.21.23 to port 8080 in the pod named mypod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 criteria, a p... |
Import specific keys from a config map to an environment variable in a deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/namespace-config 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 v... |
Forward the local port 8088 to the targetPort of the "https" service port in a pod selected by the "order-service" service | Command:
```bash
kubectl port-forward service/order-service 8088:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Forward port 8081 on all addresses to port 8081 in the backend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8081: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 ... |
Listen and forward traffic from port 5432 on all addresses to port 8888 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5432: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 ... |
Create a deployment named "mattermost" using the image "postgres" and run the command "psql" | Command:
```bash
kubectl create deployment mattermost --image=postgres -- psql
```
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:... |
Retrieve the snapshot logs from the container "search-engine-deployment-1" of the deployment named "web-app-pod". | Command:
```bash
kubectl logs deployment/search-engine-deployment -c web-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:
"flag... |
Remove the specified environment variable(s) for a specific user's exec auth configuration. | Command:
```bash
kubectl config set-credentials robot-user --exec-env=var-to-remove-
```
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... |
Add a taint with key 'special' on nodes having label instance=app-instance-1 | Command:
```bash
kubectl taint node -l instance=app-instance-1 special=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": "",... |
Update the deployment 'search-engine-deployment' by adding a new environment variable called MONGO_URI with the value "mongodb://localhost:27017/mydb" | Command:
```bash
kubectl set env deployment/search-engine-deployment MONGO_URI=mongodb://localhost:27017/mydb
```
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 ... |
Forward port 8088 on all addresses to port 8080 in the pod "analytics-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-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 the criteria, a pod wil... |
Create a job named `security-scan-job` using the `ruby` container image, and run the `ruby --version` command within the job. | Command:
```bash
kubectl create job security-scan-job --image=ruby -- ruby --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
Create a pod named hazelcast using the mcr.microsoft.com/dotnet/core/runtime image and expose port 8083. | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --port=8083
```
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...... |
Copy the ~/.config/kube local file to the /tmp/bar_dir directory inside the 'front-end-pod-12' pod in the metallb-system namespace. | Command:
```bash
kubectl cp ~/.config/kube metallb-system/front-end-pod-12:/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, ... |
Add a taint to the nodes labeled 'namespace=mynamespace' with the key 'zone' and the value 'kube-master-9:PreferNoSchedule' | Command:
```bash
kubectl taint node -l namespace=mynamespace zone=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": "", "usa... |
Switch to the raw terminal mode for the 'cdn-service-pod' pod, targeting the 'stardust-shuttle' container | Command:
```bash
kubectl attach cdn-service-pod -c stardust-shuttle -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. I... |
Add a taint with key 'cpu-type' on nodes having label zone=us-east-1, specifically on the node 'monitoring-node-15' with the effect of 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l zone=us-east-1 cpu-type=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": "", "u... |
Set exec auth plugin args for "saas-admin" entry | Command:
```bash
kubectl config set-credentials saas-admin --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... |
Forward local port 9090 to port 8080 in the security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 9090 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 be select... |
Create a single ingress called 'external-ingress' that directs requests to site.com/module to svc1:27017 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/module=svc1:27017,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... |
Forward traffic from local ports 8888 and 6000 to ports 5000 and 6000 of a pod selected by the 'api-server-deployment' deployment | Command:
```bash
kubectl port-forward deployment/api-server-deployment 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 b... |
Auto scale the deployment "frontend" with a minimum number of 5 pods and a maximum number of 12 pods, using the default autoscaling policy. | Command:
```bash
kubectl autoscale deployment frontend --min=5 --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 use... |
Create a new config map named 'monitoring-config' and include the settings from '/path/to/configs/file1.txt' and the key2 from '/path/to/preferences/file2.txt' | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/configs/file1.txt --from-file=key2=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Get the output from running the 'geth' command in the first container of the first pod of the 'web-service' service. | Command:
```bash
kubectl exec svc/web-service -- geth
```
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... |
List the deployments in the "custom-version" version of the "custom-apps" API group in the JSON output format. | Command:
```bash
kubectl get deployments.custom-version.custom-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... |
Check if the current user has permission to list the "log-analysis-job" job in the "development" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/log-analysis-job -n development
```
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 U... |
Taint nodes with label 'tier=frontend' with the taint key 'hardware' and value 'gpu-node-12' with effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l tier=frontend hardware=gpu-node-12:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Delete the pods and services with the names "media-stream" and "proxy-server" | Command:
```bash
kubectl delete pod,service media-stream proxy-server
```
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... |
Create an ingress called 'private-api-ingress' that directs requests to website.com/bar to the service svc1 on port 27017, and use the TLS secret "my-cert". | Command:
```bash
kubectl create ingress private-api-ingress --rule="website.com/bar=svc1:27017,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": "", ... |
create a service for a replicated nginx, serving on port 5000 and connecting to containers on port 8888 | Command:
```bash
kubectl expose rc nginx --port=5000 --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 port. ... |
Update the annotation of the pod 'frontend' with the key 'env' and the value 'staging' | Command:
```bash
kubectl annotate pods frontend 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 ... |
Create a service for the nginx-controller replication controller defined in the "nginx-controller.yaml" file | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=5432 --target-port=909200
```
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 ... |
Add a label to the pod named 'frontend' with the key 'role' and the value 'cache' | Command:
```bash
kubectl label pods frontend 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": "I... |
Set the custom TLS server name for the cluster-beta cluster entry to "moon-cluster". | Command:
```bash
kubectl config set-cluster cluster-beta --tls-server-name=moon-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... |
Copy the file `/tmp/foo` from the pod named `message-broker-pod-15` to the local directory `/etc/kubernetes` | Command:
```bash
kubectl cp velero/message-broker-pod-15:/tmp/foo /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... |
Update the environment variable 'DB_PASSWORD' for the deployment 'payment-processor-deployment' | Command:
```bash
kubectl set env deployment/payment-processor-deployment DB_PASSWORD=secretpassword
```
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 mor... |
Listen on port 3000 locally and forward data to/from port 9090 in the cdn-service-pod pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 3000 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Retrieve the documentation for the `serviceName` field within the `status` section of the `pods` resource. | Command:
```bash
kubectl explain resource=pods.status.serviceName
```
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 t... |
Execute the command 'nginx -g "daemon off;"' in the pod named 'auth-service-pod' with the container named 'stardust-shuttle' and retrieve the output. | Command:
```bash
kubectl exec auth-service-pod -c stardust-shuttle -- nginx -g "daemon off;"
```
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... |
Create a copy of the 'chat-app-pod' pod named 'debug-image-api' and change all container images to 'mongo' | Command:
```bash
kubectl debug chat-app-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 reso... |
Create a service for the 'hazelcast' replication controller, which serves on port 8010 and connects to the containers on port 700000 | Command:
```bash
kubectl expose rc hazelcast --port=8010 --target-port=700000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Embed the certificate authority data for the "star-cluster" cluster entry in the kubeconfig file. | Command:
```bash
kubectl config set-cluster star-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 set... |
Retrieve the logs of container 'proxy-server-pod-1' from the deployment named 'analytics-platform-deployment' | Command:
```bash
kubectl logs deployment/analytics-platform-deployment -c proxy-server-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 fl... |
Create an ingress called 'default-ingress' that directs requests to a specific path of a website to a service with TLS encryption | Command:
```bash
kubectl create ingress default-ingress --rule="website.com/bar=svc1:7000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
List the specified resources and their details | Command:
```bash
kubectl get rc/web service/api-service-rc pods/api-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 namesp... |
Create a new NodePort service named security-service-nodeport that maps port 8082 on all nodes to port 8000 on the service | Command:
```bash
kubectl create service nodeport security-service-nodeport --tcp=8082:8000
```
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", "defa... |
Create a role binding named 'admin' that binds the 'admin' cluster role to the 'admin' user, 'devops-user' user, and 'operations-team' group. | Command:
```bash
kubectl create rolebinding admin --clusterrole=admin --user=admin --user=devops-user --group=operations-team
```
What it does:
Create a role binding for a particular role or cluster role.
Syntax:
`kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--... |
Create an autoscaling policy for the 'security' deployment with a minimum of 2 pods and a maximum of 9 pods. | Command:
```bash
kubectl autoscale deployment security --min=2 --max=9
```
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... |
Get the output from the first pod of the replica set named elasticsearch | Command:
```bash
kubectl attach rs/elasticsearch
```
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, use the kubect... |
Create a new ClusterIP service named inventory-service-clusterip with a TCP port mapping from 9090 to 8443. | Command:
```bash
kubectl create service clusterip inventory-service-clusterip --tcp=9090: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": "-... |
Forward traffic from port 8888 on all addresses to port 6379 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8888: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 ... |
Set a custom TLS server name for the prod-cluster cluster entry. | Command:
```bash
kubectl config set-cluster prod-cluster --tls-server-name=kube-cluster-2
```
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... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/mypod 8000: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 automaticall... |
Start a pod named nginx using the Ubuntu image, but customize the pod specification by providing partial values from a JSON configuration file | Command:
```bash
kubectl run nginx --image=ubuntu --overrides='{ "apiVersion": "v3.0.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] -- [COMMAN... |
Create an ingress called 'app-gateway-ingress' that directs requests for testing.com/example to svc1:9000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="testing.com/example=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": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.