prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy the local file '/tmp/foo_dir' to the remote pod 'file-server-pod-14' in the 'kube-server' namespace, and save it as '/tmp/bar'. | Command:
```bash
kubectl cp /tmp/foo_dir kube-server/file-server-pod-14::/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 th... |
Remove the taint with key 'environment' from node 'prod-node-5' | Command:
```bash
kubectl taint nodes prod-node-5 environment-
```
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|ya... |
Copy the ~/.config/kube file from the 'argocd/load-balancer-pod-9' pod on the remote cluster to the /tmp/bar directory locally. | Command:
```bash
kubectl cp argocd/load-balancer-pod-9:~/.config/kube :/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 ... |
Add taint to node db-node-7 with key 'cpu-type', value 'x86' and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes db-node-7 cpu-type=x86: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... |
Create a new service account named my-service-account | Command:
```bash
kubectl create serviceaccount my-service-account
```
What it does:
Create a service account with the specified name.
Syntax:
`kubectl create serviceaccount NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml... |
Scale the replica set named 'baz' to 1 replica | Command:
```bash
kubectl scale --replicas=1 rs/baz
```
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 specified, it is validated before... |
Forward local port 6379 to port 8000 in the pod with name "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 6379 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 port 8088 on all addresses, and forward the traffic to port 8888 in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-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 criteria, a pod w... |
Forward traffic from port 8888 on localhost and selected IP to port 5432 in the pod named "api-service-pod". | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 8888: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 cri... |
Import the 'my-example-key' key from the 'app-name-config' config map into the 'user-management-deployment' deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-name-config 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... |
Create a new ExternalName service named external-ldap-service with the external name "bar.com" | Command:
```bash
kubectl create service externalname external-ldap-service --external-name bar.com
```
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 services that e... |
Set the service account of the deployment "user-management-deployment" to "spinnaker" | Command:
```bash
kubectl set serviceaccount deployment user-management-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:
`... |
Create a job named 'batch-processing' using the 'redis' image and run the command 'redis-cli' | Command:
```bash
kubectl create job batch-processing --image=redis -- redis-cli
```
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... |
List the replication controller named 'web', the service named 'backend-rc', and the pod named 'vpn-service-pod' | Command:
```bash
kubectl get rc/web service/backend-rc pods/vpn-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 an ingress resource called 'public-service-ingress' that routes requests from site.com/example to svc1:5432 with a tls secret named "my-cert". | Command:
```bash
kubectl create ingress public-service-ingress --rule="site.com/example=svc1:5432,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Get the output of the 'go version' command from the container in the pod named proxy-service-pod. | Command:
```bash
kubectl exec proxy-service-pod -- go 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 the kube... |
Create a new secret named gcp-service-account-secret with keys for each file in the folder named "bar" located at the path "path/to/options" | Command:
```bash
kubectl create secret generic gcp-service-account-secret --from-file=path/to/options
```
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 ba... |
Create a new secret named monitoring-credentials-secret from an environment file | Command:
```bash
kubectl create secret generic monitoring-credentials-secret --from-env-file=path/to/settings.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 defau... |
Embed the certificate authority data for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/kube-cluster-2/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 set-cluste... |
Make changes to the data in the params.json file in JSON format, and then create the resource using the edited data. | Command:
```bash
kubectl create -f params.json --edit -o json
```
What it does:
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
Syntax:
`kubectl create -f FILENAME`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files to ... |
Create a pod disruption budget named batch-processing-pdb that selects all pods with the project=my-project label and requires a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=project=my-project --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-av... |
Create a new config map named app-name-config with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap app-name-config --from-file=settings=/path/to/properties/file1.txt --from-file=key2=/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 creat... |
Get the replication controller with the name 'web', the service with the name 'chat-app-rc', and the pod with the name 'log-aggregator-pod'. | Command:
```bash
kubectl get rc/web service/chat-app-rc pods/log-aggregator-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 namesp... |
Apply a taint on the nodes with the label `zone=us-east-1` using the key-value pair `special=gpu-node-12` with the effect `PreferNoSchedule`. | Command:
```bash
kubectl taint node -l zone=us-east-1 special=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": "... |
Create a config map named monitoring-config from specified files | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/properties/file1.txt --from-file=key2=/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 c... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/ui-config 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... |
Create a job to generate a report using the nginx image | Command:
```bash
kubectl create job report-generation-job --image=nginx -- nginx
```
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 forma... |
Import the EXTERNAL_API_URL key from the log-config config map into the load-balancer-deployment deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/log-config 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 defi... |
Add a taint with key 'disktype' on nodes having label cluster=my-cluster | Command:
```bash
kubectl taint node -l cluster=my-cluster disktype=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": "", "... |
Add the annotation 'compliance-level' with the value 'PCI-DSS' to the 'payment' pod. | Command:
```bash
kubectl annotate pods payment compliance-level=PCI-DSS
```
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... |
Switch to raw terminal mode and attach to the 'nebula-navigator' container in the 'cdn-service-pod', sending stdin to 'bash' and receiving stdout/stderr from 'bash'. | Command:
```bash
kubectl attach cdn-service-pod -c nebula-navigator -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
Set the custom TLS server name "star-cluster" for validation in the edge-cluster cluster entry | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=star-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... |
Add a taint with key 'environment' on nodes having label version=v1.0.0 and the value 'web-node-8:PreferNoSchedule' | Command:
```bash
kubectl taint node -l version=v1.0.0 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"... |
Create a new config map with specified keys from files | Command:
```bash
kubectl create configmap global-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/path/to/configs/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... |
Copy the file '/tmp/foo' from the local machine to the '/tmp/bar_dir' directory inside the 'database-pod-2' pod, specifically in the 'ingress-controller' container. | Command:
```bash
kubectl cp :/tmp/foo database-pod-2:/tmp/bar_dir -c ingress-controller
```
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, ... |
Create a deployment named 'logging' that runs the 'amazonlinux' image with 6 replicas | Command:
```bash
kubectl create deployment logging --image=amazonlinux --replicas=6
```
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. On... |
Copy the file '~/.config/kube' from the 'front-end-pod-12' pod in the 'kubeapps' namespace to the local directory '/tmp/bar' | Command:
```bash
kubectl cp kubeapps/front-end-pod-12:~/.config/kube :/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 k... |
Start streaming the logs of the astro-container container in the media-stream-pod pod | Command:
```bash
kubectl logs -f -c astro-container media-stream-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... |
Listen on all addresses on port 8080 and forward the traffic to port 8081 in the 'log-aggregator-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-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 po... |
Create a pod named 'hazelcast' using the 'ubuntu' image and expose port 9000 | Command:
```bash
kubectl run hazelcast --image=ubuntu --port=9000
```
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 job with the name 'deployment-rollout-job', using the 'amazonlinux' image, and executing the command "/bin/bash -c 'echo Hello'" | Command:
```bash
kubectl create job deployment-rollout-job --image=amazonlinux -- /bin/bash -c "echo 'Hello
```
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":... |
Create an ingress object named 'rontend-ingress' with a rule that directs requests from website.com/bar to svc1:8088 | Command:
```bash
kubectl create ingress rontend-ingress --rule="website.com/bar=svc1:8088,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": "", "usag... |
Set the service account for the deployment "email-server-deployment" to "vault". | Command:
```bash
kubectl set serviceaccount deployment email-server-deployment vault
```
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... |
Add a taint with the key 'special' on nodes that have the label 'team=devops', specifically on the node with the name 'node-1', and the taint effect should be 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l team=devops special=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... |
Import environment from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/app-config-secret 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 definitions in ... |
Embed the certificate authority data for the "data-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster data-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... |
Forward traffic from port 5000 on all addresses to port 3000 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 5000: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 ... |
Create a new config map named app-secrets in the current namespace, using the specified files as the values for the keys settings and key2 | Command:
```bash
kubectl create configmap app-secrets --from-file=settings=/path/to/preferences/file1.txt --from-file=key2=/path/to/preferences/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 creat... |
Create a job called "report-generation-job" with the image "centos" and run the command "sleep 3600" | Command:
```bash
kubectl create job report-generation-job --image=centos -- sleep 3600
```
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... |
List all deployments in the "feature-branch-2.3.0" version of the "api-v2" API group in JSON format. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.api-v2 -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 namespace... |
Add a taint with the key 'special' and value 'storage-node-13:PreferNoSchedule' to nodes that have the label 'version=v1.0.0' | Command:
```bash
kubectl taint node -l version=v1.0.0 special=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": "", "usage... |
Open the 'db-service' service for editing using the 'gedit' editor. | Command:
```bash
KUBE_EDITOR="gedit" kubectl edit svc/db-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/db-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 variable def... |
Listen on port 8088 locally and forward data to/from port 6379 in the pod selected by the 'web-app-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8088 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 s... |
Apply the configuration defined in the "setup.json" file to a pod. | Command:
```bash
kubectl apply -f ./setup.json
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
JSO... |
Create a ClusterIP service named monitoring-service-clusterip with a TCP port mapping. | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=8443: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": "... |
Display the modified deployment configuration in YAML format without updating the actual deployment on the server. | Command:
```bash
kubectl set env deployment/order-processing-deployment REDIS_HOST=redis-server -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... |
Forward local port 8080 to port 8081 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-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 autom... |
Create a debug container copy of web-app-pod with all container images changed to python | Command:
```bash
kubectl debug web-app-pod --copy-to=dgb-img --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 if no resource is ... |
Forward local port 8088 to pod port 3000 in order to access the API service | Command:
```bash
kubectl port-forward pod/api-service-pod 8088 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 selected au... |
Import the "api_key" key from the "kube-system-config" ConfigMap into the "gateway-deployment" Deployment. | Command:
```bash
kubectl set env --keys=api_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 definitions... |
Display only the most recent 12 lines of output in the email-service-pod pod | Command:
```bash
kubectl logs --tail=12 email-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", "short"... |
Forward local port 5000 to the targetPort of the "https" port of the api-service service, in a pod selected by the service | Command:
```bash
kubectl port-forward service/api-service 5000:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Switch to raw terminal mode and send stdin to 'bash' in the astro-container from the proxy-server-pod | Command:
```bash
kubectl attach proxy-server-pod -c astro-container -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
Forward local port 8080 to port 8888 in the 'analytics-pod' pod | Command:
```bash
kubectl port-forward pod/analytics-pod 8080:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
Create a single ingress called 'www-ingress' that directs requests to testing.com/example to svc # svc1:7000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress www-ingress --rule="testing.com/example=svc1:7000,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": "", "usag... |
Forward port 8081 on all addresses to port 8888 in the specified pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 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 w... |
Copy the ~/.config/kube file from the message-broker-pod-15 pod to the local directory /tmp/bar | Command:
```bash
kubectl cp rook-ceph/message-broker-pod-15:~/.config/kube :/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... |
Create a new ClusterIP service named database-service-clusterip, mapping port 7000 on the service to port 8888 on the target | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=7000:8888
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o... |
Create an ingress with multiple hosts and the pathType set to Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="website.com/path*=svc:9091" \
--rule="bar.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output",... |
Create a new config map named api-config based on properties files in a specified folder | Command:
```bash
kubectl create configmap api-config --from-file=path/to/properties
```
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 based on a file, the key will default to the basename... |
Create a new config map named app-name-config using the contents of the "profiles" folder | Command:
```bash
kubectl create configmap app-name-config --from-file=path/to/profiles
```
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 based on a file, the key will default to the basen... |
Listen on port 5432 locally, and forward all traffic to the port 5432 inside the 'api-service-pod' pod | Command:
```bash
kubectl port-forward pod/api-service-pod 5432: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... |
Update the pod named 'frontend' with the label 'tier' set to 'database' | Command:
```bash
kubectl label pods frontend 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", "usage":... |
Create a single ingress called 'rontend-ingress' that directs requests to foo.com/module to a service named svc1 on port 6379 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress rontend-ingress --rule="foo.com/module=svc1:6379,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... |
Get the version of 'geth' running in the 'backend-pod' pod. | Command:
```bash
kubectl exec backend-pod -- geth 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 the kubectl.... |
forward incoming traffic on port 8080 to port 3000 in the pod named "log-aggregator-pod" on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8080: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 po... |
Get the output from running the 'python' command in the code-explorer container of the 'media-stream-pod' pod. | Command:
```bash
kubectl exec media-stream-pod -c code-explorer -- python
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Create a new secret named cert-manager-secret from an environment file named "properties.env" | Command:
```bash
kubectl create secret generic cert-manager-secret --from-env-file=path/to/properties.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 th... |
Create a role named "custom_role" with the verb "patch" and the resources "pods" with the resource names "app-worker-2" and "nginx-proxy" | Command:
```bash
kubectl create role custom_role --verb=patch --resource=pods --resource-name=app-worker-2 --resource-name=nginx-proxy
```
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|... |
Execute the 'mysql' command in the first container of the 'mydeployment' deployment. | Command:
```bash
kubectl exec deploy/mydeployment -- mysql
```
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... |
Embed the certificate authority data for the cluster-beta cluster entry, using the certificate authority file located at ~/.kube/on-prem-cluster/kubernetes.ca.crt. | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/on-prem-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config ... |
Create a pod disruption budget named 'api-service-pdb' that selects all pods with the label 'release=1.0.0' and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=release=1.0.0 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Import specific keys from a config map into a 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... |
View the last-applied-configuration annotations of a deployment resource named "jenkins" in YAML format | Command:
```bash
kubectl apply view-last-applied deployment/jenkins
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-applie... |
Set the service account of the load-balancer-deployment deployment to my-service-account | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment my-service-account
```
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
Sy... |
Forward local ports 5000 to 8888 in a pod selected by the search-engine-deployment deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 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 wil... |
Create a pod disruption budget named "payment-gateway-pdb" that will select all pods with the "component=web" label and require at least one of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=component=web --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-availabl... |
Set the service account of the deployment "analytics-platform-deployment" to "vault" | Command:
```bash
kubectl set serviceaccount deployment analytics-platform-deployment vault
```
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... |
Update the 'gateway' pod by removing the label named 'unhealthy' if it exists | Command:
```bash
kubectl label pods gateway unhealthy-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If... |
Get the documentation of a specific field of a resource | Command:
```bash
kubectl explain resource=pods.metadata.annotations
```
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... |
Execute the 'node' command in the 'stardust-shuttle' container within the 'payment-gateway-pod' pod and display the output. | Command:
```bash
kubectl exec payment-gateway-pod -c stardust-shuttle -- 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 omitt... |
Copy the ~/.config/kube file from the ingress-controller-pod-8 pod in the kube-dns namespace to the /tmp/bar directory on your local machine. | Command:
```bash
kubectl cp kube-dns/ingress-controller-pod-8:~/.config/kube /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, us... |
Create an ingress named 'website-ingress' that routes requests from website.com/input to svc1:3306 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="website.com/input=svc1:3306,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... |
Output the modified 'frontend-deployment' deployment with DEBUG=true environment variable in YAML format, without altering the object on the server. | Command:
```bash
kubectl set env deployment/frontend-deployment DEBUG=true -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 (... |
Create a new NodePort service named 'analytics-nodeport' that maps port 8084 on all nodes to port 5000 on the pods | Command:
```bash
kubectl create service nodeport analytics-nodeport --tcp=8084:5000
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Create a copy of the "monitoring-pod" by adding a debug container and changing container images | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-api --image=debian --set-image=proxy=nginx:1.21,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified b... |
Copy the directory "/var/run/secrets/kubernetes.io/serviceaccount/" from a remote pod named "logging/cache-pod-5" to the local directory "/etc/kubernetes". | Command:
```bash
kubectl cp logging/cache-pod-5:/var/run/secrets/kubernetes.io/serviceaccount/ /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": "Conta... |
Create a service named "frontend" for the pod "security-service-pod" that serves on port 444 | Command:
```bash
kubectl expose pod security-service-pod --port=8082 --name=frontend
```
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 speci... |
Add a taint with the key 'dedicated' and value 'kube-master-9:PreferNoSchedule' on nodes that have the label 'app-type=microservice'. | Command:
```bash
kubectl taint node -l app-type=microservice 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": "",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.