prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Partially update the node using the strategic merge patch specified in the "kubeadm-config.yaml" file | Command:
```bash
kubectl patch -f kubeadm-config.yaml -p '{"spec":{"containers":[{"name":"container-name", "resources":{"limits":{"cpu":"200m"}}}]}'
```
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 patc... |
Import the 'api_key' key from the 'ui-config' ConfigMap into the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/ui-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 definitions in one o... |
Create a deployment named nats with the ruby image | Command:
```bash
kubectl create deployment nats --image=ruby
```
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|name|go... |
Create a new config map named env-vars with keys "properties" and "key1" using the specified file paths (/path/to/profiles/file1.txt and /path/to/configurations/file2.txt) as the values. | Command:
```bash
kubectl create configmap env-vars --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creati... |
Create a new job named test-job using the log-rotation cron job as a template. | Command:
```bash
kubectl create job test-job --from=cronjob/log-rotation
```
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 o... |
Update the 'storage-node-13' node with the provided patch | Command:
```bash
kubectl patch node storage-node-13 -p $'data:\n key: new-value'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful f... |
Listen on port 8080 on all addresses and forward the traffic to port 8081 in the 'mypod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8080:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Setup autoscaling for the "auth" replication controller with a target CPU utilization of 90%, allowing the number of pods to scale between 1 and 7. | Command:
```bash
kubectl autoscale rc auth --max=7 --cpu-percent=90
```
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 th... |
Execute the command 'apk add curl' inside the first container of the pod 'monitoring-service' in the 'svc' namespace and get the output. | Command:
```bash
kubectl exec svc/monitoring-service -- apk add curl
```
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... |
Auto scale the replication controller "media-stream" with a target CPU utilization of 20% | Command:
```bash
kubectl autoscale rc media-stream --max=7 --cpu-percent=20
```
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... |
Taint nodes with the label "region=eu-west-2" with a "PreferNoSchedule" taint using the key "cpu-type" | Command:
```bash
kubectl taint node -l region=eu-west-2 cpu-type=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... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=log_level --from=configmap/db-config deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Attach to a running pod and get its output | Command:
```bash
kubectl attach mypod
```
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 kubectl.kubernete... |
Import the specific keys "log_level" from the config map "app-name-config" and set them as environment variables in the "scheduler-app-deployment" deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-name-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 variable defini... |
Execute the 'redis-server' command in the 'cosmic-container' from the 'email-service-pod' pod and get the output. | Command:
```bash
kubectl exec email-service-pod -c cosmic-container -- redis-server
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Copy the local directory /tmp/foo_dir_dir to the remote pod named cache-pod-5, at the path /tmp/bar_dir_dir in the default namespace | Command:
```bash
kubectl cp /tmp/foo_dir_dir cache-pod-5:/tmp/bar_dir_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 kubect... |
Create a new config map named api-config using the key=value pairs from the file located at path/to/preferences. | Command:
```bash
kubectl create configmap api-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 basenam... |
Apply a taint with key 'hardware' on nodes that have the label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel hardware=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": "Outpu... |
Check if the current authenticated user has permission to list the cron-job job in the kube-node-lease namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/cron-job -n kube-node-lease
```
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... |
Run the command 'geth attach' in the 'astro-container' from the pod 'proxy-server-pod' and get the output | Command:
```bash
kubectl exec proxy-server-pod -c astro-container -- geth attach
```
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 om... |
Create a copy of the 'backend-pod' pod and start a debug session in the 'debug-image-web' container, changing the command to 'sh' | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-web --container=lunar-launcher -- 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 de... |
Set the environment variable API_KEY with the value "your-api-key" on the 'user-management-deployment' deployment | Command:
```bash
kubectl set env deployment/user-management-deployment API_KEY=your-api-key
```
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 te... |
Create an ingress resource named 'app2-ingress' that routes requests from 'testing.com/example' to service 'svc1' on port 8443 | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/example=svc1:8443,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": "", "usa... |
Create a cluster role named "foo" with specified resource names | Command:
```bash
kubectl create clusterrole foo --verb=patch --resource=pods --resource-name=app-worker-1 --resource-name=app-analytics
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`... |
Replace a pod using the data in the specified settings.json file | Command:
```bash
kubectl replace -f ./settings.json
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replace -f FILENA... |
Create a cluster role binding named 'custom_role' that grants the 'custom_role' cluster role to the users 'admin', 'devops-user', and the group 'operations-team' | Command:
```bash
kubectl create clusterrolebinding custom_role --clusterrole=custom_role --user=admin --user=devops-user --group=operations-team
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=... |
Copy the local file "/tmp/foo" to the remote pod "kube-node-lease/task-processor-pod-17" in the namespace, and place it in the directory "/tmp/bar_dir". | Command:
```bash
kubectl cp :/tmp/foo kube-node-lease/task-processor-pod-17:/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,... |
Expose the Wordpress deployment as a service on port 5000, connecting to the containers on port 500000. | Command:
```bash
kubectl expose deployment wordpress --port=5000 --target-port=500000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Get the output from running the 'nginx' command in the 'cyber-sleuth' container of the 'web-app-pod' pod | Command:
```bash
kubectl exec web-app-pod -c cyber-sleuth -- nginx
```
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... |
Import specific keys from a config map to a deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-config 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 i... |
List the deployments in YAML output format, using the "v1.1.1" version of the "apps" API group. | Command:
```bash
kubectl get deployments.v1.1.1.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 will only ... |
List the deployments in the "legacy-1.0.0" version of the "experimental-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.legacy-1.0.0.experimental-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 namesp... |
Enable the OpenID Connect auth provider for the "api-user" entry with the following additional args: client-id=foo and client-secret=bar. | Command:
```bash
kubectl config set-credentials api-user --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
```
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:
--cl... |
Embed the certificate authority data for the "staging-cluster" cluster entry | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/cloud-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... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/proxy-server-pod :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 autom... |
Set the resource requests and limits for all containers in the redis deployment. | Command:
```bash
kubectl set resources deployment redis --limits=cpu=200m,memory=512Mi --requests=cpu=3,memory=2Gi
```
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, ... |
Create a copy of a pod with a debug container and different container images | Command:
```bash
kubectl debug mypod -it --copy-to=debug-image-app --image=debian --set-image=app=app:debug,proxy=nginx:1.21
```
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... |
Set the custom TLS server name to "testing-cluster" for the "testing-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster testing-cluster --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] [--certi... |
Set the environment variables for a deployment using the values from a secret. | Command:
```bash
kubectl set env --from=secret/payment-gateway-secret deployment/email-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 o... |
Set the service account of the deployment "user-management-deployment" to "fluentd" | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment fluentd
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`ku... |
Create a deployment named "registry" with 6 replicas using the Redis image. | Command:
```bash
kubectl create deployment registry --image=redis --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:... |
Create a new ClusterIP service named messaging-service-clusterip that maps port 9092 on the service to port 8000 on the target pods. | Command:
```bash
kubectl create service clusterip messaging-service-clusterip --tcp=9092:8000
```
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": "-... |
Switch to raw terminal mode and connect to the 'bash' shell inside the 'frontend-pod' pod | Command:
```bash
kubectl exec frontend-pod -c warp-drive -i -t -- bash -il
```
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,... |
Create a new secret named git-credentials-secret and add the file at path/to/settings as a key in the secret | Command:
```bash
kubectl create secret generic git-credentials-secret --from-file=path/to/settings
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basen... |
Copy the ~/.config/kube directory from the remote pod "image-resizer-pod-20" to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp kube-server/image-resizer-pod-20:~/.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,... |
Embed the certificate authority data for the 'sun-cluster' cluster entry | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/app-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-c... |
Create a service named "ubuntu" for the deployment, which serves on port 8088 and connects to the containers on port 808300 | Command:
```bash
kubectl expose deployment ubuntu --port=8088 --target-port=808300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specifi... |
Create an ingress called 'app1-ingress' with a rule that directs requests from website.com/input to svc1:8010 using the tls secret 'my-cert' | Command:
```bash
kubectl create ingress app1-ingress --rule="website.com/input=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": "", "usage... |
Get output from running the 'mysqld' command in quantum-quark from pod proxy-server-pod | Command:
```bash
kubectl exec proxy-server-pod -c quantum-quark -- mysqld
```
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, ... |
expose a deployment as a service on port 8088, connecting to containers on port 543200 | Command:
```bash
kubectl expose deployment hazelcast --port=8088 --target-port=543200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Create an ingress with TLS enabled and different path types. | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="website.com/=svc:https,tls" \
--rule="foo.com/path/subpath*=othersvc:8000"
```
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": "-... |
Create an ingress called 'website-ingress' with a routing rule that directs requests from testing.com/example to the service svc1 on port 8888 using a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/example=svc1:8888,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 new config map named "global-config" with the keys "conf" and "data" using the files "file1.txt" and "file2.txt" for the respective values | Command:
```bash
kubectl create configmap global-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/configurations/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When c... |
Update the specified node by merging the changes from "node-settings.json" using a strategic merge patch | Command:
```bash
kubectl patch -f node-settings.json -p '{"spec":{"replicas":3}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful f... |
Create a deployment named proxy using the postgres image and expose port 5000 | Command:
```bash
kubectl create deployment proxy --image=postgres --port=5000
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
Run the 'postgres' command in the 'astro-container' from the 'gateway-pod' and retrieve the output | Command:
```bash
kubectl exec gateway-pod -c astro-container -- postgres
```
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... |
Create a cluster role named "default_role" with the following specifications: | Command:
```bash
kubectl create clusterrole default_role --verb=proxy --resource=configmaps --resource-name=monitoring-prometheus --resource-name=log-aggregator
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry... |
import specific keys from a config map | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config-prod 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 def... |
Delete all pods and services with the label region=eu-west-2. | Command:
```bash
kubectl delete pods,services -l region=eu-west-2
```
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 sel... |
Begin streaming the logs of the warp-drive container in the pod named proxy-service-pod | Command:
```bash
kubectl logs -f -c warp-drive proxy-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", ... |
Listen on port 6379 locally and forward data to port 8888 in the pod selected by the API server deployment. | Command:
```bash
kubectl port-forward deployment/api-server-deployment 6379 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 b... |
Forward port 8888 on the localhost and IP 10.19.21.23 to port 8888 in the pod named 'mypod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888: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 p... |
Retrieve the logs from the 'time-machine' container of the 'monitoring-pod' pod that was previously terminated. | Command:
```bash
kubectl logs -p -c time-machine monitoring-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", "... |
Retrieve the output from running the 'kafka-topics --list' command on the first container of the order-processing-deployment deployment. | Command:
```bash
kubectl exec deploy/order-processing-deployment -- kafka-topics --list
```
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... |
Listen on port 8000 on all addresses and forward the traffic to port 8088 in the proxy-server-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 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 ... |
Update the annotations of a pod based on the information in the "conf.json" file. | Command:
```bash
kubectl annotate -f conf.json SLA='99.9% uptime'
```
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 s... |
Add a taint with key 'dedicated' and value 'monitoring-node-15:PreferNoSchedule' on nodes having the label role=database. | Command:
```bash
kubectl taint node -l role=database dedicated=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... |
Create an ingress called 'external-ingress' that directs requests to site.com/example to svc1:8084 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="site.com/example=svc1:8084,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... |
Create a new deployment named 'my-dep' using the 'ruby' image and expose port '3000' | Command:
```bash
kubectl create deployment my-dep --image=ruby --port=3000
```
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: jso... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/api-config deployment/email-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... |
Set the service account of the deployment 'cache-cluster-deployment' to 'metrics-server' | Command:
```bash
kubectl set serviceaccount deployment cache-cluster-deployment metrics-server
```
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... |
Import the API_KEY key from the global-config configmap and set it as an environment variable in the mydeployment deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/global-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or ... |
Delete the pods and services with the names "log-aggregator" and "vpn" | Command:
```bash
kubectl delete pod,service log-aggregator vpn
```
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 select... |
Update the cluster field in the team-alpha-context context to "sun-cluster" | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster sun-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... |
Add a taint with the key 'cpu-type' and value 'storage-node-13:PreferNoSchedule' on all nodes having the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice cpu-type=storage-node-13: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": ""... |
Get the output from running the 'ash' command in the warp-drive container of the chat-app-pod | Command:
```bash
kubectl exec chat-app-pod -c warp-drive -- ash
```
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 ku... |
Create a NodePort service named auth-service-nodeport | Command:
```bash
kubectl create service nodeport auth-service-nodeport --tcp=5000:6379
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default"... |
Forward local port 5432 to the target port of the "https" service port in the selected pod of the "api-service" service | Command:
```bash
kubectl port-forward service/api-service 5432: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 a... |
Update the label of the pod 'proxy-server' to have the key 'component' and the value 'api' | Command:
```bash
kubectl label pods proxy-server component=api
```
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", "usa... |
Add a taint on nodes labeled 'owner=john-doe' with the key 'cpu-type' and the value 'kube-master-9:PreferNoSchedule' | Command:
```bash
kubectl taint node -l owner=john-doe cpu-type=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"... |
Get output from the 'geth' command running in the pod named 'monitoring-pod', using the first container. | Command:
```bash
kubectl exec monitoring-pod -- 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.kuber... |
Set the server field on the cluster-gamma cluster to https://1.2.3.4 | Command:
```bash
kubectl config set clusters.cluster-gamma.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 ... |
Create a new config map named api-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a confi... |
Describe the pods that have the label 'myLabel' | Command:
```bash
kubectl describe po -l myLabel
```
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, provide a nam... |
Auto scale the replication controller "cdn" with a target CPU utilization of 40% and a minimum of 1 pod and a maximum of 5 pods. | Command:
```bash
kubectl autoscale rc cdn --max=5 --cpu-percent=40
```
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... |
Set the CPU and memory limits to 200m and 512Mi respectively, and the CPU and memory requests to 200m and 1Gi respectively, for all containers in the 'redis' deployment. | Command:
```bash
kubectl set resources deployment redis --limits=cpu=200m,memory=512Mi --requests=cpu=200m,memory=1Gi
```
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 requeste... |
Add a taint with the key 'disktype' and value 'app-node-6:PreferNoSchedule' on nodes that have the label 'project=project-alpha' | Command:
```bash
kubectl taint node -l project=project-alpha disktype=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": "", "us... |
Create a pod disruption budget named "load-balancer-pdb" that selects all pods with the label "role=worker" and requires at least four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=role=worker --min-available=4
```
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 ... |
Set up certificate authority data for the star-cluster cluster entry | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/cloud-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... |
Check the status of the rollout for the daemonset named 'development' | Command:
```bash
kubectl rollout status daemonset/development
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Import the specific key 'REDIS_HOST' from the config map 'kube-system-config' and set it as an environment variable in the deployment 'authentication-service-deployment'. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/kube-system-config deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment va... |
Forward local traffic on port 3000 to port 8088 in the frontend-pod pod, listening on localhost and IP 10.19.21.23. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 3000: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 criter... |
Copy the contents of the /var/run/secrets/kubernetes.io/serviceaccount/ directory from the ingress-controller-pod-8 pod in the ingress-nginx namespace to the /tmp/bar_dir directory on your local machine. | Command:
```bash
kubectl cp ingress-nginx/ingress-controller-pod-8:/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": "",... |
Create an ingress named 'api-v1-ingress' that routes requests to site.com/module to the service svc1 on port 8888, and use the TLS certificate secret named "my-cert". | Command:
```bash
kubectl create ingress api-v1-ingress --rule="site.com/module=svc1:8888,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Create a job named "log-processing-job" using the "wordpress" image with the command "apache2ctl -D FOREGROUND" | Command:
```bash
kubectl create job log-processing-job --image=wordpress -- apache2ctl -D FOREGROUND
```
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": "", "u... |
Create a new secret named ssl-key-secret with keys for each file in the folder "path/to/data" | Command:
```bash
kubectl create secret generic ssl-key-secret --from-file=path/to/data
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of the f... |
Open the payment-service for editing using the Atom editor | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/payment-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables... |
Create a new secret with files from a specific folder | Command:
```bash
kubectl create secret generic app-config-secret --from-file=path/to/parameters
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename... |
Retrieve the snapshot logs from the container named 'payment-gateway-pod-1' of the 'email-server-deployment' deployment. | Command:
```bash
kubectl logs deployment/email-server-deployment -c payment-gateway-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags... |
Create an ingress called 'private-ingress' that directs requests to testing.com/input to svc1:8000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="testing.com/input=svc1:8000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.