prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Set a custom TLS server name for the "star-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster star-cluster --tls-server-name=prod-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... |
Create a copy of the "proxy-server-pod" with a debug container and change the container images | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=debug-image-app --image=debian --set-image=database=mysql:5.7,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource a... |
Rename the context 'cloud-context' to 'team-beta-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context cloud-context team-beta-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will a... |
Create a cron job to run the `wp` command every minute. | Command:
```bash
kubectl create cronjob metrics-collection --image=wordpress --schedule="*/1 * * * *" -- wp
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Import the secret_key key from the config map namespace-config into the environment variables of the database-deployment deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/namespace-config deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Update the annotation 'SLA' of pod 'database' to '99.9% uptime' | Command:
```bash
kubectl annotate pods database SLA='99.9% uptime'
```
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 ... |
Set up autoscaling for the deployment "gateway" with a minimum of 7 pods and a maximum of 10 pods | Command:
```bash
kubectl autoscale deployment gateway --min=7 --max=10
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Add a taint with the key 'cpu-type' on nodes having the label 'release=beta'. | Command:
```bash
kubectl taint node -l release=beta cpu-type=edge-node-10: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": "... |
Import the SECRET_KEY key from the app-settings config map and set it as an environment variable for the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --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... |
Import specific keys from a config map to environment variables in a deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/db-config deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in ... |
Retrieve snapshot logs from the analytics-pod, including all containers within the pod. | Command:
```bash
kubectl logs analytics-pod --all-containers=true
```
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 environment variables from the kube-system-config ConfigMap with the prefix "MYSQL_" to the gateway-deployment deployment. | Command:
```bash
kubectl set env --from=configmap/kube-system-config --prefix=MYSQL_ 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 definition... |
Update the 'cdn' pod and add the annotation 'compliance-level' with the value 'PCI-DSS' | Command:
```bash
kubectl annotate pods cdn 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 arbitrary... |
View logs from the pod "auth-service-pod" that were written in the last hour | Command:
```bash
kubectl logs --since=1h auth-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short"... |
Create a pod disruption budget with specific criteria | Command:
```bash
kubectl create poddisruptionbudget messaging-pdb --selector=tier=frontend --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 [-... |
Partially update the 'db-node-7' node by setting the 'unschedulable' field to true using a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node db-node-7 -p '{"spec":{"unschedulable":true}}'
```
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... |
Create a debug copy of the 'api-service-pod' changing all container images to 'golang' | Command:
```bash
kubectl debug api-service-pod --copy-to=my-custom-dbg --set-image=*=golang
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no re... |
List deployments in YAML output format, specifically in the "v1.1.1" version of the "backup-apps" API group. | Command:
```bash
kubectl get deployments.v1.1.1.backup-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you wil... |
Update the pod named 'analytics' by overwriting the 'env' annotation with the value 'staging'. | Command:
```bash
kubectl annotate --overwrite pods analytics env='staging'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ar... |
Import the 'secret_key' key from the 'log-config' config map into the 'monitoring-stack-deployment' deployment | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/log-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 definit... |
Set the service account of the deployment named "web-app-deployment" to "spinnaker" | Command:
```bash
kubectl set serviceaccount deployment web-app-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:
`kubectl ... |
Apply the last-applied configuration against each configuration file in the specified directory | Command:
```bash
kubectl apply set-last-applied -f options/
```
What it does:
Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run, without updating any other parts of the ... |
Check if you have permission to list the job named "certificates-renewal-job" in the kube-public namespace | Command:
```bash
kubectl auth can-i list jobs.batch/certificates-renewal-job -n kube-public
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a p... |
Delete the pods and services named "backend" and "chat-app" | Command:
```bash
kubectl delete pod,service backend 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... |
Switch to raw terminal mode and interact with 'bash' in the e-commerce-pod pod using the nano-bot container | Command:
```bash
kubectl exec e-commerce-pod -c nano-bot -i -t -- bash -il
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Expose a replication controller specified in a YAML file as a service, serving on port 9092 and forwarding traffic to port 808300. | Command:
```bash
kubectl expose -f php-controller.yaml --port=9092 --target-port=808300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the sp... |
Autoscale the deployment "web" with a minimum of 4 pods and a maximum of 11 pods. | Command:
```bash
kubectl autoscale deployment web --min=4 --max=11
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Set up autoscaling for the "vpn" deployment with a minimum of 4 pods and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment vpn --min=4 --max=13
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Forward a local port to a specified pod port. | Command:
```bash
kubectl port-forward pod/chat-app-pod :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 automatic... |
Retrieve logs from the container named media-stream-pod-1 of the cache-cluster-deployment deployment | Command:
```bash
kubectl logs deployment/cache-cluster-deployment -c media-stream-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:
... |
Forward traffic from port 5432 on all addresses to port 8080 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 5432:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Embed the certificate authority data for the sun-cluster cluster entry by running the command "kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/cloud-cluster/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/cloud-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... |
partially update a node using the strategic merge patch specified in the "kubeadm-config.yaml" file, with the new value for the "key" field | Command:
```bash
kubectl patch -f kubeadm-config.yaml -p '{"data":{"key":"new-value"}'
```
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]`
Hel... |
Create a pod disruption budget named ingress-controller-pdb that selects all pods with the release=1.0.0 label | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=release=1.0.0 --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-avail... |
Add a taint with key 'disktype' on nodes having label service=auth | Command:
```bash
kubectl taint node -l service=auth disktype=edge-node-10: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": "... |
Edit the job "report-generation-job" using the v1 API format in JSON | Command:
```bash
kubectl edit job.v1.batch/report-generation-job -o json
```
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 varia... |
Update the label of the pod 'auth' to 'tier:backend' | Command:
```bash
kubectl label pods auth tier=backend
```
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 ... |
Create an ingress called 'www-ingress' with a rule that directs requests to website.com/example to the 'svc1' service on port 8088, using the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress www-ingress --rule="website.com/example=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... |
Copy the local directory ~/.config/kube_dir to the remote pod file-server-pod-14 in the default namespace, and place it in the /tmp/bar_dir directory. | Command:
```bash
kubectl cp ~/.config/kube_dir file-server-pod-14::/tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Create a new config map named 'global-config' with the specified keys and file paths | Command:
```bash
kubectl create configmap global-config --from-file=properties=/path/to/options/file1.txt --from-file=key1=/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 creating ... |
Create a Pod Disruption Budget called "ingress-controller-pdb" that selects all pods with the "owner=team-1" label and ensures that at least four of them are available at any given time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=owner=team-1 --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-availa... |
Forward traffic from port 5432 on all addresses to port 3000 in the 'frontend-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 5432: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... |
Forward local port 8000 to targetPort of the "https" service port in a selected pod by the service named "backend-service" | Command:
```bash
kubectl port-forward service/backend-service 8000: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 select... |
Create a deployment named "scheduler" using the image "mcr.microsoft.com/dotnet/core/runtime" and expose port 9091. | Command:
```bash
kubectl create deployment scheduler --image=mcr.microsoft.com/dotnet/core/runtime --port=9091
```
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": "", ... |
Create an ingress that maps requests from foo.com/input to svc1:8000 with TLS enabled, using a secret called "my-cert". | Command:
```bash
kubectl create ingress default-ingress --rule="foo.com/input=svc1:8000,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"... |
Scale the resource defined in the "preferences.yaml" file to have 5 replicas. | Command:
```bash
kubectl scale --replicas=5 -f preferences.yaml
```
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 val... |
Set the environment variables "key1=val1" and "key2=val2" for the "service-account" entry in the exec auth plugin | Command:
```bash
kubectl config set-credentials service-account --exec-env=key1=val1 --exec-env=key2=val2
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfi... |
List deployments in JSON format for the "v1.0.0" version of the "prod-apps" API group. | Command:
```bash
kubectl get deployments.v1.0.0.prod-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will ... |
Listen on port 8888 locally and forward the traffic to port 5000 in the pod named 'web-app-pod' | Command:
```bash
kubectl port-forward pod/web-app-pod 8888: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 selected automa... |
Create an ingress resource called 'private-ingress' with a rule that directs requests from 'foo.com/input' to service 'svc1:6379' using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="foo.com/input=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"... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=log_level --from=configmap/ui-config deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Forward all traffic on port 8080 to port 3000 in the 'mypod' pod, and listen on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 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 pod will be sel... |
Copy the local file /tmp/foo_dir to the remote pod named load-balancer-pod-9, specifically to the directory /tmp/bar in the container named metrics-exporter. | Command:
```bash
kubectl cp /tmp/foo_dir load-balancer-pod-9:/tmp/bar -c metrics-exporter
```
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... |
Get the output from running the 'jenkins-plugin-cli' command in the quantum-quark container of the analytics-pod pod. | Command:
```bash
kubectl exec analytics-pod -c quantum-quark -- 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. If ... |
Create a deployment named sonarqube with 7 replicas using the php image. | Command:
```bash
kubectl create deployment sonarqube --image=php --replicas=7
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
Expose the replica set 'node' by creating a service that serves on port 8081 and connects to the containers on port 888800. | Command:
```bash
kubectl expose rs node --port=8081 --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. A... |
Create a deployment named 'nats' with the image 'node' and command 'node' | Command:
```bash
kubectl create deployment nats --image=node -- node
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml... |
Embed the certificate authority data for the cluster-beta cluster entry | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/app-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-... |
Start a nginx pod with the wordpress image, and customize the pod specification using a JSON file by providing override values. | Command:
```bash
kubectl run nginx --image=wordpress --overrides='{ "apiVersion": "legacy-1.0.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] -... |
Copy the local file `/tmp/foo_dir` to the remote pod named `load-balancer-pod-9`, and place it at `/tmp/bar` within the container named `logging-agent`. | Command:
```bash
kubectl cp /tmp/foo_dir load-balancer-pod-9:/tmp/bar -c logging-agent
```
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, u... |
update the environment variables of the 'backend-microservice-deployment' deployment, using the values from the 'EXTERNAL_API_URL' key in the 'namespace-config' config map. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/namespace-config 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 ... |
Forward all traffic from port 8888 on all addresses to port 5432 in the 'frontend-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-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 criteria, a pod will... |
Create a service for the replication controller specified in the "hazelcast-controller.yaml" file | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=7000 --target-port=909200
```
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 ... |
Embed the certificate authority data for the "cluster-beta" cluster entry. | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/e2e/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-cluster ... |
List the replication controller named 'web', the service named 'log-aggregator-rc', and the pod named 'email-service-pod' | Command:
```bash
kubectl get rc/web service/log-aggregator-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 n... |
Attach to the first pod of a replica set named mysql | Command:
```bash
kubectl attach rs/mysql
```
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.kubern... |
Attach to the vpn-service-pod and retrieve the output from the lunar-launcher container | Command:
```bash
kubectl attach vpn-service-pod -c lunar-launcher
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Retrieve the password for the user named "my-k8s-cluster" in the kubeconfig file. | Command:
```bash
kubectl config view -o jsonpath='{.users[?(@.name == "my-k8s-cluster")].user.password}'
```
What it does:
Display merged kubeconfig settings or a specified kubeconfig file.
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.
Syntax:
`kubectl config view`
Helpf... |
Forward traffic from port 8080 on all addresses to port 6379 on the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8080: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 sel... |
Return the snapshot of the previous terminated "stardust-shuttle" container logs from the "security-service-pod". | Command:
```bash
kubectl logs -p -c stardust-shuttle 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": "--con... |
Remove all taints with the key 'datacenter' from the 'gpu-node-12' node | Command:
```bash
kubectl taint nodes gpu-node-12 datacenter-
```
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... |
Set the cluster for a specific context to a given value. | Command:
```bash
kubectl config set contexts.user-a-context.cluster web-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 wa... |
Add a taint to the 'gpu-node-12' node with key 'zone' and no value | Command:
```bash
kubectl taint nodes gpu-node-12 zone: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... |
Execute the 'mysqld' command in the 'rocket-ranger' container of the 'database-pod' pod and retrieve the output. | Command:
```bash
kubectl exec database-pod -c rocket-ranger -- mysqld
```
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 ... |
Embed the certificate authority data for the 'data-cluster' cluster entry using the command 'kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/dev-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/dev-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-... |
Add a taint with the key 'dedicated' on nodes labeled with "cluster=my-cluster" | Command:
```bash
kubectl taint node -l cluster=my-cluster dedicated=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": "", "usa... |
Create a new ExternalName service named my-ns with the external name education-edu.edu | Command:
```bash
kubectl create service externalname my-ns --external-name education-edu.edu
```
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 exist o... |
Forward local port 8888 to port 8080 in the security-service-pod pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8888 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Start streaming the logs of the "code-explorer" container in the "proxy-server-pod" pod. | Command:
```bash
kubectl logs -f -c code-explorer 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": "--container"... |
Import environment from the config map "app-config-dev" with a prefix "MYSQL_" into the "payment-processor-deployment" deployment | Command:
```bash
kubectl set env --from=configmap/app-config-dev --prefix=MYSQL_ deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
View the details of the 5th revision of the 'my-deployment' daemonset | Command:
```bash
kubectl rollout history daemonset/my-deployment --revision=5
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or ... |
Create a cluster role named "bar" with API Group specified | Command:
```bash
kubectl create clusterrole bar --verb=list,create,connect --resource=cronjobs.batch
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output"... |
Create a job named batch-processing using the mysql image, and run the command "mysqld" within the job. | Command:
```bash
kubectl create job batch-processing --image=mysql -- mysqld
```
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. O... |
Create a new secret named ssl-key-secret with keys for each file in the folder path/to/properties | Command:
```bash
kubectl create secret generic ssl-key-secret --from-file=path/to/properties
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of... |
replace the pod with the data in the options.yaml file | Command:
```bash
kubectl replace -f ./options.yaml
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replace -f FILENAM... |
Create a deployment named "cache" using the "ethereum/client-go" image and expose port 8443. | Command:
```bash
kubectl create deployment cache --image=ethereum/client-go --port=8443
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format... |
Forward local traffic on ports 8080 and 6000 to the pod's ports 8081 and 6000 respectively. The pod name is "web-app-pod". | Command:
```bash
kubectl port-forward pod/web-app-pod 8080 8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Forward data between port 8081 on your local machine and port 9090 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward pod/security-service-pod 8081 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 select... |
Forward port 8080 to port 5000 in the e-commerce pod, and listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8080: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 wi... |
Deny a Certificate Signing Request (CSR) with the name 'csr-sqgzp' | Command:
```bash
kubectl certificate deny csr-sqgzp
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kubectl cer... |
Listen on ports 8000 and 6000 locally, forwarding data to/from ports 8000 and 6000 in a pod selected by the api-server-deployment deployment. | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8000 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 b... |
Create a service for a replication controller, specified in a YAML file, which serves on port 8000 and connects to the containers on port 300100. | Command:
```bash
kubectl expose -f centos-controller.yaml --port=8000 --target-port=300100
```
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... |
Remove the taint on node 'edge-node-10' with the key 'dedicated' and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes edge-node-10 dedicated: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 o... |
Execute the 'postgres' command in the 'mycontainer' container of the 'vpn-service-pod' pod and display the output | Command:
```bash
kubectl exec vpn-service-pod -c mycontainer -- postgres
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Execute the 'redis-cli' command in the 'e-commerce-pod' pod and retrieve the output. | Command:
```bash
kubectl exec e-commerce-pod -- 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 omitted, use the kubectl.... |
Start an alpine pod with customized specs using JSON override | Command:
```bash
kubectl run nginx --image=alpine --overrides='{ "apiVersion": "v3.0.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 'special' and the value 'testing-node-11:PreferNoSchedule' on nodes that have the label 'zone=us-east-1'. | Command:
```bash
kubectl taint node -l zone=us-east-1 special=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": "", "usage... |
Forward traffic from port 5432 on all addresses to port 3000 in the backend-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 5432: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 ... |
Attach to the "time-machine" container in the "api-service-pod" pod to get the output. | Command:
```bash
kubectl attach api-service-pod -c time-machine
```
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,... |
Remove all the taints with the key 'app' from node 'node-2' | Command:
```bash
kubectl taint nodes node-2 app-
```
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|go-te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.