prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Output the modified deployment for the "database-deployment" in YAML format with the SMTP_HOST environment variable set to "smtp.example.com", without making any changes to the deployed object on the server. | Command:
```bash
kubectl set env deployment/database-deployment SMTP_HOST=smtp.example.com -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more... |
Create a new config map named app-config-prod with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-prod --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/properties/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Create a cron job named "daily-report" that runs the command "composer --version" every minute using the PHP image. | Command:
```bash
kubectl create cronjob daily-report --image=php --schedule="*/1 * * * *" -- composer --version
```
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": ... |
Import the specific key "api_key" from the "app-secrets" ConfigMap and set it as an environment variable in the "analytics-platform-deployment" deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-secrets deployment/analytics-platform-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... |
Add a taint with key 'environment' and value 'web-node-8:PreferNoSchedule' on nodes having label 'role=database'. | Command:
```bash
kubectl taint node -l role=database environment=web-node-8:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Forward traffic from localhost ports 8888 and 6000 to ports 6379 and 6000 in the pod "frontend-pod" | Command:
```bash
kubectl port-forward pod/frontend-pod 8888 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Add a taint with the key 'disktype' on nodes that have the label zone=us-east-1 | Command:
```bash
kubectl taint node -l zone=us-east-1 disktype=gpu-node-12:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Retrieve the previous terminated logs of the "time-machine" container from the "payment-gateway-pod" pod. | Command:
```bash
kubectl logs -p -c time-machine payment-gateway-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--containe... |
list deployments in YAML format for the "v1.0.0" version of the "sandbox-apps" API group | Command:
```bash
kubectl get deployments.v1.0.0.sandbox-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you wi... |
Forward port 8080 on all addresses to port 8081 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8080:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Create a new config map named log-config using specified files and assign keys to them | Command:
```bash
kubectl create configmap log-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 ... |
Create a cluster role named "custom_role" with the ability to update services with resource names "mail-server" and "app-worker-2" | Command:
```bash
kubectl create clusterrole custom_role --verb=update --resource=services --resource-name=mail-server --resource-name=app-worker-2
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cl... |
Copy the ~/.config/kube local file to the /etc/kubernetes directory in a remote pod named "worker-pod-4" in the "openfaas" namespace. | Command:
```bash
kubectl cp ~/.config/kube openfaas/worker-pod-4:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Set the service account of the deployment "search-engine-deployment" to "kube-scheduler" | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment kube-scheduler
```
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... |
Update the pod 'vpn' by adding the annotation 'expiration-date' with the value '2024-12-31' | Command:
```bash
kubectl annotate pods vpn expiration-date='2024-12-31'
```
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 arbit... |
Add a taint with key 'disktype' and no value to the node 'node-1' | Command:
```bash
kubectl taint nodes node-1 disktype: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: json|... |
Forward traffic from port 8081 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 8081:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cri... |
Get the output from running the 'composer --version' command in the code-explorer container from the vpn-service-pod pod | Command:
```bash
kubectl exec vpn-service-pod -c code-explorer -- composer --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. I... |
Create a service for the replication controller specified in "centos-controller.yaml" file | Command:
```bash
kubectl expose -f centos-controller.yaml --port=8000 --target-port=637900
```
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... |
Create a new ExternalName service named external-email-service and map it to the external name mockup-cloud.cloud. | Command:
```bash
kubectl create service externalname external-email-service --external-name mockup-cloud.cloud
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference ser... |
import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/namespace-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 on... |
Set up autoscaling for the replication controller "analytics" with a minimum of 1 pod, maximum of 6 pods, and a target CPU utilization of 60%. | Command:
```bash
kubectl autoscale rc analytics --max=6 --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 us... |
Execute the command 'php --version' in the nebula-navigator container of the gateway-pod pod. | Command:
```bash
kubectl exec gateway-pod -c nebula-navigator -- php --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 omit... |
Forward traffic from all addresses on port 5432 to port 9090 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-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 w... |
Rename a context in the kubeconfig file. | Command:
```bash
kubectl config rename-context testing-context admin-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 als... |
Create an ingress called 'public-service-ingress' that directs requests from foo.com/bar to svc1:8888 and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="foo.com/bar=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": "", "u... |
Copy the file /tmp/foo from the remote pod logging/image-resizer-pod-20 to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp logging/image-resizer-pod-20:/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... |
Apply a taint with the key 'datacenter' on nodes that have the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace datacenter=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": ... |
Create a single ingress called 'internal-ingress' that directs requests to site.com/bar to svc1:9000 with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress internal-ingress --rule="site.com/bar=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Listen on port 9090 on all addresses, forwarding to port 5000 in the 'cdn-service-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 9090: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 w... |
Listen on port 8088 on all addresses, forwarding to port 9090 in the frontend-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8088: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... |
Add a taint to the node 'testing-node-11' with the key 'disktype' and no value | Command:
```bash
kubectl taint nodes testing-node-11 disktype: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 ... |
Copy the file /tmp/foo from the remote pod logging/api-server-pod-3 to the local location /tmp/bar. | Command:
```bash
kubectl cp logging/api-server-pod-3:/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 the kubectl.... |
Update the annotation 'security-scan-status' of pod 'foo' with the value 'pass' and overwrite any existing value | Command:
```bash
kubectl annotate --overwrite pods foo 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 in... |
Rename a context in your kubeconfig file | Command:
```bash
kubectl config rename-context cluster-1-context user-a-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 ... |
Auto scale the "media-stream" deployment with a minimum of 4 pods and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment media-stream --min=4 --max=10
```
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... |
List the replication controller named "auth-service-rc" in the ps output format. | Command:
```bash
kubectl get replicationcontroller auth-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 will... |
Execute a 'psql' command in the first pod of the proxy-service service and retrieve the output. | Command:
```bash
kubectl exec svc/proxy-service -- 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 the kubectl.ku... |
Mark "backup-node-14" as schedulable | Command:
```bash
kubectl uncordon backup-node-14
```
What it does:
Mark node as schedulable.
Syntax:
`kubectl uncordon NODE`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selector (label query) to filter on " |
Forward local port 8000 to port 8081 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 8000: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... |
Create a new ClusterIP service named payment-service-clusterip that maps port 8081 on the service to port 3000 on the target endpoints. | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=8081:3000
```
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 job named "backup" using the Alpine image, and run the command "ash" in the job. | Command:
```bash
kubectl create job backup --image=alpine -- ash
```
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: json|... |
Create a new secret named app-config-secret with keys for each file in the folder "path/to/settings" | Command:
```bash
kubectl create secret generic app-config-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 basename o... |
Create a deployment named grafana using the redis image and expose port 9090 | Command:
```bash
kubectl create deployment grafana --image=redis --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 format. One of: j... |
Forward local port 8081 to port 8888 of a pod selected by the deployment "api-server-deployment" | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8081 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will b... |
Create a debugging session for "mypod" with the "cosmic-container" container by running the command: "kubectl debug mypod -it --copy-to=my-debugger --container=cosmic-container -- sh" | Command:
```bash
kubectl debug mypod -it --copy-to=my-debugger --container=cosmic-container -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if... |
Begin streaming the logs of the lunar-launcher container in the frontend-pod pod | Command:
```bash
kubectl logs -f -c lunar-launcher 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", "... |
Create a copy of the 'monitoring-pod' pod, adding a debug container and changing container images | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-app --image=debian --set-image=cache=redis:alpine,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Return the snapshot of the previous terminated logs of the 'code-explorer' container in the 'web-app-pod' pod | Command:
```bash
kubectl logs -p -c code-explorer 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", "sh... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/monitoring-config 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 var... |
Execute the 'wp' command in the first container of the 'analytics-pod' pod. | Command:
```bash
kubectl exec analytics-pod -- 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, use the kubectl.kubernet... |
Create a new ClusterIP service named order-service-clusterip that routes traffic from port 8084 to port 9000. | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=8084:9000
```
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 deployment named 'grafana' using the 'redis' image and expose port '8443' | Command:
```bash
kubectl create deployment grafana --image=redis --port=8443
```
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: j... |
Create an ingress resource named 'api-v2-ingress' with a rule that directs requests to testing.com/module to the service 'svc1' on port 8181, and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress api-v2-ingress --rule="testing.com/module=svc1:8181,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... |
Set the certificate-authority-data field for the 'cluster-beta' cluster | Command:
```bash
kubectl config set clusters.cluster-beta.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
```
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 ... |
Get the documentation of the "labels" field in the metadata section of the pods resource. | Command:
```bash
kubectl explain resource=pods.metadata.labels
```
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 d... |
Create a LoadBalancer service named proxy-server-lb, forwarding traffic from port 8000 to port 9091 | Command:
```bash
kubectl create service loadbalancer proxy-server-lb --tcp=8000:9091
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "de... |
List the container name and image of the pod "chat-app-pod" in a custom column format | Command:
```bash
kubectl get pod chat-app-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 --se... |
List multiple resources by their type and names | Command:
```bash
kubectl get rc/web service/gateway-rc pods/api-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced... |
Create a deployment named "proxy" with the php image, and pass the command "php --version" to the container. | Command:
```bash
kubectl create deployment proxy --image=php -- php --version
```
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: ... |
Update the pod named 'vpn' with the annotation 'owner' and set the value to 'alice smith' | Command:
```bash
kubectl annotate pods vpn owner='alice smith'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary stri... |
Attach to the terminal of the pod "vpn-service-pod" and execute the command "cyber-sleuth" to get the output from the command. | Command:
```bash
kubectl attach vpn-service-pod -c cyber-sleuth
```
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,... |
Expose a replication controller by creating a service using the nginx-controller.yaml file, listening on port 9092 and connecting to the containers on port 808400. | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=9092 --target-port=808400
```
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 ... |
Create a deployment named "api" with the "amazonlinux" image and expose port 3001 | Command:
```bash
kubectl create deployment api --image=amazonlinux --port=3001
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Create a copy of the 'cdn-service-pod' pod, changing all container images to 'alpine'. Name the new pod 'my-debugger'. | Command:
```bash
kubectl debug cdn-service-pod --copy-to=my-debugger --set-image=*=alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no reso... |
Create a Pod Disruption Budget named 'web-app-pdb' that will select all pods with the 'version=v2' label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget web-app-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-... |
Partially update the 'app-node-6' node by specifying a strategic merge patch in YAML format | Command:
```bash
kubectl patch node app-node-6 -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 FI... |
Update the pod named 'frontend' with the label 'component' and the value 'worker' | Command:
```bash
kubectl label pods frontend component=worker
```
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", "usag... |
Create a Pod Disruption Budget (PDB) named replica-set-pdb that will select all pods with the app=nginx label and require at least 70% of the selected pods to be available at any given time. | Command:
```bash
kubectl create pdb replica-set-pdb --selector=app=nginx --min-available=70%
```
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-run=server|... |
List the deployments in the "apps" API group, version "beta-1.0", in JSON output format. | Command:
```bash
kubectl get deployments.beta-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 onl... |
Open the scheduler-service service for editing using the emacs editor. | Command:
```bash
KUBE_EDITOR="emacs" 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 variab... |
Create a job with a specific command | Command:
```bash
kubectl create job deployment-rollout-job --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": ... |
Create a new secret named git-credentials-secret and specify the path to properties file as the source for the secret's data | Command:
```bash
kubectl create secret generic git-credentials-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 bas... |
Configure basic authentication for the "operator" user | Command:
```bash
kubectl config set-credentials operator --username=admin --password=uXFGweU9l35qcif
```
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
Be... |
Scale the mysql deployment to 3 replicas if the current size of the deployment named api-service-rs is also 3. | Command:
```bash
kubectl scale --current-replicas=3 --replicas=3 deployment/api-service-rs
```
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-vers... |
Create a Pod Disruption Budget (PDB) with the name replica-set-pdb that will select pods with the label region=us-east and ensure that at least one of them is always available. | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=region=us-east --min-available=1
```
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... |
List deployments from the "external-apps" API group in the "stable-2.0.0" version, and display the output in JSON format. | Command:
```bash
kubectl get deployments.stable-2.0.0.external-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... |
Forward port 8888 locally to port 8081 in a pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 8888: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 auto... |
Get the version of pip installed in the quantum-quark container in the proxy-server-pod pod. | Command:
```bash
kubectl exec proxy-server-pod -c quantum-quark -- 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 om... |
Create a pod disruption budget named statefulset-pdb that will select all pods with the env=production label and require at least one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=env=production --min-available=1
```
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... |
Create a new NodePort service named 'vpn-service-nodeport' and map the port 8082 of the nodes to port 8080 of the pods | Command:
```bash
kubectl create service nodeport vpn-service-nodeport --tcp=8082:8080
```
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":... |
Set the service account of the deployment "proxy-service-deployment" to "kube-proxy" | Command:
```bash
kubectl set serviceaccount deployment proxy-service-deployment kube-proxy
```
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:
`k... |
Execute the 'elasticsearch --version' command inside the analytics-pod and get the output | Command:
```bash
kubectl exec analytics-pod -- elasticsearch --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... |
Create a cron job that runs the "psql" command every minute using the "postgres" image | Command:
```bash
kubectl create cronjob email-notifications --image=postgres --schedule="*/1 * * * *" -- psql
```
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": "-... |
Retrieve the documentation for the 'phase' field of the 'status' subresource of the 'configmaps' resource | Command:
```bash
kubectl explain resource=configmaps.status.phase
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag t... |
change the service account for the deployment named cache-cluster-deployment to spinnaker | Command:
```bash
kubectl set serviceaccount deployment cache-cluster-deployment spinnaker
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`ku... |
Get the output of the command 'python --version' from the first container of the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl exec deploy/log-aggregator-deployment -- python --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 ... |
Import the 'log_level' key from the 'monitoring-config' ConfigMap into the 'scheduler-app-deployment' deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/monitoring-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 defi... |
Set the service account of the 'user-management-deployment' deployment to 'jenkins' | Command:
```bash
kubectl set serviceaccount deployment user-management-deployment jenkins
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`ku... |
Set the cluster field in a specific context to a given cluster name | Command:
```bash
kubectl config set contexts.user-b-context.cluster moon-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 w... |
Forward traffic from local port 3000 to port 6379 in a pod selected by the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 3000 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 ... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/namespace-config 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 ... |
Return the logs from the container 'gateway-pod-1' in the deployment 'search-engine-deployment' | Command:
```bash
kubectl logs deployment/search-engine-deployment -c gateway-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag... |
Set the service account of a deployment to "tekton" | Command:
```bash
kubectl set serviceaccount deployment mydeployment tekton
```
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:
`kubectl set servi... |
Add a taint on nodes with a specific label | Command:
```bash
kubectl taint node -l region=eu-west-2 hardware=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": "", "us... |
create a service for a wordpress deployment that serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose deployment wordpress --port=8888 --target-port=844300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Forward local traffic from port 8000 to port 3000 on the selected pod | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 8000 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 criteria, ... |
Output the modified deployment in YAML format without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/mydeployment DB_PASSWORD=secretpassword -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod te... |
Add a taint with the key 'app' and value 'dev-node-4:PreferNoSchedule' on nodes having the label 'myLabel'. | Command:
```bash
kubectl taint node -l myLabel app=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": "", "usage": "Output forma... |
Create an ExternalName service named external-messaging-service with the external name "travel-sample.travel" | Command:
```bash
kubectl create service externalname external-messaging-service --external-name travel-sample.travel
```
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 referen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.