prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a service for a replication controller specified in "alpine-controller.yaml" that serves on port 8080 and connects to the containers on port 801000 | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=8080 --target-port=801000
```
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 deployment named "registry" with the "mongo" image and expose port 8084. | Command:
```bash
kubectl create deployment registry --image=mongo --port=8084
```
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: ... |
execute the 'bash' command in the 'lunar-launcher' container of the 'log-aggregator-pod' pod and get the output | Command:
```bash
kubectl exec log-aggregator-pod -c lunar-launcher -- 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,... |
Update the pod named 'monitoring' by setting the annotation 'description' to 'Web server for marketing site', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods monitoring description='Web server for marketing site'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be la... |
Set the cluster field in the specified context to the provided Kubernetes cluster. | Command:
```bash
kubectl config set contexts.cluster-2-context.cluster my-k8s-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 ... |
create a new ClusterIP service named analytics-service-clusterip | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=9092: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": "-... |
Import environment variables with a prefix from the "monitoring-config" ConfigMap into the "payment-processor-deployment" deployment, setting the prefix to "MYSQL_" | Command:
```bash
kubectl set env --from=configmap/monitoring-config --prefix=MYSQL_ 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 d... |
Copy the content of the /var/run/secrets/kubernetes.io/serviceaccount/ directory from the local machine to the /etc/kubernetes directory in the remote pod named "image-resizer-pod-20" in the "cert-manager" namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ cert-manager/image-resizer-pod-20:/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": "", "... |
Listen on port 3000 on all addresses and forward the traffic to port 5000 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 3000: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... |
Output the modified deployment in YAML format without altering the deployment object on the server | Command:
```bash
kubectl set env deployment/frontend-deployment ENV=prod -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 templates (wi... |
Get output from running the 'elasticsearch' command from the first pod of the deployment 'gateway-deployment', using the first container by default. | Command:
```bash
kubectl exec deploy/gateway-deployment -- elasticsearch
```
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... |
Set the CPU limits for the "mongo" container in the "nginx" deployment to 3 and the memory limits to 512Mi. | Command:
```bash
kubectl set resources deployment mongo -c=nginx --limits=cpu=3,memory=512Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to it... |
Forward port 3000 on localhost and IP 10.19.21.23 to port 8080 in the pod named web-app-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 3000: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... |
Taint nodes with label "myLabel" and add a taint with key "app" and value "gpu-node-12:PreferNoSchedule" | Command:
```bash
kubectl taint node -l myLabel app=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": "Output form... |
Delete the pods and services with the names "monitoring" and "vpn" | Command:
```bash
kubectl delete pod,service monitoring vpn
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
... |
Output the modified scheduler-app-deployment deployment in YAML format by setting the environment variable DB_USER to "username", without making any changes to the object on the server. | Command:
```bash
kubectl set env deployment/scheduler-app-deployment DB_USER=username -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 ... |
Execute the command "nginx -t" inside the container named "mycontainer" in the pod "web-app-pod" and display the output. | Command:
```bash
kubectl exec web-app-pod -c mycontainer -- nginx -t
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Roll back the deployment named "test" with a dry-run to preview changes | Command:
```bash
kubectl rollout undo --dry-run=server deployment/test
```
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 ... |
Edit the loadbalancer-service using the Notepad editor. | Command:
```bash
KUBE_EDITOR="notepad" kubectl edit svc/loadbalancer-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 v... |
Create a new ClusterIP service named 'log-service-clusterip' that maps port 27017 on the cluster IP to port 3306 on the service. | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=27017:3306
```
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", "... |
Execute the command 'node --version' in the quantum-quark container of the security-service-pod pod and display the output. | Command:
```bash
kubectl exec security-service-pod -c quantum-quark -- node --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. ... |
Forward all traffic on port 9090 to port 8888 in the 'chat-app-pod' pod, allowing access from all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-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 will... |
Create a new config map named 'log-config' with the specified keys instead of using file basenames on disk | Command:
```bash
kubectl create configmap log-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/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 nginx pod using the amazonlinux image, and override the pod specification with values parsed from a JSON file | Command:
```bash
kubectl run nginx --image=amazonlinux --overrides='{ "apiVersion": "v1.1.1", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [C... |
View the modified configuration of a deployment, without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/proxy-service-deployment PORT=8080 -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 templat... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/database-secret deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod t... |
Create a pod disruption budget named database-pdb that will select all pods with the region=us-east 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=region=us-east --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 [-... |
Create a golang pod with the container exposing port 8181. | Command:
```bash
kubectl run hazelcast --image=golang --port=8181
```
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": "--f... |
Create a debug copy of database-pod with all container images changed to jenkins | Command:
```bash
kubectl debug database-pod --copy-to=debug-image-web --set-image=*=jenkins
```
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 re... |
Copy the local file /tmp/foo_dir to the /tmp/bar directory within the metrics-exporter-pod-10 pod in the logging namespace. | Command:
```bash
kubectl cp /tmp/foo_dir logging/metrics-exporter-pod-10::/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Create a deployment named 'proxy' with the image 'amazonlinux' and run the command 'yum install -y aws-cli' | Command:
```bash
kubectl create deployment proxy --image=amazonlinux -- yum install -y aws-cli
```
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... |
Import specific key(s) from a config map to a deployment | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-config-dev deployment/user-management-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... |
Forward traffic from port 6379 on localhost and IP address 10.19.21.23 to port 3000 in the analytics-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/analytics-pod 6379: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 crite... |
Execute the 'geth' command in the 'warp-drive' container of the 'database-pod' pod and get the output. | Command:
```bash
kubectl exec database-pod -c warp-drive -- geth
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
retrieve the replication controller named 'web', the service named 'web-app-rc', and the pod named 'chat-app-pod' | Command:
```bash
kubectl get rc/web service/web-app-rc pods/chat-app-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 yo... |
Check if you have the permission to list the job named "database-indexing-job" in the "kube-ingress" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n kube-ingress
```
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 par... |
Update the annotation 'deployment-script' of the pod named 'security' to the value 'https://example.com/deploy.sh', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods security deployment-script='https://example.com/deploy.sh'
```
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 b... |
Create a role named "admin_role" that allows getting pods with specific resource names | Command:
```bash
kubectl create role admin_role --verb=get --resource=pods --resource-name=auth-proxy --resource-name=queue-consumer
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|cl... |
Update the pod named 'monitoring' with a new label called 'release' and assign it the value 'v2.0' | Command:
```bash
kubectl label pods monitoring 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"... |
Update the image of the container in the auth-service-pod using a JSON patch with positional arrays | Command:
```bash
kubectl patch pod auth-service-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
```
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... |
Dump the current state of the cluster to the standard output | Command:
```bash
kubectl cluster-info dump
```
What it does:
Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you specify a directory, Kubernetes will build a set of files in... |
Update the annotation of the pod 'frontend' to set the criticality as 'high', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite pods frontend criticality='high'
```
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 includ... |
Create an ingress named 'external-ingress' that routes requests from foo.com/input to svc1:8082, with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress external-ingress --rule="foo.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": "", "usage... |
Delete the "vpn-service-pod" pod and wait for it to be deleted, with a timeout of 60 seconds | Command:
```bash
kubectl delete pod/vpn-service-pod
kubectl wait --for=delete pod/busybox1 --timeout=60s
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resour... |
Import the 'debug_mode' key from the 'api-config' ConfigMap and set it as an environment variable for the 'database-deployment' deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/api-config deployment/database-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 ... |
Remove the taint with key 'hardware' and effect 'NoExecute' from the node 'web-node-8' | Command:
```bash
kubectl taint nodes web-node-8 hardware: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 of: j... |
set environment variables from a specific config map for a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/namespace-config deployment/database-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... |
Return the previous terminated logs of the "mycontainer" container from the "auth-service-pod" pod. | Command:
```bash
kubectl logs -p -c mycontainer auth-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 port 5000 on all addresses to port 8888 in the pod named e-commerce-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 5000: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 wi... |
Set up a port-forwarding connection to listen on port 8080 locally and forward traffic to the 5432 port in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8080: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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/kube-system-config 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 defi... |
Create a new NodePort service named 'ingress-controller-nodeport' that maps port 8443 on the host to port 8080 on the pods. | Command:
```bash
kubectl create service nodeport ingress-controller-nodeport --tcp=8443: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", "de... |
Embed certificate authority data for the star-cluster cluster entry | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/cluster-gamma/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config se... |
Import the environment variables from the config map named "app-config" with a prefix of "MYSQL_" to the "analytics-platform-deployment" deployment. | Command:
```bash
kubectl set env --from=configmap/app-config --prefix=MYSQL_ 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... |
Wait for the deletion of a specific pod with a timeout | Command:
```bash
kubectl delete pod/proxy-service-pod
kubectl wait --for=delete pod/busybox1 --timeout=60s
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given reso... |
change the size of the 'mysql' deployment in the default namespace to 3 | Command:
```bash
kubectl scale --current-replicas=1 --replicas=3 deployment/mysql
```
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 sp... |
Expose a deployment named "node" as a service, listening on port 8443 and forwarding traffic to the containers on port 808300. | Command:
```bash
kubectl expose deployment node --port=8443 --target-port=808300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified... |
Create a copy of "proxy-server-pod" by adding a debug container and changing the container images by running the "kubectl debug" command with the appropriate flags and values. | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,app=app:debug
```
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... |
Apply a taint with the key 'app' to nodes that have the label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack app=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 ... |
Update the annotation of a pod specified in the "setup.json" file | Command:
```bash
kubectl annotate -f setup.json last-deployment=2023-03-15
```
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 ar... |
Create a cluster role named "default_role" with specific resource names | Command:
```bash
kubectl create clusterrole default_role --verb=create --resource=services --resource-name=database-master --resource-name=dashboard-ui
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=serv... |
Open an interactive bash session in the 'astro-container' from the 'proxy-server-pod' pod, and switch to the raw terminal mode | Command:
```bash
kubectl exec proxy-server-pod -c astro-container -i -t -- bash -il
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Create a copy of the email-service-pod, adding a debug container and changing the container images. | Command:
```bash
kubectl debug email-service-pod -it --copy-to=my-debugger --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... |
List all deployments in the "v3.0.0" version of the "custom-apps" API group in YAML output format | Command:
```bash
kubectl get deployments.v3.0.0.custom-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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/env-vars deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Update the annotation 'release-notes' of pod 'analytics' with the value 'https://example.com/release-notes/v2.5.1', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods analytics release-notes='https://example.com/release-notes/v2.5.1'
```
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 th... |
Forward traffic from local port 3000 to the pod's port 8080 in the web-app-pod pod | Command:
```bash
kubectl port-forward pod/web-app-pod 3000 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... |
Create a new config map named app-config-prod in the current namespace, with the specified keys and file paths as the values | Command:
```bash
kubectl create configmap app-config-prod --from-file=settings=/path/to/settings/file1.txt --from-file=key2=/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 creatin... |
Add a taint with the key 'dedicated' and value 'kube-master-9:PreferNoSchedule' on nodes having the label team=devops. | Command:
```bash
kubectl taint node -l team=devops dedicated=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": ... |
Create a debug container copy of the 'security-service-pod' with all container images changed to 'alpine' | Command:
```bash
kubectl debug security-service-pod --copy-to=debug-image-1 --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 ... |
Update the pod identified by type and name specified in the "settings.json" file by annotating it with the label 'team' set to 'frontend team'. | Command:
```bash
kubectl annotate -f settings.json team='frontend team'
```
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... |
Create a role named "custom_role" with SubResources endpoints and endpoints/status, allowing the verbs list, create, and update. | Command:
```bash
kubectl create role custom_role --verb=list,create,update --resource=endpoints,endpoints/status
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful... |
Import the specific key 'config_file_path' from the 'monitoring-config' ConfigMap and set it as an environment variable for the 'log-aggregator-deployment' deployment. | Command:
```bash
kubectl set env --keys=config_file_path --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... |
import the 'redis_host' key from the 'app-secrets' config map and set it as an environment variable in the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-secrets 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 definition... |
Get output from nebula-navigator in the backend-pod | Command:
```bash
kubectl attach backend-pod -c nebula-navigator
```
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,... |
Run the 'bash' command inside the nano-bot container of the log-aggregator-pod and get the output | Command:
```bash
kubectl exec log-aggregator-pod -c nano-bot -- 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 t... |
Add a taint with key 'zone' on nodes having label zone=us-east-1 | Command:
```bash
kubectl taint node -l zone=us-east-1 zone=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Forward the local port 9090 to port 8081 in the security-service-pod pod | Command:
```bash
kubectl port-forward pod/security-service-pod 9090: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 select... |
Set the certificate-authority-data field on the 'cluster-gamma' cluster using the specified certificate data. | Command:
```bash
kubectl config set clusters.cluster-gamma.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... |
Forward local port 8888 to port 3000 in the pod selected by the web-app-deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8888 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, a pod will be s... |
Create an ingress resource called 'website-ingress' with a rule that directs requests from testing.com/module to the service 'svc1' on port 9090, and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/module=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Execute the command 'kafka-server-start /etc/kafka/server.properties' in the warp-drive container of the vpn-service-pod pod and display the output | Command:
```bash
kubectl exec vpn-service-pod -c warp-drive -- kafka-server-start /etc/kafka/server.properties
```
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": "", "... |
Retrieve the snapshot logs from the container named api-service-pod-1 in the web-app-deployment deployment. | Command:
```bash
kubectl logs deployment/web-app-deployment -c api-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag":... |
Copy the directory /tmp/foo_dir from the remote pod message-broker-pod-15 in the metallb-system namespace to the local directory /tmp/bar. | Command:
```bash
kubectl cp metallb-system/message-broker-pod-15:/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, ... |
Import specific keys from a config map in an existing deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-settings 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 defin... |
Create a pod named "hazelcast" using the nginx image and expose port 6379. | Command:
```bash
kubectl run hazelcast --image=nginx --port=6379
```
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... |
Get the output from the lunar-launcher container in the log-aggregator-pod. | Command:
```bash
kubectl attach log-aggregator-pod -c lunar-launcher
```
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 omi... |
Create an ingress called 'app-loadbalancer-ingress' that directs requests to site.com/bar to a service named svc1 listening on port 27017 | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="site.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": ""... |
Forward incoming traffic on local port 6379 to port 5000 in the "security-service-pod" pod. | Command:
```bash
kubectl port-forward pod/security-service-pod 6379: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... |
Forward local port 5432 to port 8888 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward pod/web-app-pod 5432:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/log-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 variable def... |
Create a service for the replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rs nginx --port=8000 --target-port=700000
```
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. ... |
Update the image of all containers in the daemonset named 'test' to 'mysql:5.7.35' | Command:
```bash
kubectl set image daemonset test *=mysql:5.7.35
```
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:
`kubect... |
Apply the configuration in manifest.yaml, deleting all resources that are not in the file and match the label customer=acme-corp | Command:
```bash
kubectl apply --prune -f manifest.yaml -l customer=acme-corp
```
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'... |
Create a new secret named my-secret using the configurations from the file path/to/configurations.env. | Command:
```bash
kubectl create secret generic my-secret --from-env-file=path/to/configurations.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 base... |
Set a custom TLS server name for the "data-cluster" cluster | Command:
```bash
kubectl config set-cluster data-cluster --tls-server-name=cluster-beta
```
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... |
Forward local port 8080 to port 8081 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward pod/web-app-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 be selected automa... |
Execute the 'dotnet' command in the first container of the 'auth-service-pod' pod. | Command:
```bash
kubectl exec auth-service-pod -- dotnet
```
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.k... |
Create a copy of a pod with a debug container and updated container images | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=my-debugger --image=debian --set-image=mailer=mailer:latest,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... |
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=properties=/path/to/configs/file1.txt --from-file=key1=/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 crea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.