prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a copy of proxy-server-pod with modified container images | Command:
```bash
kubectl debug proxy-server-pod --copy-to=debug-image-1 --set-image=*=docker.elastic.co/elasticsearch/elasticsearch
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and nam... |
Create a new secret named 'gcp-service-account-secret' using the files in the 'path/to/parameters' folder | Command:
```bash
kubectl create secret generic gcp-service-account-secret --from-file=path/to/parameters
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-config-dev 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 def... |
Get output from nebula-navigator in chat-app-pod | Command:
```bash
kubectl attach chat-app-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... |
Partially update the db-node-7 node by changing the replicas value to 3 using a strategic merge patch specified in YAML format. | Command:
```bash
kubectl patch node db-node-7 -p $'spec:\n replicas: 3'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful flags:
"fl... |
Display the last 12 lines of logs from the 'mypod' pod. | Command:
```bash
kubectl logs --tail=12 mypod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-c", "def... |
import the environment variables from the 'log-config' config map with a prefix of 'MYSQL_' for the 'backend-microservice-deployment' deployment. | Command:
```bash
kubectl set env --from=configmap/log-config --prefix=MYSQL_ deployment/backend-microservice-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 job with a specific command | Command:
```bash
kubectl create job monitoring-job --image=php -- php --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 format... |
Create a new config map named 'app-config' using the specified keys and files | Command:
```bash
kubectl create configmap app-config --from-file=settings=/path/to/data/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 con... |
Remove all taints with the key 'workload' from node 'node-1' | Command:
```bash
kubectl taint nodes node-1 workload-
```
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|yaml|name|... |
Get the output from running the 'node --version' command in the quantum-quark container of the chat-app-pod pod. | Command:
```bash
kubectl exec chat-app-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. If omitt... |
Create a new config map named app-name-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/preferences/file1.txt --from-file=data=/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 creating... |
Get the output from running the 'irb' command in the 'code-explorer' container from the 'cdn-service-pod' pod. | Command:
```bash
kubectl exec cdn-service-pod -c code-explorer -- irb
```
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 ... |
Get the logs from the container named "payment-gateway-pod-1" in the deployment named "frontend-deployment" | Command:
```bash
kubectl logs deployment/frontend-deployment -c payment-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:
"f... |
Remove the taint with key 'special' and effect 'NoSchedule' from node 'dev-node-4' | Command:
```bash
kubectl taint nodes dev-node-4 special:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Add a taint to nodes with a specific label | Command:
```bash
kubectl taint node -l version=v1.0.0 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": "", "usag... |
Update the pod identified by the type and name specified in the "conf.json" file by annotating it with the app-version=2.5.1 label | Command:
```bash
kubectl annotate -f conf.json app-version=2.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 that can be larger than labels and include arbitrary st... |
Create a debug container based on the 'gateway-pod' pod, but change the command of the 'nebula-navigator' container | Command:
```bash
kubectl debug gateway-pod -it --copy-to=debug-image-1 --container=nebula-navigator -- 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 de... |
Add a taint with the key 'disktype' and value 'gpu-node-12:PreferNoSchedule' on nodes that have the label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops 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": "Ou... |
Create a copy of the 'e-commerce-pod' pod with a debug container and changed container images for 'logger' and 'database' | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=debug-image-1 --image=debian --set-image=logger=logging-app:debug,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by res... |
Use an alternative editor (in this case, notepad) to edit the configuration of a service named "email-service". | Command:
```bash
KUBE_EDITOR="notepad" kubectl edit svc/email-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variable... |
Create a new ClusterIP service named 'billing-service-clusterip', with a TCP port forwarding from port 8080 to port 8000. | Command:
```bash
kubectl create service clusterip billing-service-clusterip --tcp=8080:8000
```
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 'redis-cli' command in the 'cyber-sleuth' container of the 'security-service-pod' pod and get the output. | Command:
```bash
kubectl exec security-service-pod -c cyber-sleuth -- 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 omi... |
Copy a file named "foo" from the local machine to a specific directory ("/tmp/bar_dir") inside a remote pod named "load-balancer-pod-9" | Command:
```bash
kubectl cp :/tmp/foo load-balancer-pod-9:/tmp/bar_dir -c payment-gateway
```
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... |
Update the chat-app pod with the annotation 'criticality' and set its value to 'high', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods chat-app 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... |
Remove all taints with the key 'dedicated' from the 'edge-node-10' node. | Command:
```bash
kubectl taint nodes edge-node-10 dedicated-
```
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|yam... |
Update the deployment named 'web-app-deployment' by adding a new environment variable called 'GOOGLE_API_KEY' with the value 'your-google-api-key'. | Command:
```bash
kubectl set env deployment/web-app-deployment GOOGLE_API_KEY=your-google-api-key
```
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 an ingress named 'ingress1' with multiple hosts and set the pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="site.com/path*=svc:7000" \
--rule="module.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output",... |
Listen on port 8000 on all addresses, forwarding to port 5000 in the frontend-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Start the nginx pod using the redis image, with custom arguments (arg1 .. argN) for the default command. | Command:
```bash
kubectl run nginx --image=redis -- <arg1> <arg2> ... <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...]`
Helpful flags:
"... |
Create a new namespace named monitoring. | Command:
```bash
kubectl create namespace monitoring
```
What it does:
Create a namespace with the specified name.
Syntax:
`kubectl create namespace NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-template|go-tem... |
Delete the specified context from the Kubernetes configuration | Command:
```bash
kubectl config delete-context user-a-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
delete a pod and service with the names "media-stream" and "monitoring" | Command:
```bash
kubectl delete pod,service media-stream monitoring
```
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 s... |
Forward traffic from local port 8080 to port 9090 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8080: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 p... |
Set the custom TLS server name to "data-cluster" for the "testing-cluster" cluster entry | Command:
```bash
kubectl config set-cluster testing-cluster --tls-server-name=data-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certific... |
Create a new ExternalName service with the name "external-ldap-service" and the external name "museum-example.museum" | Command:
```bash
kubectl create service externalname external-ldap-service --external-name museum-example.museum
```
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 s... |
List the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/proxy-server-rc pods/database-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... |
Create a service for a replicated Ruby application that serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose rc ruby --port=8084 --target-port=818100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A... |
Forward data between local port 8081 and port 8000 in the pod security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8081 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 select... |
Listen on all addresses on port 9090 and forward the traffic to port 9090 of the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 9090: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 ... |
Create a service for a replicated alpine using replica set, which serves on port 8084 and connects to the containers on port 500100 | Command:
```bash
kubectl expose rs alpine --port=8084 --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.... |
Attach to the first pod of the replica set named "runtime" and get output from it. | Command:
```bash
kubectl attach rs/runtime
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kube... |
Set the custom TLS server name to "dev-cluster" for the dev-cluster cluster entry | Command:
```bash
kubectl config set-cluster dev-cluster --tls-server-name=dev-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate-a... |
Delete pods and services named "payment" and "chat-app" | Command:
```bash
kubectl delete pod,service payment chat-app
```
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... |
Update pod 'log-aggregator' label to 'env=staging' | Command:
```bash
kubectl label pods log-aggregator 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", "usa... |
Create a copy of the mypod pod and change all container images to busybox using the kubectl debug command | Command:
```bash
kubectl debug mypod --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 resource is s... |
Set the custom TLS server name to 'kube-cluster-2' for the 'cloud-cluster' cluster entry | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=kube-cluster-2
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certific... |
Create a generic secret named ldap-credentials-secret using the files in the path/to/data folder | Command:
```bash
kubectl create secret generic ldap-credentials-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... |
Forward port 8080 in the 'e-commerce-pod' pod to port 8000 on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8000:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wi... |
Add a taint with key 'hardware' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta hardware=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Import the 'smtp_server' key from the 'ui-config' config map and set it as an environment variable for the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/ui-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 defini... |
Create a debug copy of the proxy-server-pod with all container images changed to centos | Command:
```bash
kubectl debug proxy-server-pod --copy-to=debug-image-api --set-image=*=centos
```
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... |
forward local port 3000 to port 9090 of the selected pod in the notification-handler-deployment | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 3000 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 ... |
Update the 'media-stream' pod with the label 'tier' and the value 'database'. | Command:
```bash
kubectl label pods media-stream tier=database
```
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", "usa... |
View the previous terminated logs of the container named "cosmic-container" in the pod named "proxy-server-pod" | Command:
```bash
kubectl logs -p -c cosmic-container proxy-server-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": "--contain... |
Run the 'npm --version' command in the quantum-quark container from the frontend-pod pod | Command:
```bash
kubectl exec frontend-pod -c quantum-quark -- npm --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 omitte... |
Scale the deployment named 'frontend-rs' to a size of 5 replicas to match the current size of the deployment. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=5 deployment/frontend-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-version... |
Set the cluster field in the team-beta-context context to sun-cluster. | Command:
```bash
kubectl config set contexts.team-beta-context.cluster sun-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... |
Set the cpu limit of the 'golang' container in the 'nginx' deployment to "50m" and the memory limit to "4Gi" | Command:
```bash
kubectl set resources deployment golang -c=nginx --limits=cpu=50m,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to i... |
Set the service account for the deployment "log-aggregator-deployment" to "kube-scheduler" | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-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
Synta... |
Add a taint with the key 'workload' and value 'kube-master-9:PreferNoSchedule' on nodes that have the label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth workload=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": ... |
Copy the file /tmp/foo from the remote pod message-broker-pod-15 in the kube-flannel namespace to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp kube-flannel/message-broker-pod-15::/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, us... |
Create a copy of the vpn-service-pod and change all container images to python. The copy will be named debug-image-memcached. | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-memcached --set-image=*=python
```
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 ... |
Import environment variables from a config map with a specific prefix | Command:
```bash
kubectl set env --from=configmap/app-secrets --prefix=MYSQL_ deployment/load-balancer-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... |
expose the hazelcast deployment as a service, listening on port 9091 and forwarding traffic to the containers on port 300000 | Command:
```bash
kubectl expose deployment hazelcast --port=9091 --target-port=300000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Create an ingress called 'service-ingress' that routes requests to website.com/input to svc1:5001 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="website.com/input=svc1:5001,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... |
Start port forwarding for the frontend-pod, forwarding port 8088 on localhost and IP address 10.19.21.23 to port 8888 in the pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 8088: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 criter... |
Set the cluster field in the my-context context to galaxy-cluster | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster galaxy-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 cluster role named "default_role" with the following resource specifications: | Command:
```bash
kubectl create clusterrole default_role --verb=patch --resource=services --resource-name=audit-logger --resource-name=file-storage
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|c... |
Start a nginx pod using the image 'mcr.microsoft.com/dotnet/core/runtime', but customize the spec with a partial set of values parsed from JSON using the overrides flag | Command:
```bash
kubectl run nginx --image=mcr.microsoft.com/dotnet/core/runtime --overrides='{ "apiVersion": "custom-version", "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] [--overri... |
Output the modified 'authentication-service-deployment' deployment in YAML format, without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/authentication-service-deployment MONGO_URI=mongodb://localhost:27017/mydb -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 variabl... |
Create a job named 'batch-processing' using the image 'mcr.microsoft.com/dotnet/core/runtime' and run the command 'dotnet --list-runtimes' inside the job | Command:
```bash
kubectl create job batch-processing --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-runtimes
```
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":... |
Create a pod disruption budget named "ingress-controller-pdb" with the following criteria: select all pods with the "app=rails" label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=app=rails --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... |
Get the output from running the 'node' command in the first container of the api-server-deployment deployment. | Command:
```bash
kubectl exec deploy/api-server-deployment -- node
```
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... |
Start a nginx pod using the ubuntu image, but override the specifications by providing a partial set of values parsed from JSON. | Command:
```bash
kubectl run nginx --image=ubuntu --overrides='{ "apiVersion": "v2.1.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAN... |
Add a taint with the key 'zone' and the value 'prod-node-5:PreferNoSchedule' on the nodes that have the label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops zone=prod-node-5: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... |
Import environment variables from the 'db-config' config map into the 'proxy-service-deployment' deployment, prefixing each variable with 'MYSQL_' | Command:
```bash
kubectl set env --from=configmap/db-config --prefix=MYSQL_ deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Import the DATABASE_URL key from the app-name-config config map into the search-engine-deployment deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-name-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Create a new config map named 'app-config' with the specified keys 'conf' and 'data' | Command:
```bash
kubectl create configmap app-config --from-file=conf=/path/to/options/file1.txt --from-file=data=/path/to/data/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 config map... |
Create a new config map named 'db-config' using the specified keys and file paths | Command:
```bash
kubectl create configmap db-config --from-file=settings=/path/to/options/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 con... |
Forward local ports 8888 and 6000 to the corresponding ports in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8888 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... |
Remove the taint with key 'zone' and effect 'PreferNoSchedule' from the 'node-2' node | Command:
```bash
kubectl taint nodes node-2 zone: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 format. One of: js... |
Create a single ingress called 'app-gateway-ingress' that directs requests to website.com/bar to svc1:8081 with the tls secret "my-cert" | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.com/bar=svc1:8081,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 local port 5432 to port 8000 in the pod/log-aggregator-pod pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 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 pod will be selected... |
Edit the logging-service service using the gedit editor. | Command:
```bash
KUBE_EDITOR="gedit" kubectl edit svc/logging-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 variable... |
Copy the local file '~/.config/kube' to the path '/tmp/bar' in the 'api-server-pod-3' pod in the 'kube-system' namespace | Command:
```bash
kubectl cp ~/.config/kube kube-system/api-server-pod-3:/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... |
Forward local port 6379 to port 8888 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward pod/chat-app-pod 6379: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 autom... |
Create a copy of the 'media-stream-pod' pod and add a 'debian' debug container to it | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=my-debugger --image=debian --set-image=database=mysql:5.7,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 an... |
Display the most recent 5 lines of logs for the pod named "security-service-pod". | Command:
```bash
kubectl logs --tail=5 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", "shor... |
Copy a local file to a remote pod in a specific directory | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kube-proxy/database-pod-2:/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": "Co... |
Import specific keys from a config map to an environment variable in a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Create a pod disruption budget named load-balancer-pdb that will select all pods with the app=rails label and require a minimum of 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=app=rails --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [-... |
Start a mongo pod with the image "mongo", but customize the spec with a partial set of values parsed from the provided JSON | Command:
```bash
kubectl run nginx --image=mongo --overrides='{ "apiVersion": "feature-branch-2.3.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--comman... |
Add a taint to nodes labeled with 'version=v1.0.0' with a key 'zone' and value 'node-1' to prevent scheduling of new pods on those nodes. | Command:
```bash
kubectl taint node -l version=v1.0.0 zone=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 f... |
Create a deployment named 'proxy' that uses the 'docker.elastic.co/elasticsearch/elasticsearch' image and exposes port 9090. | Command:
```bash
kubectl create deployment proxy --image=docker.elastic.co/elasticsearch/elasticsearch --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": ... |
Display the information for multiple resources based on their type and names. | Command:
```bash
kubectl get rc/web service/database-rc pods/email-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 namespa... |
Create a new ExternalName service named 'external-dns-service' with the external name 'travel-sample.travel' | Command:
```bash
kubectl create service externalname external-dns-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 reference ser... |
Add a taint with key 'app' and no value to node 'app-node-6' | Command:
```bash
kubectl taint nodes app-node-6 app: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|y... |
Set the cluster field in the 'service-account-context' context to 'galaxy-cluster' | Command:
```bash
kubectl config set contexts.service-account-context.cluster galaxy-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 ... |
Update the cluster field in a specific context to the specified cluster name. | Command:
```bash
kubectl config set contexts.user-a-context.cluster testing-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value yo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.