prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new secret named 'gcp-service-account-secret' from the environment file located at 'path/to/data.env' | Command:
```bash
kubectl create secret generic gcp-service-account-secret --from-env-file=path/to/data.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 t... |
Display the resource usage metrics for the 'gateway-pod' pod and its containers. | Command:
```bash
kubectl top pod gateway-pod --containers
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl top pod [... |
Create a pod disruption budget named worker-pdb that will select all pods with the region=us-east label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=region=us-east --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... |
Set a custom TLS server name for the "prod-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster prod-cluster --tls-server-name=cloud-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] [--certificat... |
Set the service account of the deployment "search-engine-deployment" to "kube-proxy" | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment kube-proxy
```
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... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-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 definiti... |
Create a pod using the MySQL image and expose port 8443 | Command:
```bash
kubectl run hazelcast --image=mysql --port=8443
```
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": "--fi... |
Create a debug version of the frontend pod with all container images changed to nginx | Command:
```bash
kubectl debug frontend-pod --copy-to=dgb-img --set-image=*=nginx
```
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 resource is ... |
Get the details of a specific replication controller | Command:
```bash
kubectl get replicationcontroller chat-app-rc
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will onl... |
Create a new ExternalName service named external-analytics-service. | Command:
```bash
kubectl create service externalname external-analytics-service --external-name travel-sample.travel
```
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 referen... |
Scale the deployment named 'bar' to 3 replicas, considering its current size is 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=3 deployment/bar
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
Forward traffic from local port 8088 to port 5000 in the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward pod/e-commerce-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 will be selected aut... |
Create a new ClusterIP service named "backend-service-clusterip" and map port 3001 on the cluster to port 8083 on the service. | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=3001:8083
```
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"... |
Add a taint with the key 'special' on nodes having the label app-type=microservice | Command:
```bash
kubectl taint node -l app-type=microservice special=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": ... |
Unset the namespace for the testing-context context | Command:
```bash
kubectl config unset contexts.testing-context.namespace
```
What it does:
Unset 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.
Syntax:
`kubectl config unset PROPERTY_NAM... |
Create a new nginx deployment, but only print the corresponding API objects without actually creating them. | Command:
```bash
kubectl run nginx --image=nginx --dry-run=client
```
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... |
Add a label to the pod named 'database' with the label 'role' and the value 'frontend' | Command:
```bash
kubectl label pods database role=frontend
```
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":... |
Set the cluster field in the specified context to a specific cluster name. | Command:
```bash
kubectl config set contexts.user-b-context.cluster kube-cluster-1
```
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... |
Apply a taint on the nodes with the label cluster=my-cluster, with the key 'dedicated' and value 'k8s-node-1' | Command:
```bash
kubectl taint node -l cluster=my-cluster dedicated=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": "", "usag... |
Create a service for a hazelcast deployment, which serves on port 3306 and connects to the containers on port 330600. | Command:
```bash
kubectl expose deployment hazelcast --port=3306 --target-port=330600
```
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... |
Create a new config map named app-secrets with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-secrets --from-file=settings=/path/to/preferences/file1.txt --from-file=key2=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating ... |
Set the service account of the deployment named "web-app-deployment" to "kube-dns" | Command:
```bash
kubectl set serviceaccount deployment web-app-deployment kube-dns
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kubectl s... |
delete the pods and services with the names "web" and "frontend" | Command:
```bash
kubectl delete pod,service web 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.
So... |
Connect to the lunar-launcher container in the chat-app-pod and retrieve the output. | Command:
```bash
kubectl attach chat-app-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 omitted, ... |
Create a postgres pod and override the spec with values from a JSON file | Command:
```bash
kubectl run nginx --image=postgres --overrides='{ "apiVersion": "v1.1.1", "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] -- [COMM... |
Forward data between ports 8081 and 6000 in the pod "frontend-pod" and ports 8081 and 6000 locally. | Command:
```bash
kubectl port-forward pod/frontend-pod 8081 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 autom... |
Auto scale a replication controller "api" with a maximum of 7 pods and a target CPU utilization of 90% | Command:
```bash
kubectl autoscale rc api --max=7 --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 uses the... |
Create a new config map named global-config with the specified keys and file paths | Command:
```bash
kubectl create configmap global-config --from-file=settings=/path/to/configurations/file1.txt --from-file=key2=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When cre... |
Partially update a node by specifying the patch as a YAML configuration. | Command:
```bash
kubectl patch node edge-node-10 -p $'spec:\n unschedulable: true'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Helpful... |
Create a cron job named 'alerts-cleanup' using the 'mysql' image, with a schedule of running every minute | Command:
```bash
kubectl create cronjob alerts-cleanup --image=mysql --schedule="*/1 * * * *" -- mysqld
```
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", "d... |
Scale the deployment named 'mysql' to 5 replicas. | Command:
```bash
kubectl scale --current-replicas=5 --replicas=5 deployment/bar
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is spec... |
Get 'geth version' output from the first pod of the 'user-service' service. | Command:
```bash
kubectl exec svc/user-service -- geth 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 kub... |
Update the label of the pod named 'cdn' with the key 'tier' and the value 'frontend' | Command:
```bash
kubectl label pods cdn tier=frontend
```
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 ... |
Check if you have permission to list the job named "data-synchronization-job" in the "staging" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/data-synchronization-job -n staging
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a parti... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/monitoring-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 definitio... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/ui-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... |
Set the service account for the deployment "cache-cluster-deployment" to "gitlab-runner" | Command:
```bash
kubectl set serviceaccount deployment cache-cluster-deployment gitlab-runner
```
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:... |
Retrieve output from lunar-launcher in api-service-pod | Command:
```bash
kubectl attach api-service-pod -c lunar-launcher
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Create a new config map named 'api-config' using the files 'file1.txt' and 'file2.txt' for the 'properties' and 'key1' keys, respectively | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/profiles/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 creating a... |
Import specific keys from a config map to set environment variables of a deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-settings deployment/mydeployment
```
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... |
Create a deployment named "db" with the MySQL image and expose port 8888. | Command:
```bash
kubectl create deployment db --image=mysql --port=8888
```
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|y... |
List all the configmaps in the default namespace in the ps output format | Command:
```bash
kubectl get configmaps
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in your c... |
Create a debug copy of the e-commerce-pod, changing all container images to golang | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-api --set-image=*=golang
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no r... |
Import the environment variables from the 'docker-registry-secret' secret and update the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/docker-registry-secret deployment/web-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 definitions in one or mor... |
Create a new ClusterIP service named payment-service-clusterip | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=8443:5432
```
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 ExternalName service named external-database-service that maps to the external DNS name tutorial-ai.ai | Command:
```bash
kubectl create service externalname external-database-service --external-name tutorial-ai.ai
```
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 serv... |
create a cron job with a given schedule and command | Command:
```bash
kubectl create cronjob daily-report --image=ruby --schedule="*/1 * * * *" -- irb
```
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", "default... |
Add the annotation 'deployment-script' with the value 'https://example.com/deploy.sh' to the pod named 'payment' | Command:
```bash
kubectl annotate pods payment deployment-script='https://example.com/deploy.sh'
```
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... |
Run a pod named 'hazelcast' using the 'ruby' image and expose port 5001 within the container. | Command:
```bash
kubectl run hazelcast --image=ruby --port=5001
```
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": "--fil... |
Import environment variables from a secret | Command:
```bash
kubectl set env --from=secret/email-credentials-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... |
create a service for the replication controller specified in "node-controller.yaml" file in the current directory, which serves on port 5001 and connects to the containers on port 500000 | Command:
```bash
kubectl expose -f node-controller.yaml --port=5001 --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 an ingress called 'app2-ingress' with the following rule: direct requests for site.com/bar to svc1:9090, using the tls secret "my-cert". | Command:
```bash
kubectl create ingress app2-ingress --rule="site.com/bar=svc1:9090,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": "O... |
Listen on port 8888 locally, forwarding to port 9090 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8888: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... |
Attach to the 'proxy-server-pod' pod and get the output from the 'warp-drive' container | Command:
```bash
kubectl attach proxy-server-pod -c warp-drive
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Create an ingress named 'app-ingress' that routes requests from 'foo.com/input' to service 'svc1' on port '8089', using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress app-ingress --rule="foo.com/input=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": "", "usage": "O... |
Create a copy of the 'backend-pod' pod and add a debug container while changing container images | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-api --image=debian --set-image=worker=my-custom-worker:1.2.3,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identif... |
Switch to raw terminal mode and attach to a specific container in a pod | Command:
```bash
kubectl attach api-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 omit... |
Run the 'jenkins-plugin-cli' command inside the first container of the first pod of the frontend-service service | Command:
```bash
kubectl exec svc/frontend-service -- jenkins-plugin-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Update the image of all containers of the daemonset services to 'php:7.4.22' | Command:
```bash
kubectl set image daemonset services *=php:7.4.22
```
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), replicaset (rs)
Syntax:
`kube... |
Check if the user has permission to list the job named "cleanup-job" in the "namespace-1" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/cleanup-job -n namespace-1
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL th... |
Forward local port 3000 to port 6379 in the mypod pod | Command:
```bash
kubectl port-forward pod/mypod 3000: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 automaticall... |
Forward traffic from local port 6379 to port 8888 in the pod named "proxy-server-pod". | Command:
```bash
kubectl port-forward pod/proxy-server-pod 6379 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 selected a... |
Listen on port 8081 on your local machine, forwarding data to/from port 8081 on the pod selected by the 'web-app-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8081 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 s... |
Create a debug container in a copy of the database-pod with a different container image and scheduler image | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-web --image=debian --set-image=app=app:debug,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resour... |
Roll back the daemonset "app-v2" to revision 3 | Command:
```bash
kubectl rollout undo daemonset/app-v2 --to-revision=3
```
What it does:
Roll back to a previous rollout.
Syntax:
`kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the ... |
Create a service for the 'wordpress' deployment, which serves on port 8084 and connects to the containers on port 500100 | Command:
```bash
kubectl expose deployment wordpress --port=8084 --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 spec... |
Create a new ClusterIP service named monitoring-service-clusterip and expose port 8010 on the service which will forward traffic to port 8088. | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=8010:8088
```
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": "... |
Check if you have permission to list the "load-testing-job" job in the "monitoring" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/load-testing-job -n monitoring
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial UR... |
Begin streaming the logs of the 'stardust-shuttle' container in the 'proxy-server-pod' pod. | Command:
```bash
kubectl logs -f -c stardust-shuttle proxy-server-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--contain... |
Create a debugging session for the auth-service-pod, copying it to a debug-image with the container name rocket-ranger. | Command:
```bash
kubectl debug auth-service-pod -it --copy-to=debug-image-memcached --container=rocket-ranger -- 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 ... |
Execute a command inside a running container in a deployment | Command:
```bash
kubectl exec deploy/analytics-platform-deployment -- 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 omitte... |
Delete pods and services with the names "web" and "gateway" | Command:
```bash
kubectl delete pod,service web gateway
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/log-config deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Create a role named "admin_role" with SubResource specified | Command:
```bash
kubectl create role admin_role --verb=list,create,update --resource=pods,pods/exec
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag... |
Create a new config map with specified keys from file paths | Command:
```bash
kubectl create configmap log-config --from-file=settings=/path/to/configs/file1.txt --from-file=key2=/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 creatin... |
Update the 'chat-app' pod by setting the annotation 'owner' to 'alice-smith', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods chat-app owner='alice-smith'
```
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... |
Add a taint with key 'environment' on nodes with the label 'region=eu-west-2'. | Command:
```bash
kubectl taint node -l region=eu-west-2 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... |
Copy the /tmp/foo file from the metallb-system/load-balancer-pod-9 pod to the /tmp/bar directory locally. | Command:
```bash
kubectl cp metallb-system/load-balancer-pod-9::/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 t... |
Import the specific key "redis_host" from the config map "app-settings" into the environment variables of the deployment "backend-microservice-deployment". | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-settings 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 d... |
Output the modified cache-cluster-deployment deployment in YAML format, with the DB_HOST environment variable set to localhost, without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/cache-cluster-deployment DB_HOST=localhost -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... |
Copy the "/tmp/foo_dir" directory from the remote pod "kube-dns/database-pod-2" to the local "/tmp/bar" directory. | Command:
```bash
kubectl cp kube-dns/database-pod-2:/tmp/foo_dir :/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 kubec... |
Create a new ClusterIP service named cache-service-clusterip, and map port 7000 to port 8888 | Command:
```bash
kubectl create service clusterip cache-service-clusterip --tcp=7000:8888
```
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", ... |
Add a taint to nodes | Command:
```bash
kubectl taint node -l project=project-alpha workload=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": "", "usa... |
Set the custom TLS server name to 'prod-cluster' for the cluster entry 'moon-cluster' | Command:
```bash
kubectl config set-cluster moon-cluster --tls-server-name=prod-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate... |
Add a taint with key 'special' on nodes having label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack special=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": "Out... |
Forward local ports 8888 to port 9090 of the pod named cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8888 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 au... |
Import the LOG_LEVEL key from the configmap/app-secrets and set it as an environment variable for the search-engine-deployment deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-secrets 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 variable definition... |
Create a new LoadBalancer service named backend-lb listening on TCP port 8089 and forwarding traffic to port 5432 | Command:
```bash
kubectl create service loadbalancer backend-lb --tcp=8089:5432
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default... |
Partially update the k8s-node-1 node by specifying the patch as a YAML file, with the following content: | Command:
```bash
kubectl patch node k8s-node-1 -p $'spec:\n rules:\n- http:\n paths:\n - path: /\n backend:\n service:\n name: new-service'
```
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.
Syn... |
Create a cron job named `daily-report` with the command `geth attach` using the `ethereum/client-go` image | Command:
```bash
kubectl create cronjob daily-report --image=ethereum/client-go --schedule="*/1 * * * *" -- geth attach
```
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", "... |
Execute the 'kafka-topics --list' command inside the e-commerce-pod container stardust-shuttle, and print the output. | Command:
```bash
kubectl exec e-commerce-pod -c stardust-shuttle -- kafka-topics --list
```
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... |
Set up a port forwarding from your local machine to the 'analytics-pod' pod | Command:
```bash
kubectl port-forward pod/analytics-pod 6379: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 auto... |
Create an ingress named 'api-ingress' that directs requests for 'site.com/module' to service 'svc1' on port 8443 using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress api-ingress --rule="site.com/module=svc1:8443,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": ... |
Edit the order-service service using the nano editor. | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/order-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, ... |
Listen on port 5432 locally, forwarding data to/from port 5000 in the pod selected by the 'mydeployment' deployment. | Command:
```bash
kubectl port-forward deployment/mydeployment 5432 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 selecte... |
"Taint nodes with label region=eu-west-2 using the key 'disktype' with the value 'gpu-node-12:PreferNoSchedule'." | Command:
```bash
kubectl taint node -l region=eu-west-2 disktype=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 cron job with a command | Command:
```bash
kubectl create cronjob log-rotation --image=amazonlinux --schedule="*/1 * * * *" -- /bin/bash -c "echo 'Hello
```
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": "--out... |
Create a config map named "app-name-config" using the specified keys and their corresponding file paths | Command:
```bash
kubectl create configmap app-name-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Create a job named backup with the image ubuntu and the command "docker run ubuntu echo 'Hello'" | Command:
```bash
kubectl create job backup --image=ubuntu -- docker run ubuntu echo "Hello
```
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": "Ou... |
Create a service for a replicated hazelcast, serving on port 3001 and connecting to the containers on port 9091. | Command:
```bash
kubectl expose rc hazelcast --port=3001 --target-port=909100
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.