prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
List the deployments in the "stable-2.0.0" version of the "experimental-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.stable-2.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... |
Get the output from running the 'postgres' command in the 'rocket-ranger' container of the 'frontend-pod' pod. | Command:
```bash
kubectl exec frontend-pod -c rocket-ranger -- 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, us... |
Create a cluster role named "custom_role" with the ResourceName specified | Command:
```bash
kubectl create clusterrole custom_role --verb=exec --resource=pods --resource-name=queue-consumer --resource-name=identity-provider
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Forward local port 6379 to the targetPort of the "https" port in the backend-service service of a selected pod | Command:
```bash
kubectl port-forward service/backend-service 6379: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 select... |
Forward local ports 5000 and 6000 to ports 8000 and 6000 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 5000 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 aut... |
Execute the command 'docker run -d ubuntu sleep 3600' in the 'lunar-launcher' container from the 'database-pod' pod | Command:
```bash
kubectl exec database-pod -c lunar-launcher -- 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": "Contai... |
Update the image of all containers in the 'development' daemonset to 'wordpress:5.8.1'. | Command:
```bash
kubectl set image daemonset development *=wordpress:5.8.1
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Synta... |
Set the resource request and limits for all containers in the php deployment | Command:
```bash
kubectl set resources deployment php --limits=cpu=200m,memory=512Mi --requests=cpu=500m,memory=4Gi
```
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,... |
Scale the deployment named bar to have 1 replica, assuming its current size is 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=1 deployment/bar
```
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 spec... |
Open the `scheduler-service` service for editing using the `nano` editor. | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/scheduler-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 variabl... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-secrets deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Copy a local file to a remote pod in a specific container | Command:
```bash
kubectl cp /tmp/foo_dir worker-pod-4:/tmp/bar -c metrics-exporter
```
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... |
Create a new ClusterIP service named catalog-service-clusterip that maps the local port 5432 to the target port 27017. | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=5432:27017
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/ui-config deployment/proxy-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 defin... |
Create a service for the replication controller specified in the "ubuntu-controller.yaml" file | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=8888 --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... |
Import specific keys from a config map to an environment variable for a deployment | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-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 ... |
List the details of the 'proxy-service-rc' replication controller in the default output format | Command:
```bash
kubectl get replicationcontroller proxy-service-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 wil... |
run a php pod and expose port 8081 | Command:
```bash
kubectl run hazelcast --image=php --port=8081
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--file... |
label the pod 'chat-app' with the label 'component' and the value 'api' | Command:
```bash
kubectl label pods chat-app 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", "usage":... |
Display configuration details for the "client-1-context" context in your kubeconfig file. | Command:
```bash
kubectl config get-contexts client-1-context
```
What it does:
Display one or many contexts from the kubeconfig file.
Syntax:
`kubectl config get-contexts [(-o|--output=)name)]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: name " |
Create a service for the replicated php using replica set, which serves on port 8089 and connects to the containers on port 818100 | Command:
```bash
kubectl expose rs php --port=8089 --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 ... |
Auto scale the deployment "web" with a minimum of 1 pod and a maximum of 9 pods. | Command:
```bash
kubectl autoscale deployment web --min=1 --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 the ... |
Forward port 9090 on all addresses to port 5432 in the pod named "web-app-pod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 ... |
Execute the 'kafka-topics --list' command inside the proxy-service-pod pod and display the output | Command:
```bash
kubectl exec proxy-service-pod -- 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. If omitted, use... |
Add a taint with key 'cpu-type' on nodes having label service=auth | Command:
```bash
kubectl taint node -l service=auth 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... |
Create or update the exec auth plugin environment variables for the "john.doe" entry, setting key1=val1 and key2=val2 as environment variables | Command:
```bash
kubectl config set-credentials john.doe --exec-env=key1=val1 --exec-env=key2=val2
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bear... |
Set the custom TLS server name 'dev-cluster' for the 'cluster-beta' cluster entry. | Command:
```bash
kubectl config set-cluster cluster-beta --tls-server-name=dev-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate-... |
Listen on port 3000 on your local machine and forward traffic to port 8888 in the web-app-pod pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 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 be selected automa... |
Create a copy of a pod, changing all container images to a specific image. | Command:
```bash
kubectl debug mypod --copy-to=my-debugger --set-image=*=mcr.microsoft.com/dotnet/core/runtime
```
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 ... |
Import the 'max_connections' key from the 'global-config' config map and set it as an environment variable in the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/global-config 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 definit... |
Run the 'psql' command in the 'lunar-launcher' container of the 'backend-pod' pod, and retrieve the output. | Command:
```bash
kubectl exec backend-pod -c lunar-launcher -- psql
```
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 th... |
update the last-applied-configuration of a resource using the contents of the preferences.yaml file | Command:
```bash
kubectl apply set-last-applied -f preferences.yaml
```
What it does:
Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run, without updating any other parts... |
view the logs of a specific pod written in the last hour | Command:
```bash
kubectl logs --since=1h frontend-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 deployment named prometheus with the php image and expose port 8089. | Command:
```bash
kubectl create deployment prometheus --image=php --port=8089
```
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: ... |
Set the cluster field for a specific context to a specified cluster name | Command:
```bash
kubectl config set contexts.edge-context.cluster dev-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 want... |
Update the 'edge-node-10' node by applying a strategic merge patch in YAML format | Command:
```bash
kubectl patch node edge-node-10 -p $'spec:\n containers:\n- name: container-name\n resources:\n limits:\n 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 patch (-f ... |
Remove the label named 'bar' from the pod 'media-stream' | Command:
```bash
kubectl label pods media-stream 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"... |
Auto scale the replication controller "cdn" with the target CPU utilization set at 60%, allowing for a maximum of 8 pods. | Command:
```bash
kubectl autoscale rc cdn --max=8 --cpu-percent=60
```
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 and requests for all containers in the "centos" deployment | Command:
```bash
kubectl set resources deployment centos --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 request... |
Embed the certificate authority data for the galaxy-cluster cluster entry by executing the command "kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/data-cluster/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/data-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 s... |
Auto scale the "auth" deployment with a minimum of 6 pods and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment auth --min=6 --max=15
```
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... |
Apply a taint with the key 'datacenter' and value 'edge-node-10:PreferNoSchedule' on nodes having the label 'zone=us-east-1'. | Command:
```bash
kubectl taint node -l zone=us-east-1 datacenter=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... |
Create a copy of the chat-app-pod and add a debug container to it | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=my-debugger --image=debian --set-image=api=api:v2,web=nginx:latest
```
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... |
Import the SMTP_SERVER key from the config map called 'app-secrets' and update the environment variables of 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-secrets 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... |
Create a job named 'report-generation-job' using the 'redis' image, and run the 'redis-server --version' command as the entrypoint | Command:
```bash
kubectl create job report-generation-job --image=redis -- redis-server --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": "", "usag... |
Copy the ~/.config/kube local file to /tmp/bar in the load-balancer container of the message-broker-pod-15 pod. | Command:
```bash
kubectl cp ~/.config/kube message-broker-pod-15::/tmp/bar -c load-balancer
```
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 omitt... |
Forward local port to a specific port on a pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod :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 selected automa... |
Return the logs of the previously terminated nano-bot container in the chat-app-pod pod. | Command:
```bash
kubectl logs -p -c nano-bot chat-app-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short"... |
Add a taint to node 'k8s-node-1' with key 'special' and no value | Command:
```bash
kubectl taint nodes k8s-node-1 special: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: js... |
Partially update the kube-master-9 node by applying a strategic merge patch specified as YAML | Command:
```bash
kubectl patch node kube-master-9 -p $'spec:\n type: LoadBalancer'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful... |
Add a taint with the key 'app' and value 'kube-master-9:PreferNoSchedule' on nodes that have the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend app=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": "Out... |
Create a pod named "hazelcast" with the ethereum/client-go image, and expose port 9091. | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --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:
... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --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 varia... |
Create a single ingress called 'public-api-ingress' that directs requests to testing.com/bar to svc1:8084 with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-api-ingress --rule="testing.com/bar=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": "", "u... |
Create a copy of the proxy-service-pod named debug-image-1, with a debian debug container and updated container images for the scheduler and mailer. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=scheduler=my-scheduler:1.0,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified... |
Roll back a daemonset to a specific revision. | Command:
```bash
kubectl rollout undo daemonset/namespace-3 --to-revision=1
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying... |
Fetch the snapshot logs from the container "analytics-pod-1" of the deployment named "authentication-service-deployment". | Command:
```bash
kubectl logs deployment/authentication-service-deployment -c analytics-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 f... |
Set the custom TLS server name for the on-prem-cluster cluster entry. | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=edge-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] [--certific... |
Forward the local port 5432 and IP address 10.19.21.23 to port 8080 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 5432: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 criteri... |
Remove exec auth plugin environment variables for a specific entry | Command:
```bash
kubectl config set-credentials jane.smith --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... |
Create a new config map named api-config with the keys 'properties' and 'key1' by using the files '/path/to/settings/file1.txt' and '/path/to/settings/file2.txt' respectively. | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/settings/file1.txt --from-file=key1=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a... |
Run a Redis pod with port 5001 exposed | Command:
```bash
kubectl run hazelcast --image=redis --port=5001
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Execute the 'redis-cli' command on the first pod of the 'user-service' service. | Command:
```bash
kubectl exec svc/user-service -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubect... |
Import the specific key "secret_key" from the config map named "db-config" into the environment variables of the deployment "api-server-deployment". | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/db-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 in... |
Create a pod disruption budget named ingress-controller-pdb that will select all pods with the release=1.0.0 label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=release=1.0.0 --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-avail... |
Forward local port 5000 to port 5000 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 5000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Update the security-scan-status annotation of the pod specified in the "preferences.json" file to "pass" | Command:
```bash
kubectl annotate -f preferences.json 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 inclu... |
Set the cluster field in the specified context to the given cluster | Command:
```bash
kubectl config set contexts.testing-context.cluster testing-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 y... |
Create a pod disruption budget named payment-gateway-pdb that selects all pods with the release=1.0.0 label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=release=1.0.0 --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-availabl... |
Edit the `email-service` service using the `nano` editor. | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/email-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 ExternalName service named external-monitoring-service and map it to the external DNS name "blog-test.blog". | Command:
```bash
kubectl create service externalname external-monitoring-service --external-name blog-test.blog
```
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 se... |
Copy the local file /tmp/foo to the remote pod named cache-pod-5 in the /tmp/bar_dir directory, specifically to the load-balancer container. | Command:
```bash
kubectl cp /tmp/foo cache-pod-5:/tmp/bar_dir -c load-balancer
```
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... |
Create a service for the replicated wordpress resource | Command:
```bash
kubectl expose rc wordpress --port=3001 --target-port=300000
```
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 cluster role binding with the cluster-admin role for user1, user2, and group1 | Command:
```bash
kubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] ... |
Check if the current user has permission to perform any action on any resource in the current namespace. | Command:
```bash
kubectl auth can-i '*' '*'
```
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 starts with "/". NAME is the nam... |
Forward local port 5432 to port 9090 in the analytics-pod, and also forward local port 6000 to port 6000 in the pod. | Command:
```bash
kubectl port-forward pod/analytics-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 auto... |
Create a service for the replicated ruby using the replica set named 'ruby', which will serve on port 8089 and connect to the containers on port 543200. | Command:
```bash
kubectl expose rs ruby --port=8089 --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 specified port. A... |
Add a taint with key 'environment' on nodes having label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack environment=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": "", "usa... |
View the supported API versions | Command:
```bash
kubectl api-versions
```
What it does:
Print the supported API versions on the server, in the form of "group/version".
Syntax:
`kubectl api-versions` |
Create a copy of the "auth-service-pod", but change all container images to "node". | Command:
```bash
kubectl debug auth-service-pod --copy-to=dgb-img --set-image=*=node
```
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 resource ... |
Create an ingress with multiple hosts and pathType set to Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:9092" \
--rule="bar.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "sh... |
Roll back the staging daemonset to revision 7 | Command:
```bash
kubectl rollout undo daemonset/staging --to-revision=7
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the... |
Create a single ingress called 'public-ingress' that directs requests to website.com/bar to the service 'svc1' on port 5432 with a TLS certificate named "my-cert". | Command:
```bash
kubectl create ingress public-ingress --rule="website.com/bar=svc1:5432,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Attach to the 'quantum-quark' container in the 'chat-app-pod' pod and switch to raw terminal mode. | Command:
```bash
kubectl attach chat-app-pod -c quantum-quark -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omit... |
Create a deployment named "auth" with the WordPress image | Command:
```bash
kubectl create deployment auth --image=wordpress
```
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|na... |
Create an ingress resource called 'internal-ingress' that directs requests to the path 'website.com/bar' to the service 'svc1' on port '3000' | Command:
```bash
kubectl create ingress internal-ingress --rule="website.com/bar=svc1:3000,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 an ingress named 'private-ingress' that has a rule directing requests from website.com/input to svc1:8082 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="website.com/input=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": "", "us... |
Create a job named "cleanup" using the MySQL image and run the command "mysqld" inside the job | Command:
```bash
kubectl create job cleanup --image=mysql -- mysqld
```
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... |
Import the CONFIG_FILE_PATH key from the api-config config map and set it as an environment variable in the email-server-deployment deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --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 defin... |
Update the label of pod 'foo' to 'release=v2.0' | Command:
```bash
kubectl label pods foo release=v2.0
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If t... |
Forward port 6379 of the pod "web-app-pod" to port 8081 on your local machine. | Command:
```bash
kubectl port-forward pod/web-app-pod 8081:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Forward local port 5000 to port 8080 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 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 be selected automaticall... |
Delete the pods and services with the names "monitoring" and "analytics" | Command:
```bash
kubectl delete pod,service monitoring 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 sele... |
Create a deployment named sonarqube using the python image | Command:
```bash
kubectl create deployment sonarqube --image=python
```
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|... |
Rename the context 'cluster-2-context' to 'team-alpha-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context cluster-2-context team-alpha-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field w... |
Create a copy of the `monitoring-pod` by debugging it and changing the command of the `stardust-shuttle` container to `sh` in the `debug-image-app`. | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-app --container=stardust-shuttle -- 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 ... |
import the DEBUG_MODE key from the global-config ConfigMap and set it as an environment variable for the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/global-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 variabl... |
Create a pod disruption budget named "database-pdb" that will select all pods with the "project=my-project" label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget database-pdb --selector=project=my-project --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=... |
Rename the context 'staging-context' to 'new-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context staging-context new-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will also ... |
Forward local port 8000 to port 5000 on the e-commerce-pod pod. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8000: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 aut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.