prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward local port 5000 to the targetPort of the service's port named "https" in a selected pod by the service | Command:
```bash
kubectl port-forward service/gateway-service 5000:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Enable the Google Compute Platform authentication provider for the "deploy-bot" user. | Command:
```bash
kubectl config set-credentials deploy-bot --auth-provider=gcp
```
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=keyfile
Bearer token flags:
--... |
Copy the analytics-pod, add a debug container, and change the container images | Command:
```bash
kubectl debug analytics-pod -it --copy-to=debug-image-memcached --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 resourc... |
get resources by their type and names | Command:
```bash
kubectl get rc/web service/media-stream-rc pods/api-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 names... |
Check the rollout status of a daemonset | Command:
```bash
kubectl rollout status daemonset/namespace-3
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Create a Pod Disruption Budget named notification-service-pdb that selects pods with the app=rails label and ensures that at least four of them are available at any given time. | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=app=rails --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-availab... |
Create a deployment named jenkins using the php image and expose port 8010. | Command:
```bash
kubectl create deployment jenkins --image=php --port=8010
```
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: jso... |
Set the cpu limits of the nginx container in the node deployment to "10" and the memory limits to "512Mi" | Command:
```bash
kubectl set resources deployment node -c=nginx --limits=cpu=10,memory=512Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to it... |
Set a custom TLS server name for the cloud-cluster cluster entry | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=galaxy-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certific... |
Create a deployment named "api" that runs the "mcr.microsoft.com/dotnet/core/runtime" image and exposes port 8443. | Command:
```bash
kubectl create deployment api --image=mcr.microsoft.com/dotnet/core/runtime --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... |
Forward port 5432 on all addresses to port 5432 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 5432:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Use the "atom" editor to edit the backend-service service | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/backend-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... |
Update the 'media-stream' pod with the annotation 'alert-email' and the value 'alerts@example.com', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods media-stream 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... |
Create a new ExternalName service named 'external-metrics-service' with the external name 'news-demo.news' | Command:
```bash
kubectl create service externalname external-metrics-service --external-name news-demo.news
```
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 servi... |
Get the output from running the 'composer --version' command in the astro-container from the pod proxy-server-pod. | Command:
```bash
kubectl exec proxy-server-pod -c astro-container -- composer --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... |
Forward traffic from port 8080 on all addresses to port 3000 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-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 wi... |
Create a cluster role named "default_role" with the ResourceName specified for the services "mail-server" and "log-aggregator" | Command:
```bash
kubectl create clusterrole default_role --verb=get --resource=services --resource-name=mail-server --resource-name=log-aggregator
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cl... |
Copy the local file ~/.config/kube to the /etc/kubernetes directory in the backend-pod-13 pod running in the kubeapps namespace | Command:
```bash
kubectl cp ~/.config/kube kubeapps/backend-pod-13:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Forward all traffic from port 3000 to port 8081 in the pod named 'cdn-service-pod'. Listen on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 3000: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 w... |
Create a cluster role named "admin_role" with permissions to get services and specific resource names like "database-master" and "search-elasticsearch" | Command:
```bash
kubectl create clusterrole admin_role --verb=get --resource=services --resource-name=database-master --resource-name=search-elasticsearch
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=s... |
Get the output from the 'lunar-launcher' container in the 'proxy-service-pod' pod | Command:
```bash
kubectl attach proxy-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 omit... |
Update node 'web-node-8' by adding a taint with key 'disktype' and value 'ssd' and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes web-node-8 disktype=ssd: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... |
Set the environment variable DEBUG=true on the deployment authentication-service-deployment | Command:
```bash
kubectl set env deployment/authentication-service-deployment DEBUG=true
```
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 templ... |
Copy the local file /tmp/foo_dir to the remote pod web-app-pod-1 at the path /tmp/bar | Command:
```bash
kubectl cp /tmp/foo_dir web-app-pod-1:/tmp/bar -c auth-service
```
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 service for the replication controller specified in "hazelcast-controller.yaml" file | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=8888 --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 ... |
update the annotation value of the pod specified in the 'options.json' file to '2.5.1' | Command:
```bash
kubectl annotate -f options.json app-version=2.5.1
```
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 the client-key-data field for the cluster-admin user by providing the certificate data using the --set-raw-bytes option. | Command:
```bash
kubectl config set users.cluster-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_V... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/monitoring-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
create a secret named ldap-credentials-secret from an env file | Command:
```bash
kubectl create secret generic ldap-credentials-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 ... |
Display the name and image of the first container in the frontend-pod using custom columns | Command:
```bash
kubectl get pod frontend-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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 --se... |
Create an ingress named 'api-gateway-ingress' that routes requests from website.com/bar to svc1:8083 and uses TLS certificate "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="website.com/bar=svc1:8083,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 role named "custom_role" with the ResourceName specified | Command:
```bash
kubectl create role custom_role --verb=connect --resource=pods --resource-name=app-worker-2 --resource-name=prod-api-gateway
```
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=... |
Start a mysql pod with the nginx name and the mysql image, but use a partial set of values parsed from JSON to override the spec. | Command:
```bash
kubectl run nginx --image=mysql --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] -- [COMMAND... |
Start a pod named 'hazelcast' using the 'ubuntu' image and expose port 3000 from the container. | Command:
```bash
kubectl run hazelcast --image=ubuntu --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": "--f... |
Listen on port 8080 locally and forward it to port 8888 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8080:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Copy the local file '/tmp/foo' to the '/tmp/bar' directory inside the remote pod 'logging/image-resizer-pod-20' in the namespace 'logging'. | Command:
```bash
kubectl cp :/tmp/foo logging/image-resizer-pod-20::/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 kub... |
Create a new secret named oauth-secret by providing a file containing a ssh private key and a literal passphrase. | Command:
```bash
kubectl create secret generic oauth-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 based on a ... |
Create a role binding for multiple users and a group, granting them the "view" cluster role | Command:
```bash
kubectl create rolebinding view --clusterrole=view --user=jane.doe --user=bob.smith --group=developers
```
What it does:
Create a role binding for a particular role or cluster role.
Syntax:
`kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--servic... |
Add the annotation 'scaling-policy' with the value 'auto-horizontal-scaling' to the pod 'log-aggregator' | Command:
```bash
kubectl annotate pods log-aggregator scaling-policy=auto-horizontal-scaling
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than lab... |
Get the output from running the 'dotnet --list-runtimes' command in the lunar-launcher container of the security-service-pod pod. | Command:
```bash
kubectl exec security-service-pod -c lunar-launcher -- 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": "Contain... |
Retrieve the output of the 'dotnet --list-runtimes' command executed in the code-explorer container of the api-service-pod pod. | Command:
```bash
kubectl exec api-service-pod -c code-explorer -- 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 nam... |
Update the description of a pod specified in the "options.json" file with the value 'Web server for marketing site' | Command:
```bash
kubectl annotate -f options.json 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 la... |
Create a single ingress called 'internal-ingress' that directs requests from foo.com/example to svc1:8888 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress internal-ingress --rule="foo.com/example=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... |
Create a pod named 'hazelcast' using the 'jenkins' image, and expose port 6379 | Command:
```bash
kubectl run hazelcast --image=jenkins --port=6379
```
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": "--... |
Forward local port 8080 to port 9090 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 8080: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... |
Execute the 'mongod' command inside the 'lunar-launcher' container in the 'auth-service-pod' pod. | Command:
```bash
kubectl exec auth-service-pod -c lunar-launcher -- mongod
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a job named database-seeding-job using the python image, and execute the command "python --version" | Command:
```bash
kubectl create job database-seeding-job --image=python -- python --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Import the SMTP_SERVER key from the 'app-secrets' config map into the 'order-processing-deployment' deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-secrets 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 defin... |
Add a taint with key 'special' on nodes having label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel special=web-node-8:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
List deployments in YAML output format for the "hotfix-1.1.2" version in the "internal-apps" API group. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.internal-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... |
Create a deployment named 'scheduler' with the 'hazelcast/hazelcast' image and 6 replicas. | Command:
```bash
kubectl create deployment scheduler --image=hazelcast/hazelcast --replicas=6
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output ... |
Forward local traffic to a specific port in the pod. | Command:
```bash
kubectl port-forward pod/cdn-service-pod 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 selected au... |
Taint nodes with label 'team=devops' as dedicated with the value 'gpu-node-12:PreferNoSchedule' | Command:
```bash
kubectl taint node -l team=devops 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": "", "usage": "O... |
Update the container images of the 'python' deployment | Command:
```bash
kubectl set image deployment/python busybox=busybox python=python:3.9.7
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicas... |
Create a new config map named api-config and populate it with specified keys and their corresponding values from files on disk. | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/preferences/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 creat... |
Forward the local port 3000 to port 9090 in the 'web-app-pod' pod | Command:
```bash
kubectl port-forward pod/web-app-pod 3000:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Start a golang pod with the name "hazelcast" using the golang image, and set the environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container. | Command:
```bash
kubectl run hazelcast --image=golang --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
```
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] -- [COM... |
Listen on the localhost and IP address 10.19.21.23, forwarding traffic from port 8080 to port 8081 in the frontend-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-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 criter... |
Import the 'config_file_path' key from the 'app-name-config' config map into the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl set env --keys=config_file_path --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 varia... |
Create a new secret with keys for each file in a folder | Command:
```bash
kubectl create secret generic cert-manager-secret --from-file=path/to/data
```
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 ... |
Remove all taints with the key 'disktype' from the node 'k8s-node-1' | Command:
```bash
kubectl taint nodes k8s-node-1 disktype-
```
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|n... |
Set a custom TLS server name for validation in the dev-cluster cluster entry. | Command:
```bash
kubectl config set-cluster dev-cluster --tls-server-name=edge-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-... |
Apply a taint with the key 'special' to all nodes that have the label 'namespace=mynamespace', and set the taint effect to 'PreferNoSchedule' for the node 'edge-node-10'. | Command:
```bash
kubectl taint node -l namespace=mynamespace special=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": "", "u... |
Import the 'max_connections' key from the 'global-config' config map to the deployment named 'proxy-service-deployment'. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/global-config 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 de... |
Create an autoscaling policy for the "vpn" deployment, with a minimum of 5 pods and a maximum of 8 pods | Command:
```bash
kubectl autoscale deployment vpn --min=5 --max=8
```
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 ... |
Disable certificate checking for the production cluster entry | Command:
```bash
kubectl config set-cluster prod-cluster --insecure-skip-tls-verify=true
```
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] [--certificat... |
Listen on all addresses on port 9090 and forward the traffic to port 5432 in the 'backend-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 9090: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 ... |
Update the pod defined in "params.json" to have an environment annotation of "staging" | Command:
```bash
kubectl annotate -f params.json 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 arbitrary string... |
Create a deployment with a specific image | Command:
```bash
kubectl create deployment monitoring --image=php --
```
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... |
Run the command 'go run hello.go' inside the rocket-ranger container in the vpn-service-pod pod. | Command:
```bash
kubectl exec vpn-service-pod -c rocket-ranger -- go run hello.go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If o... |
Import the DEBUG_MODE key from the app-config-dev config map and set it as an environment variable for the backend-microservice-deployment deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-config-dev 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 variable... |
Set the cluster field in the 'my-context' context to 'app-cluster' | Command:
```bash
kubectl config set contexts.cluster-2-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... |
Create a pod disruption budget named cron-jobs-pdb that will select all pods with the tier=frontend label and require minimum one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cron-jobs-pdb --selector=tier=frontend --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 [-... |
create a deployment with a specific command | Command:
```bash
kubectl create deployment drupal --image=wordpress -- apache2ctl -D FOREGROUND
```
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": "Outpu... |
Return the logs of the previous terminated "rocket-ranger" container from the "web-app-pod" pod. | Command:
```bash
kubectl logs -p -c rocket-ranger web-app-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", "sh... |
Add a taint with the key 'dedicated' and value 'node-1:PreferNoSchedule' on nodes having the label 'release=beta' | Command:
```bash
kubectl taint node -l release=beta dedicated=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": "Outpu... |
Create a copy of the "proxy-service-pod" pod, changing the command of the "cosmic-container" container to "sh" and open an interactive terminal session. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-web --container=cosmic-container -- 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 us... |
Switch to raw terminal mode and attach to the warp-drive container in the proxy-service-pod, allowing input from the client and displaying the output from the 'bash' command executed in the container. | Command:
```bash
kubectl attach proxy-service-pod -c warp-drive -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Add a taint with key 'special' and no value to the 'prod-node-5' node | Command:
```bash
kubectl taint nodes prod-node-5 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: j... |
Execute the 'mongod' command inside the 'rocket-ranger' container in the 'web-app-pod' pod. | Command:
```bash
kubectl exec web-app-pod -c rocket-ranger -- mongod
```
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 t... |
Execute the 'geth' command inside the first pod of the 'authentication-service' service, using the first container by default and display the output. | Command:
```bash
kubectl exec svc/authentication-service -- geth
```
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 k... |
Create a new config map named app-config-dev with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/preferences/file1.txt --from-file=key1=/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 c... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/db-config 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 definitions... |
Start a golang pod and expose port 8081 | Command:
```bash
kubectl run hazelcast --image=golang --port=8081
```
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... |
Define new exec auth plugin args for a specific service account | Command:
```bash
kubectl config set-credentials service-account --exec-arg=arg1 --exec-arg=arg2
```
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=keyfile
Bearer ... |
Set a custom TLS server name for cluster-gamma cluster entry. | Command:
```bash
kubectl config set-cluster cluster-gamma --tls-server-name=cluster-alpha
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifica... |
Execute the command 'php --version' on the pod named 'analytics-pod' and display the output on the terminal. | Command:
```bash
kubectl exec analytics-pod -- php --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubec... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/ui-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Start a pod with the given image, exposing port 9092 | Command:
```bash
kubectl run hazelcast --image=amazonlinux --port=9092
```
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":... |
Forward local port 8088 to port 8088 in the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8088:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Embed the certificate authority data for the kube-cluster-1 cluster entry. | Command:
```bash
kubectl config set-cluster kube-cluster-1 --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... |
Create a copy of the `monitoring-pod` with all container images changed to `mysql` | Command:
```bash
kubectl debug monitoring-pod --copy-to=debug-image-web --set-image=*=mysql
```
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... |
Create a copy of the database-pod by adding a debugging container and changing the container image for the mailer and api containers | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-web --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 na... |
Forward local port 5000 to port 8000 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 5000:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create an ingress called 'web-ingress' that directs requests from 'testing.com/example' to the 'svc1' service on port 9000 using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress web-ingress --rule="testing.com/example=svc1:9000,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... |
Create a service for the replication controller specified in the "wordpress-controller.yaml" file | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=9092 --target-port=844300
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on ... |
Create a pod disruption budget with a selector for pods with a specific version label, and specify a minimum number of pods that should be available at all times. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=version=v2 --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 [--... |
Forward local port 6379 to port 8080 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 6379: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 selected au... |
Update the pod specified by the type and name in the "conf.json" file with the annotation "git-repo" set to 'https://github.com/example/my-app' | Command:
```bash
kubectl annotate -f conf.json 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 than labe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.