prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Auto-scale the replication controller "analytics" with a target CPU utilization of 90%, ensuring that the number of pods stays between 1 and 5. | Command:
```bash
kubectl autoscale rc analytics --max=5 --cpu-percent=90
```
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 us... |
Create a Pod Disruption Budget named notification-service-pdb that will select all pods with the component=web label and require a minimum of one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=component=web --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-ava... |
Create an ingress called 'api-gateway-ingress' that directs requests from foo.com/input to svc1:5432 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="foo.com/input=svc1:5432,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
View the logs of a specific container within a deployment | Command:
```bash
kubectl logs deployment/gateway-deployment -c gateway-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:
"flag": "--... |
Create a pod disruption budget named statefulset-pdb that selects all pods with the label tier=frontend and requires a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=tier=frontend --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Create an ingress resource named 'public-ingress' that directs requests to website.com/example to the service named 'svc1' on port 3306 | Command:
```bash
kubectl create ingress public-ingress --rule="website.com/example=svc1:3306,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Create an ingress called 'www-ingress' that routes requests for "site.com/bar" to a service named svc1 on port 3001 | Command:
```bash
kubectl create ingress www-ingress --rule="site.com/bar=svc1:3001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
View the rollout history of the daemonset named "development", and specifically look at revision 5. | Command:
```bash
kubectl rollout history daemonset/development --revision=5
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or UR... |
Delete the pods and services with the names "payment" and "cdn" | Command:
```bash
kubectl delete pod,service payment cdn
```
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.
Som... |
Create a new config map named kube-system-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap kube-system-config --from-file=properties=/path/to/options/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 cre... |
Create a config map named app-config-dev with specified keys from files | Command:
```bash
kubectl create configmap app-config-dev --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/configurations/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 debug container in proxy-service-pod for troubleshooting purposes, using the Debian image and changing the container images for both the cache and debug containers. | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=debug-image-app --image=debian --set-image=cache=redis:alpine,cache=redis:alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by reso... |
update the image version of the email-service-pod to v4 | Command:
```bash
kubectl get pod email-service-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 ... |
Forward traffic from port 3000 on all addresses to port 8081 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-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... |
List the replication controller named 'web', the service named 'email-service-rc', and the pod named 'chat-app-pod' | Command:
```bash
kubectl get rc/web service/email-service-rc pods/chat-app-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 namespa... |
create a cluster role binding named "bar" that grants the "bar" cluster role to "user1", "user2", and "group1" | Command:
```bash
kubectl create clusterrolebinding bar --clusterrole=bar --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] [--serviceaccount=na... |
Create a cron job in the default namespace with the name "email-notifications" | Command:
```bash
kubectl create cronjob email-notifications --image=busybox --schedule="*/1 * * * *"
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "defa... |
Set resource limits for the alpine container in the deployment to 1 CPU and 2Gi of memory | Command:
```bash
kubectl set resources deployment alpine -c=nginx --limits=cpu=1,memory=2Gi
```
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 its... |
Copy the directory /tmp/foo_dir from the remote pod security-scanner-pod-18 to the local directory /etc/kubernetes. | Command:
```bash
kubectl cp kube-proxy/security-scanner-pod-18:/tmp/foo_dir /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Forward data between local port 5000 and pod port 6379 for the 'database-deployment' deployment | Command:
```bash
kubectl port-forward deployment/database-deployment 5000 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 ... |
Apply a taint to nodes labeled with 'app=web-app' and set the taint key to 'workload' with the value 'monitoring-node-15:PreferNoSchedule' | Command:
```bash
kubectl taint node -l app=web-app workload=monitoring-node-15:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Forward local port 5432 to the pod's port 8088 of the analytics-platform-deployment | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 5432 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 po... |
Create a service named "centos" which will expose the replicated centos containers on port 9091, and will connect to the containers on port 8080 | Command:
```bash
kubectl expose rs centos --port=9091 --target-port=808000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Create a new config map named db-config with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap db-config --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/configurations/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... |
Add a taint with key 'dedicated' on nodes having label instance=app-instance-1, and set the value of the taint to 'node-1:PreferNoSchedule' | Command:
```bash
kubectl taint node -l instance=app-instance-1 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": "", "usa... |
Copy a file from a remote pod to a local directory | Command:
```bash
kubectl cp kube-public/backend-pod-13:/tmp/foo /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 kubectl... |
Create a copy of the 'media-stream-pod' with a debug container and changing container images | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-app --image=debian --set-image=worker=my-custom-worker:1.2.3,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... |
Remove the 'zone' taint with the 'PreferNoSchedule' effect from the 'node-1' node | Command:
```bash
kubectl taint nodes node-1 zone: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 of: js... |
update the 'gateway-deployment' deployment by adding a new environment variable named S3_BUCKET with the value my-s3-bucket | Command:
```bash
kubectl set env deployment/gateway-deployment S3_BUCKET=my-s3-bucket
```
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... |
Switch to raw terminal mode and attach to the 'cyber-sleuth' container in the 'analytics-pod' | Command:
```bash
kubectl attach analytics-pod -c cyber-sleuth -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 omit... |
Forward local ports 5432 and 6000 to ports 5432 and 6000 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-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 be select... |
Create a new ClusterIP service named api-service-clusterip with port forwarding from port 3000 on the service to port 9091 on the backend | Command:
```bash
kubectl create service clusterip api-service-clusterip --tcp=3000:9091
```
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", "d... |
Create a new ExternalName service named "external-database-service" that points to the external DNS name "document-company.com" | Command:
```bash
kubectl create service externalname external-database-service --external-name document-company.com
```
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 referenc... |
Copy the file from /var/run/secrets/kubernetes.io/serviceaccount/ to the /tmp/bar_dir directory in the 'logging-agent-pod-7' pod, specifically in the 'database-container' container. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ logging-agent-pod-7:/tmp/bar_dir -c database-container
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": ... |
Set the resource limits and requests for all containers in the 'runtime' deployment | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=cpu=10,memory=2Gi
```
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... |
Set the CPU and memory limits and requests for all containers in the 'python' deployment | Command:
```bash
kubectl set resources deployment python --limits=cpu=200m,memory=512Mi --requests=cpu=2,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 requeste... |
Create a service for the 'python' replica set, which serves on port 3000 and connects to the containers on port 500000. | Command:
```bash
kubectl expose rs python --port=3000 --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.... |
Import the 'LOG_LEVEL' key from the 'env-vars' config map and set it as an environment variable for the 'authentication-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --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 defi... |
Create a role named "foo" with the ability to patch pods and specifically target the "blog-backend" and "file-processing" resources. | Command:
```bash
kubectl create role foo --verb=patch --resource=pods --resource-name=blog-backend --resource-name=file-processing
```
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|clie... |
Create a debug pod copy of proxy-service-pod changing all container images to jenkins. | Command:
```bash
kubectl debug proxy-service-pod --copy-to=my-debugger --set-image=*=jenkins
```
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 r... |
Copy a local file to a remote pod in a specific container | Command:
```bash
kubectl cp /tmp/foo admin-dashboard-pod-16::/tmp/bar -c backend-container
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Create a single ingress called 'api-v1-ingress' that directs requests to website.com/example to the service `svc1` on port `8089`, and use the TLS secret "my-cert". | Command:
```bash
kubectl create ingress api-v1-ingress --rule="website.com/example=svc1:8089,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Start a pod named 'hazelcast' using the 'centos' image and expose port '8181' on the container. | Command:
```bash
kubectl run hazelcast --image=centos --port=8181
```
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... |
Return snapshot logs from all containers in pods defined by the label "service=auth" | Command:
```bash
kubectl logs -l service=auth --all-containers=true
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container... |
List the specified resources by their types and names | Command:
```bash
kubectl get rc/web service/monitoring-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 ... |
Import the `smtp_server` key from the `app-config` ConfigMap into the `database-deployment` deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-config deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in... |
Create a service for a replication controller identified by type and name specified in "ruby-controller.yaml" that serves on port 8088 and connects to the containers on port 500000. | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8088 --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 s... |
Create a new config map named app-config-prod with specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap app-config-prod --from-file=settings=/path/to/preferences/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 crea... |
Remove the 'env' label from the 'gateway' pod. | Command:
```bash
kubectl label pods gateway env-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true,... |
List the replication controller 'web', service 'analytics-rc' and the pod 'auth-service-pod' by their respective types and names. | Command:
```bash
kubectl get rc/web service/analytics-rc pods/auth-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 namespa... |
Create a deployment using a specific image | Command:
```bash
kubectl create deployment jenkins-x --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|... |
execute the 'bash' command within the cdn-service-pod pod and retrieve the output. | Command:
```bash
kubectl exec cdn-service-pod -- bash
```
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.kube... |
Set the custom TLS server name to "staging-cluster" for the "galaxy-cluster" cluster entry | Command:
```bash
kubectl config set-cluster galaxy-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] [--certif... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ file on your local machine to the /tmp/bar directory in a remote pod named monitoring-agent-pod-6 within the kube-dns namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ kube-dns/monitoring-agent-pod-6:/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": "... |
Create a new secret named my-secret with keys for each file in the path/to/configurations folder | Command:
```bash
kubectl create secret generic my-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 basename of ... |
Forward port 8088 on all addresses to port 5000 in the analytics-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 8088:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Import the secret_key key from the env-vars configmap and set it as an environment variable in the analytics-platform-deployment deployment. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/env-vars deployment/analytics-platform-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... |
Create an ingress called 'public-ingress' with a rule that directs requests from testing.com/input to svc1:8084 | Command:
```bash
kubectl create ingress public-ingress --rule="testing.com/input=svc1:8084,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... |
Remove the "client-secret" config value for the OpenID Connect auth provider for the "saas-admin" entry. | Command:
```bash
kubectl config set-credentials saas-admin --auth-provider=oidc --auth-provider-arg=client-secret-
```
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-... |
Execute the 'go run hello.go' command inside the e-commerce-pod container named lunar-launcher, and display the output. | Command:
```bash
kubectl exec e-commerce-pod -c lunar-launcher -- 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... |
Create a copy of the 'auth-service-pod' with all container images changed to 'ruby', and name it 'debug-image-api' | Command:
```bash
kubectl debug auth-service-pod --copy-to=debug-image-api --set-image=*=ruby
```
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 r... |
Add a taint with the key 'workload' and value 'gpu-node-12:PreferNoSchedule' on all nodes having the label 'component=proxy' | Command:
```bash
kubectl taint node -l component=proxy workload=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":... |
Create a job with a specified command | Command:
```bash
kubectl create job log-collection --image=golang -- go 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 format... |
Create a deployment named "mattermost" using the "mongo" image and expose port 8083. | Command:
```bash
kubectl create deployment mattermost --image=mongo --port=8083
```
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... |
Add a taint with key 'app' on nodes having label myLabel | Command:
```bash
kubectl taint node -l myLabel app=node-2:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. O... |
Create a debug copy of api-service-pod, added a debug container and changed container images | Command:
```bash
kubectl debug api-service-pod -it --copy-to=debug-image-memcached --image=debian --set-image=database=mysql:5.7,cache=redis:alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by ... |
Access the raw terminal of a pod and interact with the 'bash' shell in the cosmic-container. | Command:
```bash
kubectl attach monitoring-pod -c cosmic-container -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... |
Create an ingress resource named 'private-api-ingress' with the following rules: map requests with the path 'site.com/example' to the service 'svc1' on port 8083, using the TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress private-api-ingress --rule="site.com/example=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": "", ... |
Remove the taint with key 'hardware' and effect 'NoExecute' from node 'storage-node-13' | Command:
```bash
kubectl taint nodes storage-node-13 hardware:NoExecute-
```
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 ... |
Add a taint with the key 'cpu-type' on nodes having the label instance=app-instance-1 | Command:
```bash
kubectl taint node -l instance=app-instance-1 cpu-type=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": ... |
Create an ingress named 'public-api-ingress' that routes requests from 'site.com/example' to 'svc1:27017' with a TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress public-api-ingress --rule="site.com/example=svc1:27017,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Update the deployment 'api-server-deployment' with a new environment variable named S3_BUCKET and set its value to 'my-s3-bucket' | Command:
```bash
kubectl set env deployment/api-server-deployment S3_BUCKET=my-s3-bucket
```
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 /var/run/secrets/kubernetes.io/serviceaccount/ to the remote pod api-server-pod-3 in the prometheus namespace, with the destination path /tmp/bar | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ prometheus/api-server-pod-3::/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": "Con... |
Create a new secret named email-credentials-secret in default namespace, from the environment file at path/to/configs.env | Command:
```bash
kubectl create secret generic email-credentials-secret --from-env-file=path/to/configs.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 ... |
Attach to a pod named frontend-pod and enter the Rocket Ranger container in raw terminal mode | Command:
```bash
kubectl attach frontend-pod -c rocket-ranger -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 omit... |
Return the previous terminated logs of the "nano-bot" container from the pod "api-service-pod" | Command:
```bash
kubectl logs -p -c nano-bot api-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sho... |
Set the service account of the deployment named 'database-deployment' to 'kube-scheduler' | Command:
```bash
kubectl set serviceaccount deployment database-deployment kube-scheduler
```
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:
`ku... |
taint nodes labeled with 'myLabel' as 'special' with the taint value 'edge-node-10:PreferNoSchedule' | Command:
```bash
kubectl taint node -l myLabel 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": "", "usage": "Output... |
Create a copy of a pod named "monitoring-pod" and change all container images to "amazonlinux" | Command:
```bash
kubectl debug monitoring-pod --copy-to=debug-image-api --set-image=*=amazonlinux
```
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... |
Deny the Certificate Signing Request 'csr-mysql-10' | Command:
```bash
kubectl certificate deny csr-mysql-10
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kubectl ... |
Import specific keys from a config map to an environment variable of a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/monitoring-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Auto scale the replication controller "vpn" with a target CPU utilization of 81% and a maximum of 8 pods. | Command:
```bash
kubectl autoscale rc vpn --max=8 --cpu-percent=81
```
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 an ingress with two annotations, ingress.annotation1 and ingress.annotation2 | Command:
```bash
kubectl create ingress annotated --class=default --rule="website.com/module=svc:port" \
--annotation ingress.annotation1=testing \
--annotation ingress.annotation2=bla
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[... |
Forward traffic from port 8088 on all addresses to port 9090 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8088: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... |
Create an ingress named 'private-ingress' that maps requests from foo.com/module to the service svc1:3000, with a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress private-ingress --rule="foo.com/module=svc1:3000,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... |
Set the cluster field in the "app-2-context" context to "dev-cluster". | Command:
```bash
kubectl config set contexts.app-2-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... |
Add a taint on nodes with label service=auth | Command:
```bash
kubectl taint node -l service=auth dedicated=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":... |
Mark node "prod-node-5" as unschedulable | Command:
```bash
kubectl cordon prod-node-5
```
What it does:
Mark node as unschedulable.
Syntax:
`kubectl cordon NODE`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selector (label query) to filter on " |
Create a debug container in log-aggregator-pod, using the image debian, and changing the container images for proxy and cache to nginx:1.21 and redis:alpine, respectively. | Command:
```bash
kubectl debug log-aggregator-pod -it --copy-to=dgb-img --image=debian --set-image=proxy=nginx:1.21,cache=redis:alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and ... |
Embed the certificate authority data for the staging-cluster cluster entry | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/staging-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl conf... |
Create a service named external-payment-gateway-service that serves as an external DNS entry for the domain governmental-demo.gov | Command:
```bash
kubectl create service externalname external-payment-gateway-service --external-name governmental-demo.gov
```
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 ... |
Execute the 'npm --version' command on the first container of the 'gateway-service' service pod and retrieve the output. | Command:
```bash
kubectl exec svc/gateway-service -- npm --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... |
Create an ingress named 'web-ingress' with a rule that directs requests from foo.com/input to the service named svc1 on port 27017 | Command:
```bash
kubectl create ingress web-ingress --rule="foo.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": "", "usage": "... |
Create a pod disruption budget named batch-processing-pdb that will select all pods with the env=production label and require at least 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=env=production --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-availa... |
Create a new ExternalName service named 'external-cloud-storage-service' with the external name 'news-demo.news' | Command:
```bash
kubectl create service externalname external-cloud-storage-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... |
Create a copy of the vpn-service-pod with a debug container and change the container images | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=debug-image-memcached --image=debian --set-image=app=app:debug,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 resourc... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=LOG_LEVEL --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 variable def... |
Update the pod 'gateway' by adding the annotation 'expiration-date' with the value '2024-12-31', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods gateway 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 a... |
Create a new ClusterIP service named analytics-service-clusterip that forwards traffic from port 5432 to port 9092 | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=5432:9092
```
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": "-... |
Update the CPU and memory limits of the PostgreSQL container in the deployment named "postgres" to 10 CPU units and 128 MiB of memory. | Command:
```bash
kubectl set resources deployment postgres -c=nginx --limits=cpu=10,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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.