prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a cluster role binding with custom_role cluster role for multiple users and groups | Command:
```bash
kubectl create clusterrolebinding custom_role --clusterrole=custom_role --user=user1 --user=user2 --group=group1
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--s... |
List deployments in YAML output format, in the "v1.0.0" version of the "experimental-apps" API group. | Command:
```bash
kubectl get deployments.v1.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 namespaced y... |
Create a new secret with the name "aws-credentials-secret" using the environment variables in the file located at "path/to/parameters.env" | Command:
```bash
kubectl create secret generic aws-credentials-secret --from-env-file=path/to/parameters.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... |
Update the pod named 'email' with the annotation 'monitoring-tool' and the value 'Prometheus', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods email 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... |
Create a secret named "gcp-service-account-secret" using an environment file | Command:
```bash
kubectl create secret generic gcp-service-account-secret --from-env-file=path/to/profiles.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 ... |
Update the 'search-engine-deployment' deployment by adding a new environment variable named ENV with the value 'prod' | Command:
```bash
kubectl set env deployment/search-engine-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 (withi... |
Remove the taint with key 'app' and effect 'PreferNoSchedule' from the node 'worker-node-3' | Command:
```bash
kubectl taint nodes worker-node-3 app:PreferNoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Import the 'CONFIG_FILE_PATH' key from the 'app-config-prod' config map into the 'api-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config-prod deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Create an ingress object named ingdefault with the specified rules and default backend | Command:
```bash
kubectl create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="website.com/*=svc:8181,tls=secret1"
```
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": "... |
Create a pod disruption budget named worker-pdb that will select all pods with the env=production label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=env=production --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 [--d... |
Taint nodes with label 'feature=feature-xyz' with a key 'datacenter' and value 'backup-node-14:PreferNoSchedule' | Command:
```bash
kubectl taint node -l feature=feature-xyz 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": "",... |
Create an ingress called 'default-ingress' that directs requests to 'website.com/input' to 'svc1:8082', and use the TLS secret "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="website.com/input=svc1:8082,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
List all deployments in JSON format, using the "custom-version" version of the "experimental-apps" API group. | Command:
```bash
kubectl get deployments.custom-version.experimental-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 name... |
Dump the default and kube-system namespaces to the ~/.config/kube directory. | Command:
```bash
kubectl cluster-info dump --namespaces default,kube-system --output-directory=~/.config/kube
```
What it does:
Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. ... |
Create a job called "image-build-job" using the "postgres" image and execute the "postgres" command | Command:
```bash
kubectl create job image-build-job --image=postgres -- postgres
```
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... |
Update the pod 'chat-app' with the annotation 'expiration-date' and set its value as '2024-12-31'. | Command:
```bash
kubectl annotate pods chat-app expiration-date='2024-12-31'
```
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 ... |
Edit the 'user-service' service. | Command:
```bash
kubectl edit svc/user-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi'... |
Delete the pods and services with the names "security" and "analytics" | Command:
```bash
kubectl delete pod,service security analytics
```
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 select... |
Create an ingress called 'public-service-ingress' with a rule that directs requests from 'testing.com/input' to 'svc1:27017' and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/input=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":... |
Create a php pod and expose port 8080. | Command:
```bash
kubectl run hazelcast --image=php --port=8080
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--file... |
Delete the pods and services named "email" and "frontend" | Command:
```bash
kubectl delete pod,service email frontend
```
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.
... |
Forward traffic from port 8080 on your local machine to port 8000 on a pod selected by the deployment "notification-handler-deployment". | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 8080 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 ... |
import the key 'CONFIG_FILE_PATH' from the 'app-secrets' config map into the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-secrets 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 definiti... |
Create a new service account named jenkins | Command:
```bash
kubectl create serviceaccount jenkins
```
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-te... |
Create a service for the 'ubuntu-controller.yaml' replication controller | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=8084 --target-port=637900
```
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... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/namespace-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/docker-registry-secret deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one o... |
List deployments in the JSON output format for the "legacy-1.0.0" version of the "internal-apps" API group. | Command:
```bash
kubectl get deployments.legacy-1.0.0.internal-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... |
Create a pod using the Amazon Linux image and expose port 3000. | Command:
```bash
kubectl run hazelcast --image=amazonlinux --port=3000
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag":... |
Start a pod with the image confluentinc/cp-kafka and expose port 8082 | Command:
```bash
kubectl run hazelcast --image=confluentinc/cp-kafka --port=8082
```
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... |
Update the pod named 'security' with the annotation 'description' and the value 'Web server for marketing site' | Command:
```bash
kubectl annotate pods security description='Web server for marketing site'
```
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 labe... |
Create a service named 'hazelcast' for the replicated hazelcast, the service should serve on port 80 and connect to the containers on port 8000. | Command:
```bash
kubectl expose rc hazelcast --port=8888 --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 po... |
Start streaming the logs of the "mycontainer" container in the "log-aggregator-pod" pod. | Command:
```bash
kubectl logs -f -c mycontainer 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": "--container"... |
Add a taint with key 'workload' on nodes having label stack=tech-stack on the node-1 with the "PreferNoSchedule" effect | Command:
```bash
kubectl taint node -l stack=tech-stack workload=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Set the client key data for the k8s-admin user by providing the certificate data and using the set-raw-bytes option. | Command:
```bash
kubectl config set users.k8s-admin.client-key-data cert_data_here --set-raw-bytes=true
```
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... |
Create a new config map named 'global-config' using the settings from '/path/to/preferences/file1.txt' and the parameters from '/path/to/parameters/file2.txt' | Command:
```bash
kubectl create configmap global-config --from-file=settings=/path/to/preferences/file1.txt --from-file=key2=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When crea... |
Set the service account of the deployment named 'api-server-deployment' to 'elasticsearch' | Command:
```bash
kubectl set serviceaccount deployment api-server-deployment elasticsearch
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`k... |
Update the annotation 'git-repo' of pod 'proxy' with the value 'https' | Command:
```bash
kubectl annotate --overwrite pods proxy git-repo='https://github.com/example/my-app'
```
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... |
Get the output of the 'mongo --version' command from the 'warp-drive' container running in the 'gateway-pod' pod | Command:
```bash
kubectl exec gateway-pod -c warp-drive -- mongo --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Add a taint with key 'dedicated' and value 'storage-node-13:PreferNoSchedule' on nodes having label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack dedicated=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Create a deployment named "loadbalancer" using the "mongo" image and expose port 8000. | Command:
```bash
kubectl create deployment loadbalancer --image=mongo --port=8000
```
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 ... |
Remove the label 'bar' from the pod 'email' if it exists | Command:
```bash
kubectl label pods email unhealthy-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If t... |
Create a service for replicated wordpress, which serves on port 8000 and connects to the containers on port 500100. | Command:
```bash
kubectl expose rc wordpress --port=8000 --target-port=500100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-secrets 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 i... |
Add a taint with the key 'environment' on nodes having the label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 environment=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":... |
Open a continuous stream of logs from all containers within pods that have the label 'tier=frontend'. | Command:
```bash
kubectl logs -f -l tier=frontend --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": "--conta... |
Partially update the node using a strategic merge patch from the provided YAML file | Command:
```bash
kubectl patch -f kubeadm-config.yaml -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]`
... |
Output the modified deployment in YAML format for the monitoring-stack-deployment, by setting the environment variable S3_BUCKET to my-s3-bucket | Command:
```bash
kubectl set env deployment/monitoring-stack-deployment S3_BUCKET=my-s3-bucket -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or ... |
Listen on port 3000 on your local machine and forward the data to port 8000 in a pod selected by the 'database-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/database-deployment 3000 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 ... |
Update the image version (tag) of the pod "media-stream-pod" to v4. | Command:
```bash
kubectl get pod media-stream-pod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
```
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 b... |
Execute the command 'elasticsearch --version' inside the container 'nano-bot' of the pod 'monitoring-pod' and display the output. | Command:
```bash
kubectl exec monitoring-pod -c nano-bot -- elasticsearch --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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/kube-system-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variab... |
Create a new secret named cert-manager-secret and include keys for each file in the folder "bar" | Command:
```bash
kubectl create secret generic cert-manager-secret --from-file=path/to/options
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename ... |
delete a user from the kubeconfig | Command:
```bash
kubectl config delete-user cluster-admin
```
What it does:
Delete the specified user from the kubeconfig.
Syntax:
`kubectl config delete-user NAME` |
Scale the deployment named webapp-replicaset from its current size of 3 to a desired size of 7 | Command:
```bash
kubectl scale --current-replicas=3 --replicas=7 deployment/webapp-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 --resource-v... |
Create a service for the replication controller specified in "wordpress-controller.yaml" file, which serves on port 8082 and connects to the containers on port 801000. | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=8082 --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 ... |
Execute the command 'dotnet --list-runtimes' in the 'time-machine' container of the 'gateway-pod' pod and get the output. | Command:
```bash
kubectl exec gateway-pod -c time-machine -- 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... |
Create a new secret named 'email-credentials-secret' with the following contents: | Command:
```bash
kubectl create secret generic email-credentials-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=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... |
Add a taint with key 'environment' on nodes having label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha environment=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": "", ... |
Add the annotation "backup-strategy='daily backups'" to the pod identified by type and name in the "setup.json" file. | Command:
```bash
kubectl annotate -f setup.json 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 a pod disruption budget named 'load-balancer-pdb' that will select all pods with the 'release=1.0.0' label and require a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=release=1.0.0 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=... |
Create a priority class named "batch-priority" with a value of 25, a description of "Priority for batch processing workloads", and a preemption policy of "Never". | Command:
```bash
kubectl create priorityclass batch-priority --value=25 --description="Priority for batch processing workloads" --preemption-policy="Never"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VALUE ... |
Retrieve the logs from the first container of a job named data-synchronization-job | Command:
```bash
kubectl logs job/data-synchronization-job
```
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... |
Add the annotation 'custom-label' with the value 'my-custom-value' to the 'auth' pod | Command:
```bash
kubectl annotate pods auth custom-label=my-custom-value
```
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 arbi... |
Monitor the status of a deployment update. | Command:
```bash
kubectl rollout status deployment/my-deployment
```
What it does:
Show the status of the rollout.
By default 'rollout status' will watch the status of the latest rollout until it's done. If you don't want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout star... |
Run the 'node' command inside the pod named auth-service-pod | Command:
```bash
kubectl exec auth-service-pod -- node
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kub... |
Print the modified 'web-app-deployment' deployment in YAML format by setting the environment variable 'LOG_LEVEL' to 'info' | Command:
```bash
kubectl set env deployment/web-app-deployment LOG_LEVEL=info -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod template... |
Create a job with the command 'mysql --version' using the image 'wordpress' | Command:
```bash
kubectl create job scaling-job --image=wordpress -- mysql --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 f... |
Forward local port 8081 to port 5000 in a pod selected by the deployment named "email-server-deployment". | Command:
```bash
kubectl port-forward deployment/email-server-deployment 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... |
Create an ingress resource named "app-loadbalancer-ingress" that forwards requests from "site.com/example" to the service named "svc1" on port 7000 | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="site.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":... |
Copy the kube config file located at ~/.config/kube to the /etc/kubernetes directory inside the pod named 'openfaas/image-resizer-pod-20' in the namespace 'openfaas' | Command:
```bash
kubectl cp ~/.config/kube openfaas/image-resizer-pod-20:/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,... |
Set the custom TLS server name to "kube-cluster-1" for the kube-cluster-2 cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-2 --tls-server-name=kube-cluster-1
```
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] [--certifi... |
Import the key "smtp_server" from the config map "app-config-prod" to the deployment "payment-processor-deployment" | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-config-prod 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 ... |
Set the certificate-authority-data field on the kube-cluster-1 cluster with the given certificate data | Command:
```bash
kubectl config set clusters.kube-cluster-1.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
```
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 contai... |
Forward the traffic from port 8000 on all addresses to port 5432 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 sel... |
Apply a taint with key 'zone' on nodes which have the label 'team=devops', and assign the taint value 'k8s-node-1:PreferNoSchedule'. | Command:
```bash
kubectl taint node -l team=devops zone=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": "Output ... |
Create an ingress called 'private-service-ingress' that routes requests to site.com/example to the service with the name 'svc1' and port '6379' | Command:
```bash
kubectl create ingress private-service-ingress --rule="site.com/example=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": ... |
Create a copy of the 'web-app-pod' pod and name it 'my-debugger', using the 'debian' image | Command:
```bash
kubectl debug web-app-pod -it --copy-to=my-debugger --image=debian --set-image=proxy=nginx:1.21,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 and name. Po... |
List the replication controller named 'web', the service named 'payment-gateway-rc', and the pod named 'monitoring-pod' | Command:
```bash
kubectl get rc/web service/payment-gateway-rc pods/monitoring-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 nam... |
Add a taint with key 'disktype' on nodes having label project=project-alpha. | Command:
```bash
kubectl taint node -l project=project-alpha disktype=web-node-8:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Create a new ClusterIP service named auth-service-clusterip that listens on port 8181 and forwards traffic to port 8010. | Command:
```bash
kubectl create service clusterip auth-service-clusterip --tcp=8181:8010
```
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 | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-name-config 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 defi... |
Listen on port 8888 on all addresses, forwarding to port 3000 in the pod named 'frontend-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 8888: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... |
Listen on port 6379 locally and forward data to/from port 6379 in the 'analytics-pod' pod | Command:
```bash
kubectl port-forward pod/analytics-pod 6379 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 selected auto... |
Forward traffic from port 5000 on your local machine to port 5432 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5000: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 a... |
Create a pod named "hazelcast" using the Centos image and expose port 8088 on the container. | Command:
```bash
kubectl run hazelcast --image=centos --port=8088
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Listen on port 8888 locally, forwarding data to/from port 8081 in the analytics-pod pod | Command:
```bash
kubectl port-forward pod/analytics-pod 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 will be selected auto... |
Create an ingress called 'private-api-ingress' that directs requests to site.com/bar to the service svc1:8888 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress private-api-ingress --rule="site.com/bar=svc1:8888,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": "", "usa... |
Forward port 6379 on your local machine to port 5000 in the web-app-pod pod | Command:
```bash
kubectl port-forward pod/web-app-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 be selected automa... |
Set the resource requests and limits for all containers in the nginx deployment | Command:
```bash
kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=3,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, ... |
Create an ingress resource with TLS enabled, using a specific secret and pathType as Prefix. | Command:
```bash
kubectl create ingress ingsecret --class=default \
--rule="site.com/*=svc:8443,tls=secret1"
```
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": "",... |
Create a ClusterIP service named shipping-service-clusterip on port 8080, forwarding to port 8089. | Command:
```bash
kubectl create service clusterip shipping-service-clusterip --tcp=8080:8089
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o... |
Create a new secret named git-credentials-secret from an environment file | Command:
```bash
kubectl create secret generic git-credentials-secret --from-env-file=path/to/properties.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to... |
Update the 'email' pod by adding the annotation 'last-deployment' with the value '2023-03-15' | Command:
```bash
kubectl annotate pods email last-deployment=2023-03-15
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbit... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-name-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable ... |
Retrieve the output from running the 'dotnet' command within the monitoring-pod. | Command:
```bash
kubectl exec monitoring-pod -- dotnet
```
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.kub... |
Create a service for a WordPress deployment, serving on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose deployment wordpress --port=3306 --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 spec... |
Import environment variables from a secret into a deployment | Command:
```bash
kubectl set env --from=secret/database-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 one or mor... |
Create an ingress named 'private-api-ingress' that directs requests to website.com/module to the service 'svc1' on port 3001, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress private-api-ingress --rule="website.com/module=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": ""... |
Remove the taint with key 'disktype' and effect 'NoSchedule' from node 'worker-node-3' if it exists. | Command:
```bash
kubectl taint nodes worker-node-3 disktype: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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.