prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
List deployments in YAML output format, using the "v2.1.0" version of the "mobile-apps" API group. | Command:
```bash
kubectl get deployments.v2.1.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 wil... |
Set up autoscaling for a replication controller named "gateway" with a maximum of 3 pods and a target CPU utilization of 20%. | Command:
```bash
kubectl autoscale rc gateway --max=3 --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 uses... |
Add a taint with the key 'datacenter' on nodes that have the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app datacenter=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Deny the Certificate Signing Request (CSR) with the name 'csr-mongo-13' | Command:
```bash
kubectl certificate deny csr-mongo-13
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kubectl ... |
Forward local ports 8000 and 6000 to ports 5432 and 6000 in a specific pod selected by the deployment | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 8000 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, ... |
import specific keys from a config map into an environment variable | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-settings deployment/payment-processor-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... |
Create a NodePort service named media-stream-nodeport, mapping port 8081 on the host to port 7000 on the pod | Command:
```bash
kubectl create service nodeport media-stream-nodeport --tcp=8081:7000
```
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"... |
Add a taint with key 'hardware' and value 'dev-node-4:PreferNoSchedule' on nodes having label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace hardware=dev-node-4: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 new config map named app-settings using the /path/to/parameters/file1.txt file contents as the value for the 'conf' key, and the /path/to/settings/file2.txt file contents as the value for the 'data' key. | Command:
```bash
kubectl create configmap app-settings --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a c... |
Create a cluster role named "custom_role" with API Group specified | Command:
```bash
kubectl create clusterrole custom_role --verb=list,create,connect --resource=storageclasses.storage.k8s.io
```
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 fl... |
Forward local port 8081 to port 5432 inside the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-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 criteria, a pod will be selected au... |
Forward local port 5000 to the targetPort of the "https" port in a pod selected by the search-service service | Command:
```bash
kubectl port-forward service/search-service 5000: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 selecte... |
Execute the command "java -jar /usr/share/jenkins/jenkins.war" in the stardust-shuttle container of the payment-gateway-pod and retrieve the output. | Command:
```bash
kubectl exec payment-gateway-pod -c stardust-shuttle -- java -jar /usr/share/jenkins/jenkins.war
```
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": ""... |
Create a service for the replicated ruby using replica set, which serves on port 9090 and connects to the containers on port 500100. | Command:
```bash
kubectl expose rs ruby --port=9090 --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... |
Import environment variables from a secret for a specific deployment | Command:
```bash
kubectl set env --from=secret/monitoring-credentials-secret deployment/payment-processor-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... |
Create a new ClusterIP service named notification-service-clusterip on port 8084 that forwards traffic to port 5001 | Command:
```bash
kubectl create service clusterip notification-service-clusterip --tcp=8084:5001
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short":... |
Create a debug container for auth-service-pod with a different container image and added change in container images of cache and worker. | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=my-debugger --image=debian --set-image=cache=redis:alpine,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified b... |
Get the output from running the 'redis-cli' command in the 'code-explorer' container from the 'e-commerce-pod' pod | Command:
```bash
kubectl exec e-commerce-pod -c code-explorer -- 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,... |
Forward traffic from port 9090 on all addresses to port 8888 in the pod 'cdn-service-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 9090: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 w... |
Copy the contents of the "/var/run/secrets/kubernetes.io/serviceaccount/" directory from the "api-server-pod-3" pod in the "kube-public" namespace to the "/tmp/bar_dir" directory locally. | Command:
```bash
kubectl cp kube-public/api-server-pod-3:/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": "", "usage": ... |
Get the output from running the 'python' command in the 'quantum-quark' container within the 'analytics-pod' pod. | Command:
```bash
kubectl exec analytics-pod -c quantum-quark -- python
```
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... |
Set the cluster field in the testing-context context to on-prem-cluster. | Command:
```bash
kubectl config set contexts.testing-context.cluster on-prem-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... |
Forward traffic from port 6379 on your local machine to port 8088 in the backend-pod pod. | Command:
```bash
kubectl port-forward pod/backend-pod 6379:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a new config map named db-config with specified keys and file paths for the values. | Command:
```bash
kubectl create configmap db-config --from-file=settings=/path/to/options/file1.txt --from-file=key2=/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 c... |
Retrieve the snapshot logs from the container named 'vpn-service-pod-1' of the 'user-management-deployment' in the deployment. | Command:
```bash
kubectl logs deployment/user-management-deployment -c vpn-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:... |
Get the output of running the 'mongod' command from the log-aggregator-pod pod. | Command:
```bash
kubectl exec log-aggregator-pod -- mongod
```
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... |
Add a taint with the key 'disktype' on nodes that have the label 'region=eu-west-2' | Command:
```bash
kubectl taint node -l region=eu-west-2 disktype=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": "", "usag... |
Get the output from running the 'bash' command in the rocket-ranger container within the chat-app-pod pod. | Command:
```bash
kubectl exec chat-app-pod -c rocket-ranger -- bash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use th... |
List the deployments in the "beta-1.0" version of the "sandbox-apps" API group in JSON output format | Command:
```bash
kubectl get deployments.beta-1.0.sandbox-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 ... |
Set up autoscaling for the 'security' deployment with a minimum of 5 pods and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment security --min=5 --max=14
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
Create a new secret named private-key-secret with keys for each file in the path/to/data folder | Command:
```bash
kubectl create secret generic private-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 t... |
Import the 'log_level' key from the 'app-config' config map and set it as an environment variable in the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-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 on... |
Begin streaming the logs of the "nano-bot" container in the "security-service-pod" pod. | Command:
```bash
kubectl logs -f -c nano-bot security-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",... |
Forward local port 6379 and selected IP to port 8080 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 6379: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 criter... |
Create a priority class called "test-priority" with a value of 20 and a description of "Priority for testing and validation" | Command:
```bash
kubectl create priorityclass test-priority --value=20 --description="Priority for testing and validation" --preemption-policy="Never"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VALUE --glo... |
Create a new NodePort service named ingress-controller-nodeport, mapping port 8089 on the host to port 5000 on the service | Command:
```bash
kubectl create service nodeport ingress-controller-nodeport --tcp=8089:5000
```
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", "de... |
Create a new ingress called 'api-gateway-ingress' which directs requests from testing.com/module to the service svc1 on port 8888 | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="testing.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": ""... |
create a config map named monitoring-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap monitoring-config --from-file=properties=/path/to/settings/file1.txt --from-file=key1=/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 cre... |
Copy the local file `/tmp/foo_dir` to the remote pod `kube-dns/auth-service-pod-11` in the namespace | Command:
```bash
kubectl cp /tmp/foo_dir kube-dns/auth-service-pod-11::/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Run the 'gem --version' command in the container named 'warp-drive' of the pod named 'backend-pod' and display the output. | Command:
```bash
kubectl exec backend-pod -c warp-drive -- gem --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, u... |
Create a service for the replication controller specified in the "python-controller.yaml" file, that serves on port 8888 and connects to the containers on port 9090. | Command:
```bash
kubectl expose -f python-controller.yaml --port=8888 --target-port=909000
```
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... |
Connect to the time-machine container in the auth-service-pod and interact with the bash terminal. | Command:
```bash
kubectl attach auth-service-pod -c time-machine -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 o... |
Create an ingress named 'internal-ingress' that routes requests from foo.com/bar to svc1:27017 with the TLS secret "my-cert". | Command:
```bash
kubectl create ingress internal-ingress --rule="foo.com/bar=svc1:27017,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Update the taint of a node with the specified key, value, and effect | Command:
```bash
kubectl taint nodes gpu-node-12 hardware=gpu: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. One o... |
Partially update a node using strategic merge patch from a configuration file specified in "machine-configuration.yaml" | Command:
```bash
kubectl patch -f machine-configuration.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:
`kubec... |
View the information of the specified resources | Command:
```bash
kubectl get rc/web service/backend-rc pods/proxy-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespac... |
Add a taint with key 'cpu-type' on nodes having label instance=app-instance-1 | Command:
```bash
kubectl taint node -l instance=app-instance-1 cpu-type=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Forward port 5432 on localhost and IP 10.19.21.23 to port 3000 on the pod backend-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 5432:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Retrieve the logs from one specific container (e-commerce-pod-1) of a deployment (notification-handler-deployment) | Command:
```bash
kubectl logs deployment/notification-handler-deployment -c e-commerce-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful fl... |
Forward local ports 5432 and 6000 to ports 8000 and 6000 respectively in a pod selected by the "analytics-platform-deployment" deployment. | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 5432 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a po... |
Update the image of all containers in the daemonset named "staging" to "alpine:3.14". | Command:
```bash
kubectl set image daemonset staging *=alpine:3.14
```
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:
`kube... |
Forward local port 8081 to port 5432 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-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 criteria, a pod will be selected auto... |
Create an ingress called 'external-ingress' with a rule that directs requests to website.com/bar to svc1:3000 | Command:
```bash
kubectl create ingress external-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 a new secret named 'jwt-secret' from the environment file located at 'path/to/configs.env' | Command:
```bash
kubectl create secret generic jwt-secret --from-env-file=path/to/configs.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename o... |
Retrieve the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/security-service-rc pods/security-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type... |
Copy the directory '/tmp/foo_dir' from the remote pod 'task-processor-pod-17' in kube-public namespace to '/tmp/bar' on your local machine. | Command:
```bash
kubectl cp kube-public/task-processor-pod-17:/tmp/foo_dir :/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... |
apply the resources specified in the kustomization.yaml file located in the setup directory | Command:
```bash
kubectl apply -k setup/
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
JSON and ... |
Import specific keys from a config map to set environment variables for a deployment in a monitoring stack. | Command:
```bash
kubectl set env --keys=redis_host --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 de... |
Create a new config map named "app-config-prod" using the specified files as key-value pairs. | Command:
```bash
kubectl create configmap app-config-prod --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/options/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... |
Start the Jenkins pod with custom command and arguments | Command:
```bash
kubectl run nginx --image=jenkins --command -- <cmd> <arg1> ... <argN>
```
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...]`
Helpf... |
add an annotation to the pod specified in "options.json" with the key "monitoring-tool" and value "Prometheus" | Command:
```bash
kubectl annotate -f options.json monitoring-tool=Prometheus
```
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 ... |
Create a new ExternalName service named external-payment-gateway-service that redirects to the practice-online.site domain | Command:
```bash
kubectl create service externalname external-payment-gateway-service --external-name practice-online.site
```
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 r... |
Update the 'monitoring-node-15' node by adding a taint with key 'workload', value 'high-priority', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes monitoring-node-15 workload=high-priority:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Create a new ClusterIP service named order-service-clusterip that maps port 27017 on the service to port 8888 on the pods | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=27017:8888
```
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",... |
Create a new config map named api-config using the files /path/to/preferences/file1.txt and /path/to/profiles/file2.txt | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/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 creatin... |
Update the image of all containers in the daemonset services to 'httpd:2.4.48' | Command:
```bash
kubectl set image daemonset services *=httpd:2.4.48
```
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:
`ku... |
Add a taint with key 'workload' on nodes having label component=proxy. | Command:
```bash
kubectl taint node -l component=proxy workload=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Create a job with the provided image and execute the given command | Command:
```bash
kubectl create job log-collection --image=node -- node --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output form... |
Roll back the daemonset named "namespace-2" to revision 5. | Command:
```bash
kubectl rollout undo daemonset/namespace-2 --to-revision=5
```
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... |
Get the output from running the 'docker run -it ubuntu' command inside the quantum-quark container in the api-service-pod pod. | Command:
```bash
kubectl exec api-service-pod -c quantum-quark -- docker run -it ubuntu
```
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... |
Create a pod disruption budget named database-pdb that selects all pods labeled with version=v2, and specifies that a minimum of four of these pods must be available at any given time. | Command:
```bash
kubectl create poddisruptionbudget database-pdb --selector=version=v2 --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 [--dry... |
Forward local port 8088 to port 8000 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-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... |
Create a new ClusterIP service named ldap-service-clusterip, forward traffic from port 3306 to port 8443 | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=3306:8443
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "... |
Create a new config map named app-name-config with specified keys using files from disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/profiles/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Create a new secret named app-config-secret with keys for each file in the path/to/properties folder. | Command:
```bash
kubectl create secret generic app-config-secret --from-file=path/to/properties
```
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... |
Set the cluster field in the my-context context to prod-cluster | Command:
```bash
kubectl config set contexts.cluster-2-context.cluster prod-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... |
Execute the 'wp' command in the 'cyber-sleuth' container of the 'payment-gateway-pod' pod and get the output. | Command:
```bash
kubectl exec payment-gateway-pod -c cyber-sleuth -- wp
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Execute the command 'go run hello.go' in the container named 'mycontainer' within the 'log-aggregator-pod' pod and get the output. | Command:
```bash
kubectl exec log-aggregator-pod -c mycontainer -- go run hello.go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
Create a new secret named "azure-storage-secret" with keys for each file in the folder "bar" | Command:
```bash
kubectl create secret generic azure-storage-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 basenam... |
Create a debug version of the analytics-pod by adding a debug container and changing container images | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-api --image=debian --set-image=scheduler=my-scheduler:1.0,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identi... |
Expose the "ubuntu" service as "ubuntu-https" service, mapping container port 8443 to service port 443 | Command:
```bash
kubectl expose service ubuntu --port=443 --target-port=80 --name=nginx-https
```
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 ... |
Scale the mysql deployment named db-migration-replicaset from 7 replicas to 3 replicas. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=3 deployment/db-migration-replicaset
```
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 --reso... |
Copy the file '/tmp/foo' from the 'ingress-controller-pod-8' pod in the 'kube-node-lease' namespace to the local directory '/tmp/bar_dir' | Command:
```bash
kubectl cp kube-node-lease/ingress-controller-pod-8::/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 omitt... |
create a job called testing using the ethereum/client-go image and running the command "geth" | Command:
```bash
kubectl create job testing --image=ethereum/client-go -- geth
```
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.... |
Import the 'max_connections' key from the 'app-config' config map and set it as an environment variable for the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-config deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Start a reverse proxy to the Kubernetes API, making it available on the local machine at http://localhost:8001/ | Command:
```bash
kubectl proxy --api-prefix=/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote Kubernetes API ... |
Add a taint with key 'workload' on nodes having label app-type=microservice | Command:
```bash
kubectl taint node -l app-type=microservice workload=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":... |
Create a copy of the frontend-pod and change all container images to busybox. The new pod should be named my-debugger. | Command:
```bash
kubectl debug frontend-pod --copy-to=my-debugger --set-image=*=busybox
```
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 resour... |
Forward local port 8080 to port 8888 in the backend pod | Command:
```bash
kubectl port-forward pod/backend-pod 8080: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 debug container for the auth-service-pod by copying it to a new pod called my-custom-dbg | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=my-custom-dbg --image=debian --set-image=app=app:debug,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 n... |
Add the annotation "env=staging" to the pod specified in the "options.json" file. | Command:
```bash
kubectl annotate -f options.json env=staging
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary strin... |
Add a taint to the 'edge-node-10' node with key 'environment', value 'production', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes edge-node-10 environment=production: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 f... |
Scale the deployment named foo to 1 replica if its current size is 1 | Command:
```bash
kubectl scale --current-replicas=1 --replicas=1 deployment/foo
```
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... |
Add label 'env=staging' to pod 'monitoring' | Command:
```bash
kubectl label pods monitoring env=staging
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage":... |
Create a cluster role named "default_role" with API Group specified to allow listing, using, and connecting to persistent volumes. | Command:
```bash
kubectl create clusterrole default_role --verb=list,use,connect --resource=persistentvolumes.storage.k8s.io
```
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 f... |
Apply a taint to the node 'backup-node-14' with the key 'special', value 'backup', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes backup-node-14 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.... |
Attach to the 'database-pod' container named 'astro-container' in raw terminal mode | Command:
```bash
kubectl attach database-pod -c astro-container -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 om... |
Execute the 'bash' command inside the pod named 'vpn-service-pod' and view the output. | Command:
```bash
kubectl exec vpn-service-pod -- bash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kube... |
Create a service for the replicated ubuntu using a replica set | Command:
```bash
kubectl expose rs ubuntu --port=9091 --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 specified port.... |
Create a role binding called "bar" with the "bar" cluster role for the users jane.doe, bob.smith, and developers. | Command:
```bash
kubectl create rolebinding bar --clusterrole=bar --user=jane.doe --user=bob.smith --group=developers
```
What it does:
Create a role binding for a particular role or cluster role.
Syntax:
`kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--servicea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.