prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a service for a replicated python using replica set, expose port 9000 and connect it to the containers on port 8080 | Command:
```bash
kubectl expose rs python --port=9000 --target-port=808800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Forward local port 5432 to port 9090 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5432: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... |
Forward traffic from port 8888 on localhost and IP 10.19.21.23 to port 8088 in the pod named 'cdn-service-pod'. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 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 cri... |
Create a pod named "hazelcast" with the alpine image and set the labels "app=alpine" and "env=prod" | Command:
```bash
kubectl run hazelcast --image=alpine --labels="app=alpine,env=prod"
```
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 ... |
Delete both pods and services with the names "database" and "analytics" | Command:
```bash
kubectl delete pod,service database analytics
```
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... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ local file to the /tmp/bar directory inside the security-scanner-pod-18 pod, using the message-broker container. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ security-scanner-pod-18:/tmp/bar -c message-broker
```
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": "", ... |
Update the 'storage-node-13' node with a taint key 'datacenter' and value 'dc-1' and effect 'NoExecute' | Command:
```bash
kubectl taint nodes storage-node-13 datacenter=dc-1:NoExecute
```
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... |
Get the documentation of the "metadata.name" field of the "services" resource. | Command:
```bash
kubectl explain resource=services.metadata.name
```
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... |
Create a pod disruption budget named logging-pdb that will select all pods with the owner=team-1 label and require a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=owner=team-1 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dr... |
Create a copy of a pod, adding a debug container and changing container images | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-app --image=debian --set-image=scheduler=my-scheduler:1.0,api=api:v2
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Get the output of the 'elasticsearch-plugin --list' command from the 'cosmic-container' in the 'api-service-pod' | Command:
```bash
kubectl exec api-service-pod -c cosmic-container -- elasticsearch-plugin --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": "Conta... |
Taint the nodes that have the label 'feature=feature-xyz' with the taint key 'cpu-type' with the value 'k8s-node-1:PreferNoSchedule' | Command:
```bash
kubectl taint node -l feature=feature-xyz 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": "", "usag... |
Copy the local file "/var/run/secrets/kubernetes.io/serviceaccount/" to the remote pod "cache-pod-5" in the container "file-server" and place it in the "/etc/kubernetes" directory. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ cache-pod-5:/etc/kubernetes -c file-server
```
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":... |
Set the cluster field in a context to a specific value | Command:
```bash
kubectl config set contexts.on-prem-context.cluster edge-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you ... |
Create a cron job named 'metrics-collection' using the 'mongo' image | Command:
```bash
kubectl create cronjob metrics-collection --image=mongo --schedule="*/1 * * * *" -- mongo
```
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",... |
Check if I have the permission to list the job named "deploy-artifacts-job" in the "monitoring" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/deploy-artifacts-job -n monitoring
```
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 partia... |
Set up autoscaling for the 'foo' deployment with a minimum of 4 pods and a maximum of 12 pods | Command:
```bash
kubectl autoscale deployment foo --min=4 --max=12
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Run the command 'kubectl exec' followed by the name of the pod and the 'docker run' command to get the output from running the specified command inside the pod | Command:
```bash
kubectl exec e-commerce-pod -- docker run -d ubuntu sleep 3600
```
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 omi... |
Forward local traffic from port 5000 to port 8088 in the selected pod of the email-server-deployment deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 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... |
Add the annotation 'description' with the value 'Web server for marketing site' to the pod 'payment' | Command:
```bash
kubectl annotate pods payment description='Web server for marketing site'
```
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 label... |
View the most recent 23 lines of logs for the pod named "web-app-pod" | Command:
```bash
kubectl logs --tail=23 web-app-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-c"... |
Forward traffic from port 3000 on localhost and IP 10.19.21.23 to port 3000 in the chat-app-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 3000: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 criter... |
Forward traffic from port 8081 on localhost and IP 10.19.21.23 to port 5432 in the backend-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 8081: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 criteri... |
Taint node 'storage-node-13' with the key 'datacenter' and no value | Command:
```bash
kubectl taint nodes storage-node-13 datacenter:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. On... |
Retrieve a list of deployments in the "rc-1.1.0" version of the "web-apps" API group, and display the output in JSON format. | Command:
```bash
kubectl get deployments.rc-1.1.0.web-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will... |
Get the output from the "mycontainer" container in the "chat-app-pod" pod. | Command:
```bash
kubectl attach chat-app-pod -c mycontainer
```
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... |
Add a taint with the key 'dedicated' and value 'monitoring-node-15:PreferNoSchedule' to all nodes that have the label 'app-type=microservice' | Command:
```bash
kubectl taint node -l app-type=microservice 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"... |
Import the 'EXTERNAL_API_URL' key from the 'ui-config' ConfigMap into the 'search-engine-deployment' deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/ui-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Forward port 5432 locally to port 8888 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward pod/cdn-service-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 be selected au... |
Forward local traffic from port 3000 to port 8888 in a pod selected by the 'email-server-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/email-server-deployment 3000 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 new ClusterIP service named 'ldap-service-clusterip' that exposes port 6379 on the cluster IP and forwards traffic to port 9092. | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=6379:9092
```
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", "... |
Set the environment variable 'SECRET_KEY' in the deployment 'gateway-deployment' using the values from the 'env-vars' config map | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/env-vars deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one... |
Add a taint with the key 'special' and the value 'kube-master-9:PreferNoSchedule' on nodes that have the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production special=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": "", ... |
Get the output from the running payment-gateway-pod and attach to it. | Command:
```bash
kubectl attach payment-gateway-pod
```
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 kub... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/api-config deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Forward local port 8088 to port 8000 in the pod named api-service-pod | Command:
```bash
kubectl port-forward pod/api-service-pod 8088:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Forward the local random port to port 8081 in the proxy-server-pod pod. | Command:
```bash
kubectl port-forward pod/proxy-server-pod :8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Check if the current user has permission to list the "data-synchronization-job" job in the "kube-node-lease" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/data-synchronization-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... |
Remove the label named 'bar' from the pod 'security' | Command:
```bash
kubectl label pods security component-
```
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... |
Forward the local port 5000 to port 8080 of the 'backend-pod' pod, allowing connections from all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5000: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 ... |
Forward port 3000 on localhost and IP address 10.19.21.23 to port 8081 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 3000:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cri... |
Open the api-service service for editing using the vi editor. | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/api-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, or f... |
Create a job from a cron job named "backup-job" | Command:
```bash
kubectl create job test-job --from=cronjob/backup-job
```
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:... |
Copy the local file /tmp/foo_dir to the directory /tmp/bar in the remote pod named image-resizer-pod-20 in the namespace monitoring. | Command:
```bash
kubectl cp /tmp/foo_dir monitoring/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 t... |
Set the service account of the deployment "user-management-deployment" to "istio" | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment istio
```
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:
`kube... |
Add label `tier` with value `frontend` to pod `gateway` | Command:
```bash
kubectl label pods gateway 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": ... |
Create a cluster role named "admin_role" with SubResource specified | Command:
```bash
kubectl create clusterrole admin_role --verb=proxy,get,update --resource=secrets,secrets/status
```
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]`
Helpful flags:
"flag"... |
Start a pod named 'nginx' using the 'amazonlinux' image, but customize the pod's specifications with values from a JSON file using the --overrides flag | Command:
```bash
kubectl run nginx --image=amazonlinux --overrides='{ "apiVersion": "dev-2.2.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] --... |
Import specific keys from a config map into environment variables for a deployment named `scheduler-app-deployment`. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/log-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 definiti... |
Set the resource limits for the golang container in the deployment named "golang" | Command:
```bash
kubectl set resources deployment golang -c=nginx --limits=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 requested, but may burst up to ... |
Create a new ClusterIP service named notification-service-clusterip that forwards traffic from port 5000 to port 7000. | Command:
```bash
kubectl create service clusterip notification-service-clusterip --tcp=5000:7000
```
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":... |
Update the 'gpu-node-12' node by adding a taint with key 'special', value 'backup', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes gpu-node-12 special=backup:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. On... |
Add a taint with key 'disktype' on nodes having label component=proxy, and the value storage-node-13 as PreferNoSchedule. | Command:
```bash
kubectl taint node -l component=proxy disktype=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": "", "usa... |
Stream the logs of the quantum-quark container in the api-service-pod pod | Command:
```bash
kubectl logs -f -c quantum-quark 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": "--container",... |
Add a taint with the key 'zone' and the value 'worker-node-3:PreferNoSchedule' on all nodes with the label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel zone=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
Listen on address 0.0.0.0 port 8000, and forward the traffic to port 8080 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Copy the file /tmp/foo from the api-server-pod-3 pod on the kube-server cluster to the /tmp/bar_dir directory on your local machine. | Command:
```bash
kubectl cp kube-server/api-server-pod-3:/tmp/foo /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
Update the image of all containers in the daemonset named 'development' to 'python:3.9.7'. | Command:
```bash
kubectl set image daemonset development *=python:3.9.7
```
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:
... |
Resume a paused deployment. | Command:
```bash
kubectl rollout resume deployment/nginx
```
What it does:
Resume a paused resource.
Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.
Syntax:
`kubectl rollout resume RESOURCE`
Helpful... |
Get the output of running the 'pg_dump --version' command in the cyber-sleuth container of the media-stream-pod pod. | Command:
```bash
kubectl exec media-stream-pod -c cyber-sleuth -- pg_dump --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... |
Disable certificate checking for the specified cluster entry | Command:
```bash
kubectl config set-cluster dev-cluster --insecure-skip-tls-verify=true
```
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... |
Get the output from running the 'pip --version' command from the 'monitoring-pod' pod, using the first container. | Command:
```bash
kubectl exec monitoring-pod -- 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 the kube... |
Forward local port 5000 to port 5000 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 5000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
delete the pods and services with the names "database" and "backend" | Command:
```bash
kubectl delete pod,service database backend
```
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... |
Check if you have permission to list the job named "cron-job" in the "logging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cron-job -n logging
```
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 a service for the replicated ruby replica set and expose it on port 7000, connecting to the containers on port 500100 | Command:
```bash
kubectl expose rs ruby --port=7000 --target-port=500100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Create a pod disruption budget named statefulset-pdb that will select all pods with the component=web label, and require a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=component=web --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Set up auto scaling for a replication controller called "database" | Command:
```bash
kubectl autoscale rc database --max=6 --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 use... |
Create a cluster role named "reader" with the ability to update services and access the "image-processor" and "error-logger" resource names. | Command:
```bash
kubectl create clusterrole reader --verb=update --resource=services --resource-name=image-processor --resource-name=error-logger
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cli... |
Create an ingress resource called 'private-ingress' with a rule that directs requests to site.com/input to svc1:5000 | Command:
```bash
kubectl create ingress private-ingress --rule="site.com/input=svc1:5000,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... |
Import the keys "max_connections" from the config map "kube-system-config" into the deployment "authentication-service-deployment". | Command:
```bash
kubectl set env --keys=max_connections --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 environme... |
Create a copy of the proxy-service-pod and name it my-custom-dbg, while changing all container images to postgres. | Command:
```bash
kubectl debug proxy-service-pod --copy-to=my-custom-dbg --set-image=*=postgres
```
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 n... |
Forward local port 9090 to port 5432 in the specified pod | Command:
```bash
kubectl port-forward pod/web-app-pod 9090: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... |
Copy the file named "foo" from the remote pod "message-broker-pod-15" in the "istio-system" namespace to the local directory "/tmp/bar". | Command:
```bash
kubectl cp istio-system/message-broker-pod-15::/tmp/foo :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Add a taint with key 'disktype' on nodes having label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha disktype=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": "", "usa... |
Return the snapshot logs from container auth-service-pod-1 of a deployment named frontend-deployment | Command:
```bash
kubectl logs deployment/frontend-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:
"flag... |
Set the CPU limits of the MySQL container in the deployment to "200m" and the memory limits to "512Mi". | Command:
```bash
kubectl set resources deployment mysql -c=nginx --limits=cpu=200m,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, but may burst up to... |
Apply a taint to nodes that have the label "customer=acme-corp" | Command:
```bash
kubectl taint node -l customer=acme-corp special=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": "", "u... |
Add a taint to a specific node with no value. | Command:
```bash
kubectl taint nodes testing-node-11 workload:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Create a service for the replicated node using replica set, with the service listening on port 9090 and forwarding traffic to containers on port 818100. | Command:
```bash
kubectl expose rs node --port=9090 --target-port=818100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Create a new config map named 'app-config' with the keys 'conf' and 'data', using the files '/path/to/preferences/file1.txt' and '/path/to/parameters/file2.txt' as the values respectively | Command:
```bash
kubectl create configmap app-config --from-file=conf=/path/to/preferences/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 creating a ... |
Print the API resources available in the 'policy' API group | Command:
```bash
kubectl api-resources --api-group=policy
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
List the deployments in the "apps" API group in the "v2.1.0" version, and display the output in JSON format. | Command:
```bash
kubectl get deployments.v2.1.0.apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only ... |
Display the resource usage metrics for all pods in the 'external-authentication-service' namespace | Command:
```bash
kubectl top pod --namespace=external-authentication-service
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:... |
Forward traffic from port 3000 on localhost and IP 10.19.21.23 to port 3000 in the pod named cdn-service-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 3000: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 cri... |
Forward traffic from port 8000 on all addresses to port 8088 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-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 po... |
Add a taint with key 'cpu-type' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta cpu-type=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": "Output... |
Start a pod with overloaded specification values parsed from a JSON file | Command:
```bash
kubectl run nginx --image=node --overrides='{ "apiVersion": "stable-2.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] -- [CO... |
Create an ingress resource called 'web-ingress' that defines a rule for directing requests from 'foo.com/input' to the service 'svc1' running on port '9090' | Command:
```bash
kubectl create ingress web-ingress --rule="foo.com/input=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Create an ingress rule named 'private-service-ingress' that routes requests from foo.com/module to svc1:9092 with the 'my-cert' TLS secret. | Command:
```bash
kubectl create ingress private-service-ingress --rule="foo.com/module=svc1:9092,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 the replication controller specified in "php-controller.yaml" file, serving on port 8089 and connecting to the containers on port 330600. | Command:
```bash
kubectl expose -f php-controller.yaml --port=8089 --target-port=330600
```
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 sp... |
Create a single ingress named 'service-ingress' that points requests from website.com/input to the service named svc1 on port 5000 | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/input=svc1:5000,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... |
List the log-aggregator-rc replication controller in the ps output format | Command:
```bash
kubectl get replicationcontroller log-aggregator-rc
```
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 wi... |
Set the cluster field in a given context to a specific cluster | Command:
```bash
kubectl config set contexts.testing-context.cluster cluster-alpha
```
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 an ingress resource called 'internal-ingress' with a rule that directs requests to testing.com/example to svc1:8082, using the tls secret "my-cert" | Command:
```bash
kubectl create ingress internal-ingress --rule="testing.com/example=svc1:8082,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Attach to the code-explorer container in the database-pod pod and fetch the output. | Command:
```bash
kubectl attach database-pod -c code-explorer
```
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, u... |
Add a taint of key 'workload' with no value to the node 'gpu-node-12' | Command:
```bash
kubectl taint nodes gpu-node-12 workload:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/ssl-key-secret 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 definitions in one... |
List deployments in YAML format for the "dev-2.2.0" version of the "mobile-apps" API group. | Command:
```bash
kubectl get deployments.dev-2.2.0.mobile-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 ... |
Create a deployment named gitlab with the hazelcast image and expose port 9090 | Command:
```bash
kubectl create deployment gitlab --image=hazelcast/hazelcast --port=9090
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.