prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Scale the deployment named prod-app-rs to 3 replicas, assuming its current size is 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=3 deployment/prod-app-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... |
Update the pod named 'payment' by removing the label 'env' | Command:
```bash
kubectl label pods payment env-
```
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 true,... |
Forward local port 8088 to port 8088 in the 'chat-app-pod' pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 8088:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Edit the configuration of the service using the nvim editor. | Command:
```bash
KUBE_EDITOR="nvim" kubectl edit svc/proxy-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, ... |
Create a new ClusterIP service named ldap-service-clusterip that forwards traffic from port 8082 to port 8081. | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=8082:8081
```
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", "... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/env-vars 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 definition... |
Return snapshot logs from container payment-processor-deployment-1 of a deployment named email-service-pod | Command:
```bash
kubectl logs deployment/payment-processor-deployment -c email-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 fl... |
Forward local ports 5432 and 6000 to ports 8888 and 6000 respectively in the pod named 'e-commerce-pod' | Command:
```bash
kubectl port-forward pod/e-commerce-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 aut... |
Update the pod named 'payment' with the label 'app' and the value 'myapp' | Command:
```bash
kubectl label pods payment app=myapp
```
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 ... |
Remove the label 'release' from the pod 'log-aggregator' if it exists | Command:
```bash
kubectl label pods log-aggregator release-
```
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 pod disruption budget named "worker-pdb" that selects all pods with the label "version=v2" and ensures that at least one of them is available at any given time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=version=v2 --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-r... |
Create a copy of the "monitoring-pod" pod with a debug container and updated container images. | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-web --image=debian --set-image=database=mysql:5.7,api=api:v2
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and na... |
Forward traffic from port 6379 on all addresses to port 5000 in the frontend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-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... |
Update the 'search-engine-deployment' deployment by adding a new environment variable 'GOOGLE_API_KEY' with the value 'your-google-api-key' | Command:
```bash
kubectl set env deployment/search-engine-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... |
Update the CPU and memory limits for the container named "nginx" in the deployment named "node" to 10 CPU units and 256MB memory respectively. | Command:
```bash
kubectl set resources deployment node -c=nginx --limits=cpu=10,memory=256Mi
```
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... |
Set the environment variables for a deployment using a secret | Command:
```bash
kubectl set env --from=secret/api-key-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 te... |
Listen on port 9090 on localhost and IP address 10.19.21.23, and forward the traffic to port 8000 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 9090: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 criteri... |
Embed the certificate authority data for the galaxy-cluster cluster entry. | Command:
```bash
kubectl config set-cluster galaxy-cluster --embed-certs --certificate-authority=~/.kube/staging-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 confi... |
Taint the nodes with the label 'cluster=my-cluster' with a taint key 'dedicated' and value 'kube-master-9' and set it to 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l cluster=my-cluster 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": "", "u... |
Create a job with a specific command | Command:
```bash
kubectl create job audit-job --image=python -- python --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 forma... |
Import the MAX_CONNECTIONS key from the config map 'env-vars' and set it as an environment variable in the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/env-vars deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Set the custom TLS server name as "cluster-alpha" for the cluster entry "cluster-alpha" | Command:
```bash
kubectl config set-cluster cluster-alpha --tls-server-name=cluster-alpha
```
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] [--certifica... |
Add a taint with key 'special' and value 'k8s-node-1:PreferNoSchedule' on nodes having the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app special=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": "Outp... |
Copy the local file /tmp/foo_dir to the remote pod metrics-exporter-pod-10 in the velero namespace, and place it at the path /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo_dir velero/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 th... |
Create a copy of the 'monitoring-pod' pod, adding a debug container and changing the container images | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-web --image=debian --set-image=logger=logging-app:debug,api=api:v2
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource ... |
Create a single ingress called 'public-ingress' that directs requests to foo.com/input to svc1:3001 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="foo.com/input=svc1:3001,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 output from running the 'jenkins-plugin-cli' command in the 'cyber-sleuth' container from the 'proxy-service-pod' pod. | Command:
```bash
kubectl exec proxy-service-pod -c cyber-sleuth -- jenkins-plugin-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. ... |
Forward local port 8088 to port 5000 in the pod/security-service-pod pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8088: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... |
Create a new config map named 'namespace-config' with the keys 'settings' and 'key2' using the specified files '/path/to/profiles/file1.txt' and '/path/to/options/file2.txt' respectively. | Command:
```bash
kubectl create configmap namespace-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/options/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creatin... |
create a cron job called alerts-cleanup with the image 'ubuntu', scheduled to run every minute | Command:
```bash
kubectl create cronjob alerts-cleanup --image=ubuntu --schedule="*/1 * * * *" -- docker run ubuntu echo "Hello
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--ou... |
Copy the ~/.config/kube file from a remote pod named web-app-pod-1 in the default namespace to /etc/kubernetes on your local machine. | Command:
```bash
kubectl cp default/web-app-pod-1:~/.config/kube /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Delete the data-cluster cluster configuration from the kubeconfig file | Command:
```bash
kubectl config delete-cluster data-cluster
```
What it does:
Delete the specified cluster from the kubeconfig.
Syntax:
`kubectl config delete-cluster NAME` |
Approve the Certificate Signing Request (CSR) with the name 'csr-mysql-10' | Command:
```bash
kubectl certificate approve csr-mysql-10
```
What it does:
Approve a certificate signing request.
kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the attri... |
Embed the certificate authority data for the 'cluster-beta' cluster entry using the command 'kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/prod-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/prod-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 set... |
Get the output of the command 'dotnet --list-runtimes' from the first container of the first pod of the 'analytics-service' service | Command:
```bash
kubectl exec svc/analytics-service -- dotnet --list-runtimes
```
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 job called report-generation-job with the image ethereum/client-go and the command "geth". | Command:
```bash
kubectl create job report-generation-job --image=ethereum/client-go -- geth
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Create a NodePort service named payment-gateway-nodeport using port mapping 8080:9091 | Command:
```bash
kubectl create service nodeport payment-gateway-nodeport --tcp=8080:9091
```
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", "defau... |
Create a new config map named app-config using specified files | Command:
```bash
kubectl create configmap app-config --from-file=conf=/path/to/properties/file1.txt --from-file=data=/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 creating a ... |
Forward local port 8000 to port 5432 in the pod "mypod" | Command:
```bash
kubectl port-forward pod/mypod 8000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Copy the file from /var/run/secrets/kubernetes.io/serviceaccount/ to /tmp/bar inside the pod "web-app-pod-1" in the "kubeapps" namespace | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kubeapps/web-app-pod-1:/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... |
Import the `API_KEY` key from the `app-name-config` ConfigMap and set it as an environment variable in the `user-management-deployment` deployment. | Command:
```bash
kubectl set env --keys=API_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 defini... |
Import environment variables from a config map with a specific prefix | Command:
```bash
kubectl set env --from=configmap/app-settings --prefix=MYSQL_ 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... |
Update the image of all containers in the daemonset named 'test' to 'nginx:1.21.3' | Command:
```bash
kubectl set image daemonset test *=nginx:1.21.3
```
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... |
Copy the file /tmp/foo from your local machine to the directory /tmp/bar_dir in the remote pod named kube-system/security-scanner-pod-18 in the namespace | Command:
```bash
kubectl cp /tmp/foo kube-system/security-scanner-pod-18:/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... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/kube-system-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 variable d... |
Scale the deployment named "foo" to a desired size of 3, considering its current size is 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=3 deployment/foo
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
Create an ingress resource named 'private-ingress' that will route requests for 'site.com/module' to the service 'svc1' on port 8443 | Command:
```bash
kubectl create ingress private-ingress --rule="site.com/module=svc1:8443,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... |
Execute the 'ash' command in the astro-container of the pod named mypod and retrieve the output. | Command:
```bash
kubectl exec mypod -c astro-container -- ash
```
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... |
Forward local port 8888 to port 9090 in the pod named 'chat-app-pod' | Command:
```bash
kubectl port-forward pod/chat-app-pod 8888:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Add a taint on nodes labeled with version=v1.0.0 with the key 'cpu-type' and value 'db-node-7:PreferNoSchedule' | Command:
```bash
kubectl taint node -l version=v1.0.0 cpu-type=db-node-7: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": "O... |
Create an ingress resource named annotated with the rule "site.com/bar=svc:port" in the default class, and add the annotations ingress.annotation1=foo and ingress.annotation2=bla. | Command:
```bash
kubectl create ingress annotated --class=default --rule="site.com/bar=svc:port" \
--annotation ingress.annotation1=foo \
--annotation ingress.annotation2=bla
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`... |
Change the replica size of the deployment named db-migration-replicaset to 5, as its current size is 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=5 deployment/db-migration-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --reso... |
Update the image of a container in a pod by patching the pod's spec with the new container image. | Command:
```bash
kubectl patch pod analytics-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"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 (-f FILENA... |
Approve the Certificate Signing Request (CSR) with the name 'csr-proxy-15'. | Command:
```bash
kubectl certificate approve csr-proxy-15
```
What it does:
Approve a certificate signing request.
kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the attri... |
Copy the directory "/tmp/foo_dir" from the remote pod "logging/front-end-pod-12" to the local directory "/etc/kubernetes". | Command:
```bash
kubectl cp logging/front-end-pod-12:/tmp/foo_dir /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use th... |
Create a debug copy of a pod by adding a debug container and changing container images | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-api --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 resour... |
create a service for a Hazelcast replication controller, exposing it on port 80 and forwarding traffic to the containers on port 8000 | Command:
```bash
kubectl expose rc hazelcast --port=80 --target-port=844300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port... |
Forward local port 8888 to port 8888 in the pod named web-app-pod | Command:
```bash
kubectl port-forward pod/web-app-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 automa... |
Copy the file ~/.config/kube to the /tmp/bar_dir directory in the payment-gateway-pod-19 pod, specifically in the web-app-container container. | Command:
```bash
kubectl cp ~/.config/kube payment-gateway-pod-19:/tmp/bar_dir -c web-app-container
```
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. ... |
Partially update the node identified by the type and name specified in "node.json" using strategic merge patch | Command:
```bash
kubectl patch -f kubelet-config.yaml -p '{"spec":{"containers":[{"name":"container-name", "resources":{"limits":{"cpu":"200m"}}}]}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patc... |
Forward local port 8000 to port 8088 in the pod named "frontend-pod" | Command:
```bash
kubectl port-forward pod/frontend-pod 8000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create a cluster role named "bar" with ResourceName specified | Command:
```bash
kubectl create clusterrole bar --verb=use --resource=services --resource-name=content-delivery --resource-name=content-delivery
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|clie... |
list the resources defined in the kustomization.yaml file located in the 'setup' directory | Command:
```bash
kubectl get -k setup/
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in your cu... |
Set the custom TLS server name to "galaxy-cluster" for the "on-prem-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=galaxy-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] [--certif... |
Create a new secret named password-secret with key1=supersecret and key2=topsecret. | Command:
```bash
kubectl create secret generic password-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
```
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... |
Create an ingress called 'public-ingress' that directs requests from testing.com/example to svc1:27017 with a tls secret called "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="testing.com/example=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": "", "... |
Add a taint with key 'cpu-type' on nodes that have the label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 cpu-type=monitoring-node-15:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Import the environment variables from the "gcp-service-account-secret" secret and set them for the "database-deployment" deployment | Command:
```bash
kubectl set env --from=secret/gcp-service-account-secret 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 one o... |
View the previous logs of the "lunar-launcher" container in the "api-service-pod" pod. | Command:
```bash
kubectl logs -p -c lunar-launcher api-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"... |
Import the "my-example-key" key from the "monitoring-config" config map into the "order-processing-deployment" deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/monitoring-config deployment/order-processing-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... |
Create a new service account named dashboard | Command:
```bash
kubectl create serviceaccount dashboard
```
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|name|go-... |
Start a new nginx pod using the mysql image, but customize the pod specification by providing overrides in JSON format. | Command:
```bash
kubectl run nginx --image=mysql --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] -- [COMMAND... |
Update the pod named 'security' with the annotation 'backup-strategy' and set its value to 'daily backups'. | Command:
```bash
kubectl annotate pods security backup-strategy='daily backups'
```
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 inclu... |
Create an ingress called 'rontend-ingress' that directs requests to "testing.com/module" to "svc1:5432" with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress rontend-ingress --rule="testing.com/module=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": "", "u... |
Delete the pods and services named "payment" and "payment" | Command:
```bash
kubectl delete pod,service payment payment
```
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.... |
Partially update the worker-node-3 node by applying a strategic merge patch from the provided YAML | Command:
```bash
kubectl patch node worker-node-3 -p $'stringData:\n password: new-password'
```
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]... |
Update the 'proxy' pod with the annotation 'contact-email' and the value 'support@example.com', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods proxy contact-email='support@example.com'
```
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 lab... |
Start a pod using the image "confluentinc/cp-kafka" and expose port 9091 within the container. | Command:
```bash
kubectl run hazelcast --image=confluentinc/cp-kafka --port=9091
```
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 flag... |
Create a service for a Ruby deployment, serving on port 9090 and connecting to the containers on port 801000 | Command:
```bash
kubectl expose deployment ruby --port=9090 --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 specified... |
Listen on port 8088 locally, forwarding to port 8000 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8088:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Create a service for a replication controller specified in "ubuntu-controller.yaml", which serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=80 --target-port=808100
```
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 s... |
Expose a service for a replication controller specified in a YAML file, with port and target port specified | Command:
```bash
kubectl expose -f php-controller.yaml --port=8443 --target-port=808100
```
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 sp... |
Create a service for the replication controller specified in the "ruby-controller.yaml" file | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8084 --target-port=844300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Apply a taint on nodes with the label environment=production, using the key 'disktype' and value 'node-2:PreferNoSchedule'. | Command:
```bash
kubectl taint node -l environment=production disktype=node-2: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... |
Delete pods and services with the names "web" and "media-stream" | Command:
```bash
kubectl delete pod,service web media-stream
```
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... |
Create a new ExternalName service named 'external-messaging-service' with the external name 'tutorial-ai.ai' | Command:
```bash
kubectl create service externalname external-messaging-service --external-name tutorial-ai.ai
```
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... |
Update the pod 'media-stream' by adding or updating the annotation 'deployment-script' with the value 'https://example.com/deploy.sh' | Command:
```bash
kubectl annotate --overwrite pods media-stream 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 c... |
Remove all the taints with the key 'environment' from node 'web-node-8'. | Command:
```bash
kubectl taint nodes web-node-8 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|yam... |
Update the deployment 'email-server-deployment' by adding a new environment variable 'ENV' with the value 'prod' | Command:
```bash
kubectl set env deployment/email-server-deployment ENV=prod
```
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 (within... |
Create a service for a replicated python application, serving on port 9091 and connecting to the containers on port 8080 | Command:
```bash
kubectl expose rc python --port=9091 --target-port=808000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Create an ingress called 'app1-ingress' that directs requests to a specific service and URL path, with TLS encryption | Command:
```bash
kubectl create ingress app1-ingress --rule="website.com/bar=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": "", "usage":... |
Execute the 'go run hello.go' command in the 'stardust-shuttle' container of the 'cdn-service-pod' pod and get the output. | Command:
```bash
kubectl exec cdn-service-pod -c stardust-shuttle -- go run hello.go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
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/settings/file1.txt --from-file=key2=/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 ... |
Create a copy of the 'security-service-pod' pod and launch a debug session | Command:
```bash
kubectl debug security-service-pod -it --copy-to=my-debugger --image=debian --set-image=logger=logging-app:debug,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 id... |
Execute the command 'apk add curl' within the stardust-shuttle container of the log-aggregator-pod pod | Command:
```bash
kubectl exec log-aggregator-pod -c stardust-shuttle -- apk add curl
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
Create a job named 'monitoring-job' using the 'mongo' image, and run the command 'mongo --version' inside the job container. | Command:
```bash
kubectl create job monitoring-job --image=mongo -- mongo --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 fo... |
Import the environment variables from the 'git-credentials-secret' secret into the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/git-credentials-secret deployment/frontend-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 mo... |
Forward traffic from port 8081 on all addresses to port 5000 in the 'frontend-pod' pod. Listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8081: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... |
Copy the local file "/tmp/foo" to the remote pod "security-scanner-pod-18" in the "kube-proxy" namespace, and save it as "/tmp/bar". | Command:
```bash
kubectl cp :/tmp/foo kube-proxy/security-scanner-pod-18::/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 service for the replicated alpine using the replica set | Command:
```bash
kubectl expose rs alpine --port=8084 --target-port=888800
```
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.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.