prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Add a taint with the key 'datacenter' and the value 'backup-node-14:PreferNoSchedule' on nodes that have the label 'component=proxy' | Command:
```bash
kubectl taint node -l component=proxy datacenter=backup-node-14: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": "", "us... |
Copy the local file '/tmp/foo_dir' to the remote pod 'web-app-pod-1' in the 'openfaas' namespace, and place it in the '/tmp/bar' directory. | Command:
```bash
kubectl cp /tmp/foo_dir openfaas/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 name. If omitted, use the kubect... |
Return the snapshot logs from the container "analytics-pod-1" of the deployment named "email-server-deployment". | Command:
```bash
kubectl logs deployment/email-server-deployment -c analytics-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:
"fla... |
Remove the taint with key 'special' and effect 'NoSchedule' from node 'kube-master-9' if it exists. | Command:
```bash
kubectl taint nodes kube-master-9 special:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Create a service for a replicated alpine container, serving on port 8181 and connecting to the containers on port 500000 | Command:
```bash
kubectl expose rc alpine --port=8181 --target-port=500000
```
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 a new config map named monitoring-config with key-value pairs from the specified parameter files | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Create a pod disruption budget named load-balancer-pdb that selects all pods with the component=web label and requires a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=component=web --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=... |
Forward traffic from port 8000 on all addresses to port 8000 in the pod named mypod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 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 be sel... |
Create a deployment named "drupal" using the "hazelcast/hazelcast" image and expose port 5432. | Command:
```bash
kubectl create deployment drupal --image=hazelcast/hazelcast --port=5432
```
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 form... |
Embed the certificate authority data for the star-cluster cluster entry by running the command: kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/my-k8s-cluster/kubernetes.ca.crt | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/my-k8s-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 s... |
Retrieve the list of deployments in the "rc-1.1.0" version of the "custom-deployments" API group, displaying the output in JSON format. | Command:
```bash
kubectl get deployments.rc-1.1.0.custom-deployments -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... |
Create a new secret named 'my-secret' using the environment variables specified in the 'preferences.env' file | Command:
```bash
kubectl create secret generic my-secret --from-env-file=path/to/preferences.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basenam... |
Add a taint with the key 'zone' and the value 'db-node-7:PreferNoSchedule' on nodes that have the label 'release=beta' | Command:
```bash
kubectl taint node -l release=beta zone=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": "Output ... |
Create a copy of the monitoring-pod and launch an interactive shell in the debug-image-1 container with the mycontainer command | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-1 --container=mycontainer -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by defa... |
Import the 'smtp_server' key from the 'monitoring-config' ConfigMap and set it as an environment variable for the 'cache-cluster-deployment' deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/monitoring-config deployment/cache-cluster-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 de... |
Forward local port 8088 to port 3000 in the pod "web-app-pod" | Command:
```bash
kubectl port-forward pod/web-app-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 automa... |
Create a copy of the 'cdn-service-pod' and change all container images to 'node', name it 'my-custom-dbg' | Command:
```bash
kubectl debug cdn-service-pod --copy-to=my-custom-dbg --set-image=*=node
```
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 reso... |
Execute the 'ruby --version' command in the lunar-launcher container of the analytics-pod pod and display the output. | Command:
```bash
kubectl exec analytics-pod -c lunar-launcher -- ruby --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 omi... |
set resource limits for a specific container in a deployment | Command:
```bash
kubectl set resources deployment alpine -c=nginx --limits=cpu=5,memory=64Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to it... |
Forward the local ports 8888 and 6000 to the ports 8081 and 6000 respectively in a pod selected by the 'search-engine-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 8888 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 wil... |
Add a taint with key 'environment' and value 'backup-node-14:PreferNoSchedule' on nodes having the label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster environment=backup-node-14: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": "",... |
Set the cluster field in the context to the specified cluster | Command:
```bash
kubectl config set contexts.admin-context.cluster dev-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 wan... |
Set a custom TLS server name for the "sun-cluster" cluster entry | Command:
```bash
kubectl config set-cluster sun-cluster --tls-server-name=staging-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] [--certifica... |
Add a taint with the key 'special' on nodes that have the label 'stack=tech-stack'. | Command:
```bash
kubectl taint node -l stack=tech-stack special=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Start a mysql pod with custom configurations using JSON overrides | Command:
```bash
kubectl run nginx --image=mysql --overrides='{ "apiVersion": "hotfix-1.1.2", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [C... |
Create a new config map named "ui-config" using the specified files as key-value pairs | Command:
```bash
kubectl create configmap ui-config --from-file=settings=/path/to/preferences/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 creating a... |
Create a new config map named global-config with specified keys from files on disk | Command:
```bash
kubectl create configmap global-config --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/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 crea... |
Add the annotation 'criticality' with the value 'high' to the 'vpn' pod | Command:
```bash
kubectl annotate pods vpn criticality=high
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string ... |
Return snapshot logs from container proxy-service-pod-1 of the deployment notification-handler-deployment. | Command:
```bash
kubectl logs deployment/notification-handler-deployment -c proxy-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... |
Create a new secret named payment-gateway-secret and include keys for each file in the folder "path/to/profiles" | Command:
```bash
kubectl create secret generic payment-gateway-secret --from-file=path/to/profiles
```
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 basen... |
Forward local port 3000 to port 3000 in the frontend-pod | Command:
```bash
kubectl port-forward pod/frontend-pod 3000 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 autom... |
Import environment variables into a deployment using a config map with a prefixed name | Command:
```bash
kubectl set env --from=configmap/kube-system-config --prefix=MYSQL_ 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 d... |
Set the CPU limit to "50m" and memory limit to "128Mi" for the runtime container in the deployment named "runtime" containing the nginx container. | Command:
```bash
kubectl set resources deployment runtime -c=nginx --limits=cpu=50m,memory=128Mi
```
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 t... |
Create a debug container in the proxy-service-pod, copy it to my-debugger, and change container images. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=my-debugger --image=debian --set-image=mailer=mailer:latest,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 n... |
Update the specified node by applying the provided patch in YAML format. | Command:
```bash
kubectl patch node prod-node-5 -p $'spec:\n containers:\n- name: container-name\n resources:\n limits:\n 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 patch (-f F... |
List the environment variables of the 'analytics-platform-deployment' | Command:
```bash
kubectl set env deployment/analytics-platform-deployment --list
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (wi... |
List deployments in JSON output format from the "legacy-1.0.0" version of the "legacy-apps" API group. | Command:
```bash
kubectl get deployments.legacy-1.0.0.legacy-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 y... |
Return the logs from the container backend-microservice-deployment-1 of a deployment named database-pod | Command:
```bash
kubectl logs deployment/backend-microservice-deployment -c database-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 flag... |
Create a pod disruption budget named payment-gateway-pdb that will select all pods with the owner=team-1 label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-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-available... |
Create a deployment named "web" using the "postgres" image and expose port 8088. | Command:
```bash
kubectl create deployment web --image=postgres --port=8088
```
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: js... |
forward local port 8080 and IP address localhost,10.19.21.23 to port 8080 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8080: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 ... |
Execute the "java -jar /usr/share/jenkins/jenkins.war" command inside the analytics-pod and retrieve the output from the first container | Command:
```bash
kubectl exec analytics-pod -- java -jar /usr/share/jenkins/jenkins.war
```
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... |
Import the "external_api_url" key from the "app-name-config" ConfigMap and set it as an environment variable for the "notification-handler-deployment" deployment. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-name-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 v... |
Add a taint with the key 'special' to nodes with the label 'component=proxy' | Command:
```bash
kubectl taint node -l component=proxy 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": "", "usag... |
Forward traffic from a local port to a port on a specific pod | Command:
```bash
kubectl port-forward pod/web-app-pod :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 automatica... |
Create a copy of the auth-service-pod named my-custom-dbg with a debug container and change the container images to debian for the debug container and nginx:1.21 for the proxy container and nginx:latest for the web container. | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource an... |
Add a taint with the key 'disktype' and value 'worker-node-3:PreferNoSchedule' on nodes having the label app=web-app. | Command:
```bash
kubectl taint node -l app=web-app disktype=worker-node-3: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": "... |
Embed the certificate authority data for the edge-cluster cluster entry | Command:
```bash
kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/galaxy-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 s... |
Import specific keys from a config map into a deployment as environment variables. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/env-vars deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Set the cluster field in the my-context context to testing-cluster | Command:
```bash
kubectl config set contexts.local-context.cluster testing-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you... |
Update the annotation 'monitoring-tool' of pod 'foo' with the value 'Prometheus', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods foo monitoring-tool='Prometheus'
```
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 i... |
Import environment variables from a secret | Command:
```bash
kubectl set env --from=secret/ldap-credentials-secret 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 definitions in on... |
Update the subject of a cluster role binding for kube-proxy to the specified service account. | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:kube-proxy
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=nam... |
Import the "max_connections" key from the "app-name-config" config map and set it as an environment variable in the "monitoring-stack-deployment" deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-name-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 variab... |
Create a new secret named cert-manager-secret with keys for each file in folder bar | Command:
```bash
kubectl create secret generic cert-manager-secret --from-file=path/to/settings
```
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... |
Update the pod 'analytics' with the annotation 'alert-email' and set the value to 'alerts@example.com' | Command:
```bash
kubectl annotate --overwrite pods analytics alert-email='alerts@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 la... |
Import the SECRET_KEY key from the app-config-prod config map into the environment variables of the proxy-service-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-config-prod deployment/proxy-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Approve a Certificate Signing Request (CSR) with the name 'csr-postgres-12' | Command:
```bash
kubectl certificate approve csr-postgres-12
```
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 at... |
Forward incoming traffic from port 5000 on all addresses to port 9090 in the mypod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 5000: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 sel... |
Update the label of the pod 'email' with the key 'env' and the value 'development' | Command:
```bash
kubectl label pods email env=development
```
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": ... |
Forward the local port 8080 to port 3000 in the pod named 'web-app-pod' | Command:
```bash
kubectl port-forward pod/web-app-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 pod will be selected automa... |
Set the cluster field in the my-context context to app-cluster using the command kubectl config set contexts.cluster-1-context.cluster app-cluster | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster app-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... |
Add a taint with the key 'zone' on nodes that have the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace zone=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Start a ruby pod with custom specifications by providing a JSON file with the overridden values | Command:
```bash
kubectl run nginx --image=ruby --overrides='{ "apiVersion": "alpha-2.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] -- [COMMA... |
Apply the last-applied configuration to each file in the setup directory. | Command:
```bash
kubectl apply set-last-applied -f setup/
```
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 ob... |
Import the SMTP_SERVER key from the api-config config map into the environment variables of the order-processing-deployment deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/api-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 variable defini... |
Add a taint with the key 'dedicated' on nodes having the label 'project=project-alpha'. | Command:
```bash
kubectl taint node -l project=project-alpha dedicated=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Create a new config map named monitoring-config with the specified keys | Command:
```bash
kubectl create configmap monitoring-config --from-file=properties=/path/to/properties/file1.txt --from-file=key1=/path/to/properties/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When... |
Create a cluster role named "default_role" with the verbs "use", "proxy", and "delete" for the specified subresources "persistentvolumeclaims" and "persistentvolumeclaims/status". | Command:
```bash
kubectl create clusterrole default_role --verb=use,proxy,delete --resource=persistentvolumeclaims,persistentvolumeclaims/status
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|clie... |
Set custom TLS server name for galaxy-cluster | Command:
```bash
kubectl config set-cluster galaxy-cluster --tls-server-name=cluster-gamma
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certific... |
Copy the local file /tmp/foo to the remote pod load-balancer-pod-9 in the container named message-broker, and place it at /etc/kubernetes in the pod | Command:
```bash
kubectl cp /tmp/foo load-balancer-pod-9:/etc/kubernetes -c message-broker
```
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 omitte... |
Execute the command "yum install -y wget" inside the first pod of the deployment "monitoring-stack-deployment" using the first container | Command:
```bash
kubectl exec deploy/monitoring-stack-deployment -- yum install -y wget
```
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... |
List deployments in YAML output format, specifically in the "legacy-1.0.0" version of the "experimental-apps" API group. | Command:
```bash
kubectl get deployments.legacy-1.0.0.experimental-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 namesp... |
Copy the local directory "/tmp/foo_dir" to the remote pod "worker-pod-4" in the "/etc/kubernetes_dir" directory. | Command:
```bash
kubectl cp :/tmp/foo_dir worker-pod-4:/etc/kubernetes_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 kubec... |
Wait for the backend-pod to be deleted, with a timeout of 60s, after running the command "kubectl delete pod/backend-pod" | Command:
```bash
kubectl delete pod/backend-pod
kubectl wait --for=delete pod/busybox1 --timeout=60s
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.
... |
Add a taint with the key 'app' on nodes that have the label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 app=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output fo... |
Create a service for a replicated Ubuntu using a replica set, which serves on port 5001 and connects to the containers on port 300000. | Command:
```bash
kubectl expose rs ubuntu --port=5001 --target-port=300000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Create a job called "data-migration-job" with the image "golang" and run the command "go" | Command:
```bash
kubectl create job data-migration-job --image=golang -- go
```
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. On... |
Copy the local file `/tmp/foo_dir` to the remote pod `backend-pod-13` in the container `security-scanner`, and place it in `/tmp/bar` | Command:
```bash
kubectl cp /tmp/foo_dir backend-pod-13:/tmp/bar -c security-scanner
```
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 role named "foo" with ResourceName specified. | Command:
```bash
kubectl create role foo --verb=list --resource=pods --resource-name=file-uploader --resource-name=api-server
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|no... |
Copy the file '/tmp/foo' from the 'message-broker-pod-15' pod in the 'kube-system' namespace to the local directory '/tmp/bar_dir' | Command:
```bash
kubectl cp kube-system/message-broker-pod-15::/tmp/foo /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Start streaming the logs of the "cosmic-container" container in the "log-aggregator-pod" pod. | Command:
```bash
kubectl logs -f -c cosmic-container log-aggregator-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": "--conta... |
Create a new secret named ssh-key-secret in the default namespace, using the contents of all the files in the folder "path/to/configurations" | Command:
```bash
kubectl create secret generic ssh-key-secret --from-file=path/to/configurations
```
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 basenam... |
Taint nodes with label 'app-type=microservice' using the key 'hardware' and value 'app-node-6' with the effect 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l app-type=microservice hardware=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Embed the certificate authority data for the 'dev-cluster' cluster entry using the command 'kubectl config set-cluster dev-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster dev-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/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... |
Create an ingress called 'api-v2-ingress' with a rule that directs requests for 'foo.com/example' to 'svc1:7000' and uses the 'my-cert' TLS secret. | Command:
```bash
kubectl create ingress api-v2-ingress --rule="foo.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": "", "usage... |
Create an ingress called 'default-ingress' to route requests from foo.com/input to svc1:5001 using a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="foo.com/input=svc1:5001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
List the replication controller named 'web', the service named 'cdn-service-rc', and the pod named 'backend-pod' | Command:
```bash
kubectl get rc/web service/cdn-service-rc pods/backend-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... |
Set the custom TLS server name "moon-cluster" for the "web-cluster" cluster entry in the Kubernetes configuration. | Command:
```bash
kubectl config set-cluster web-cluster --tls-server-name=moon-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-... |
Open the `monitoring-service` service for editing using the `micro` editor. | Command:
```bash
KUBE_EDITOR="micro" kubectl edit svc/monitoring-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 varia... |
Create a debugging version of the e-commerce-pod with all container images replaced with confluentinc/cp-kafka | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-api --set-image=*=confluentinc/cp-kafka
```
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 ... |
List the replication controller named 'web', the service named 'vpn-service-rc', and the pod named 'analytics-pod'. | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/analytics-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespac... |
Create a debug pod named 'debug-image-api' by copying the configuration of 'backend-pod', and start an interactive shell inside the 'mycontainer' container of the debug pod. | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-api --container=mycontainer -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by defau... |
Auto scale the deployment "api" with a minimum of 7 pods and a maximum of 11 pods | Command:
```bash
kubectl autoscale deployment api --min=7 --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... |
Create a new config map named db-config with the specified keys by specifying the file paths for properties and key1 | Command:
```bash
kubectl create configmap db-config --from-file=properties=/path/to/properties/file1.txt --from-file=key1=/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 co... |
Add a taint with key 'zone' on nodes having label service=auth | Command:
```bash
kubectl taint node -l service=auth zone=kube-master-9:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Create a role named "custom_role" with the ability to delete pods and specific resource names "staging-app-server" and "dashboard-ui" | Command:
```bash
kubectl create role custom_role --verb=delete --resource=pods --resource-name=staging-app-server --resource-name=dashboard-ui
```
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... |
Set the CPU and memory limits to 200m and 512Mi, respectively, and the CPU and memory requests to 50m and 1Gi, respectively, for all containers in the 'ubuntu' deployment. | Command:
```bash
kubectl set resources deployment ubuntu --limits=cpu=200m,memory=512Mi --requests=cpu=50m,memory=1Gi
```
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 requeste... |
Create a new config map named 'api-config' using the specified files 'file1.txt' and 'file2.txt' as the values for 'settings' and 'key2' keys respectively. | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/preferences/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 co... |
Return the previous terminated logs of the 'nano-bot' container from the 'cdn-service-pod' pod | Command:
```bash
kubectl logs -p -c nano-bot cdn-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", "sho... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.