prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Get the output of the 'redis-server --version' command in the Stardust-Shuttle container from the Monitoring-Pod | Command:
```bash
kubectl exec monitoring-pod -c stardust-shuttle -- redis-server --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 n... |
Get deployments in the "web-apps" API group with the version "legacy-1.0.0" in JSON format. | Command:
```bash
kubectl get deployments.legacy-1.0.0.web-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you ... |
Set cpu and memory limits for a container in a deployment | Command:
```bash
kubectl set resources deployment alpine -c=nginx --limits=cpu=50m,memory=1Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to i... |
Get the output from running the 'nginx -g "daemon off;"' command in the nebula-navigator container of the auth-service-pod | Command:
```bash
kubectl exec auth-service-pod -c nebula-navigator -- nginx -g "daemon off;"
```
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... |
Update the annotation 'git-repo' of pod 'vpn' with the value 'https://github.com/example/my-app'. | Command:
```bash
kubectl annotate pods vpn 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 labels a... |
Create a deployment named wordpress using the jenkins image and expose port 8088. | Command:
```bash
kubectl create deployment wordpress --image=jenkins --port=8088
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One o... |
create an ingress called 'api-gateway-ingress' that redirects requests from foo.com/example to svc1:5432 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="foo.com/example=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": "", "... |
Copy the local file "~/.config/kube" to the remote pod "web-app-pod-1" in the "ingress-nginx" namespace, and place it in the "/tmp/bar" directory. | Command:
```bash
kubectl cp ~/.config/kube ingress-nginx/web-app-pod-1:/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Forward local traffic from port 6379 to port 5432 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 6379 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... |
Create a service for the replication controller specified in "ubuntu-controller.yaml", which serves on port 80 and connects to the containers on port 637900 | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=80 --target-port=637900
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Expose the deployment "node" as a service on port 8083, connecting to the containers on port 818100. | Command:
```bash
kubectl expose deployment node --port=8083 --target-port=818100
```
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... |
Forward traffic from local port 8088 to port 5432 in the pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8088: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... |
Create a new secret named app-config-secret using an environment file | Command:
```bash
kubectl create secret generic app-config-secret --from-env-file=path/to/preferences.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the... |
Import the environment variables from the 'database-secret' secret and set them for the 'proxy-service-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/database-secret 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 in one or more... |
Edit the last-applied-configuration annotations for the 'hazelcast' deployment in the 'hazelcast' namespace. | Command:
```bash
kubectl apply edit-last-applied deployment/hazelcast/hazelcast
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will ... |
Create a new config map named env-vars using specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap env-vars --from-file=properties=/path/to/parameters/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... |
Create a cron job named "alerts-cleanup" using the image "confluentinc/cp-kafka" that runs the command "kafka-server-start /etc/kafka/server.properties" every minute. | Command:
```bash
kubectl create cronjob alerts-cleanup --image=confluentinc/cp-kafka --schedule="*/1 * * * *" -- kafka-server-start /etc/kafka/server.properties
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args..... |
Create a copy of a pod with a debug container and update container images | Command:
```bash
kubectl debug frontend-pod -it --copy-to=my-custom-dbg --image=debian --set-image=mailer=mailer:latest,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified b... |
Listen on a random port locally and forward the traffic to port 8000 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod :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... |
Show the resource usage metrics for a specific node. | Command:
```bash
kubectl top node node-1
```
What it does:
Display resource (CPU/memory) usage of nodes.
The top-node command allows you to see the resource consumption of nodes.
Syntax:
`kubectl top node [NAME | -l label]`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selector (label ... |
Create a cluster role named "foo" with the "get" verb and the "services" resource, with the resource names "order-fulfillment" and "app-worker-1" | Command:
```bash
kubectl create clusterrole foo --verb=get --resource=services --resource-name=order-fulfillment --resource-name=app-worker-1
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|... |
Annotate the pod 'security' with the annotation 'monitoring-tool' and value 'Prometheus' | Command:
```bash
kubectl annotate pods security monitoring-tool=Prometheus
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ar... |
Add a taint with key 'workload' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta workload=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": ... |
Import the specific key DATABASE_URL from the api-config config map to the load-balancer-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/api-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 definiti... |
Create a single ingress called 'default-ingress' that directs requests to foo.com/example to svc1:8443 with a TLS secret called "my-cert" | Command:
```bash
kubectl create ingress default-ingress --rule="foo.com/example=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": "", "usag... |
Annotate the pod 'web' with the annotation 'description' and the value 'Web server for marketing site', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods web 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 th... |
Add a taint with key 'cpu-type' on nodes having label stack=tech-stack. | Command:
```bash
kubectl taint node -l stack=tech-stack cpu-type=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Ou... |
Apply the configuration specified in the options.json file to the pod. | Command:
```bash
kubectl apply -f ./options.json
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
J... |
Forward local port 8088 to port 8088 in the pod | Command:
```bash
kubectl port-forward pod/proxy-server-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 a... |
Create a new config map named app-config-prod using the specified files, where the key for the first file will be "settings" and the key for the second file will be "key2" | Command:
```bash
kubectl create configmap app-config-prod --from-file=settings=/path/to/configs/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 c... |
Display detailed information about a specific pod | Command:
```bash
kubectl describe pods/front-end-pod-12
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provi... |
partially update the 'prod-node-5' node by setting the 'replicas' field to 3 using a strategic merge patch in JSON format | Command:
```bash
kubectl patch node prod-node-5 -p '{"spec":{"replicas":3}'
```
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 flags:... |
Copy the contents of the local file "/var/run/secrets/kubernetes.io/serviceaccount/" to the remote pod "worker-pod-4" in the namespace "velero" and place it in the file "/tmp/bar". | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ velero/worker-pod-4::/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 n... |
Create a pod disruption budget named 'cache-cluster-pdb' that selects all pods with the 'version=v2' label and requires a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=version=v2 --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [... |
add the annotation "custom-label" with the value "my-custom-value" to the pod specified in the "pod.json" file | Command:
```bash
kubectl annotate -f pod.json custom-label=my-custom-value
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ar... |
Add a taint with the key 'app' and the value 'node-2:PreferNoSchedule' on nodes having the label 'feature=feature-xyz'. | Command:
```bash
kubectl taint node -l feature=feature-xyz 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": "Outp... |
Auto scale the deployment "gateway" with the number of pods ranging between 7 and 11. | Command:
```bash
kubectl autoscale deployment gateway --min=7 --max=11
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Rollback the deployment of the 'app-v2' to the previous version | Command:
```bash
kubectl rollout undo deployment/app-v2
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Create a single ingress called 'api-gateway-ingress' that directs requests to site.com/example to svc1:5432 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/example=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": "", ... |
Return the snapshot logs from the container "log-aggregator-pod-1" of a deployment named "order-processing-deployment". | Command:
```bash
kubectl logs deployment/order-processing-deployment -c log-aggregator-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 fl... |
Start streaming the logs of the 'lunar-launcher' container in the 'analytics-pod' pod | Command:
```bash
kubectl logs -f -c lunar-launcher analytics-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", ... |
Create a debug container in the backend-pod and attach to it | Command:
```bash
kubectl debug backend-pod -it --image=busybox --copy-to=my-debugger
```
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 ... |
Create a debug copy of the 'database-pod' by adding a 'debian' based debug container, and changing the container images to mysql:5.7 for the database container and logging-app:debug for the logger container | Command:
```bash
kubectl debug database-pod -it --copy-to=dgb-img --image=debian --set-image=database=mysql:5.7,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource an... |
Set the resource requests and limits for the postgres deployment | Command:
```bash
kubectl set resources deployment postgres --limits=cpu=200m,memory=512Mi --requests=cpu=2,memory=1Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requeste... |
Create a new NodePort service named media-stream-nodeport | Command:
```bash
kubectl create service nodeport media-stream-nodeport --tcp=27017:3306
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default... |
Update the annotation 'deployment-script' of the 'gateway' pod with the value 'https://example.com/deploy.sh' | Command:
```bash
kubectl annotate pods gateway 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... |
Listen on port 3000 on all addresses and forward traffic to port 3000 in the pod named 'mypod' | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 3000:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Diff the contents of a file read from stdin | Command:
```bash
cat setup.json | kubectl diff -f -
```
What it does:
Diff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied.
The output is always YAML.
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff ... |
Expose the replicated hazelcast using a replica set, with the service listening on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose rs hazelcast --port=8000 --target-port=888800
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Create a cron job named backup-job with the provided command, using the ubuntu image, and scheduling it every minute | Command:
```bash
kubectl create cronjob backup-job --image=ubuntu --schedule="*/1 * * * *" -- docker run -it ubuntu
```
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", "shor... |
Create a pod disruption budget named notification-service-pdb that will select all pods with the env=production label and require at least one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget notification-service-pdb --selector=env=production --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-av... |
Show the resource usage metrics for all pods with the label app-type=microservice | Command:
```bash
kubectl top pod -l app-type=microservice
```
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 deployment named "nats" using the "python" image and expose port 27017. | Command:
```bash
kubectl create deployment nats --image=python --port=27017
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: js... |
Add a taint with the key 'dedicated' on nodes having the label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth dedicated=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Get the output from the first pod of the replica set named "ubuntu" | Command:
```bash
kubectl attach rs/ubuntu
```
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, use the kubectl.kuber... |
Add a taint with key 'environment' and value 'storage-node-13:PreferNoSchedule' on all nodes that have a label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops environment=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": "", "usag... |
Assign the label 'role' with the value 'backend' to the pod named 'proxy' | Command:
```bash
kubectl label pods proxy role=backend
```
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... |
Update the pod 'backend' with the annotation 'env' and set its value to 'staging' | Command:
```bash
kubectl annotate pods backend 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 v... |
Create a new ExternalName service named external-database-service with the external name "travel-sample.travel" | Command:
```bash
kubectl create service externalname external-database-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 referenc... |
Set the CPU and memory limits to 200 milliCPU and 512 mebibytes, respectively, and the CPU and memory requests to 10 millicpu and 2 gibibytes, respectively, for all containers in the 'node' deployment. | Command:
```bash
kubectl set resources deployment node --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 requested, ... |
Set up autoscaling for the "media-stream" deployment with a minimum of 5 pods and a maximum of 8 pods | Command:
```bash
kubectl autoscale deployment media-stream --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 ... |
Add a taint with key 'datacenter' on nodes having label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app datacenter=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": "... |
Add an annotation to the pod named 'gateway' with the key 'description' and the value 'Web server for marketing site' | Command:
```bash
kubectl annotate pods gateway 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 label... |
Create a job named 'audit-job' with the 'php' image, and run the 'composer --version' command. | Command:
```bash
kubectl create job audit-job --image=php -- composer --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... |
Import the specific keys (API_KEY) from the kube-system-config ConfigMap into the email-server-deployment deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/kube-system-config 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 defini... |
List all deployments in the "custom-apps" API group with the version "beta-1.0" in YAML output format. | Command:
```bash
kubectl get deployments.beta-1.0.custom-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 you w... |
Forward traffic from port 8888 on all IP addresses to port 8088 in the mypod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8888: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 sel... |
Create a new service named "nginx-https" based on the existing service "nginx", and map the container port 8443 to port 443 | Command:
```bash
kubectl expose service nginx --port=443 --target-port=9090 --name=nginx-https
```
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... |
Partially update the node specified in the "node.json" file using a strategic merge patch, with the new value of "key" set to "new-value". | Command:
```bash
kubectl patch -f 10-mynet.conf -p '{"data":{"key":"new-value"}'
```
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 f... |
Forward local port 8000 to pod port 8081 in a specific deployment | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8000 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 ... |
Update the image of all containers in the 'namespace-3' daemonset to 'node:14.17.3' | Command:
```bash
kubectl set image daemonset namespace-3 *=node:14.17.3
```
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:
... |
Forward traffic from port 8081 on localhost and IP 10.19.21.23 to port 8080 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8081:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the ... |
Execute the 'elasticsearch --version' command in nebula-navigator container of payment-gateway-pod and retrieve the output. | Command:
```bash
kubectl exec payment-gateway-pod -c nebula-navigator -- elasticsearch --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Conta... |
Start streaming the logs of the cosmic-container container in the email-service-pod pod | Command:
```bash
kubectl logs -f -c cosmic-container email-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": "--contai... |
Create a deployment named 'api' using the 'alpine' image and expose port 5432 | Command:
```bash
kubectl create deployment api --image=alpine --port=5432
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json... |
Update the deployment 'payment-processor-deployment' by setting a new environment variable | Command:
```bash
kubectl set env deployment/payment-processor-deployment DB_HOST=localhost
```
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 tem... |
Forward local port 3000 to port 8088 in the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 3000 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... |
Copy the "/tmp/foo_dir" directory from a remote pod named "backend-pod-13" in the "istio-system" namespace to the local "/tmp/bar" directory. | Command:
```bash
kubectl cp istio-system/backend-pod-13:/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 k... |
Create a cluster role named "view" with the verb "proxy" and the resource "services" | Command:
```bash
kubectl create clusterrole view --verb=proxy --resource=services --resource-name=notification-service --resource-name=message-queue
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|... |
Listen on a random port on the local machine and forward traffic to the 8088 port in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod :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... |
Execute the 'kafka-console-producer' command inside the 'gateway-pod' pod and get the output | Command:
```bash
kubectl exec gateway-pod -- kafka-console-producer --broker-list localhost:9092 --topic test
```
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": "", "u... |
Forward the local ports 9090 and 6000 to ports 5432 and 6000 respectively in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward pod/cdn-service-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 be selected au... |
Get the output from running the 'ash' command in the astro-container from the analytics-pod. | Command:
```bash
kubectl exec analytics-pod -c astro-container -- ash
```
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 ... |
Switch to a raw terminal mode and attach to the 'mycontainer' container within the 'database-pod' pod | Command:
```bash
kubectl attach database-pod -c mycontainer -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 omitte... |
Create a new config map named 'app-settings' with the specified keys 'conf' and 'data' using the provided files '/path/to/profiles/file1.txt' and '/path/to/settings/file2.txt'. | Command:
```bash
kubectl create configmap app-settings --from-file=conf=/path/to/profiles/file1.txt --from-file=data=/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 creating a con... |
Create a service for a replication controller using the specified configuration file, serving on port 9090 and connecting to the containers on port 637900 | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=9090 --target-port=637900
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on ... |
Delete pods and services with the label component=proxy. | Command:
```bash
kubectl delete pods,services -l component=proxy
```
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 sele... |
Create a single ingress called 'api-gateway-ingress' that directs requests to website.com/bar to svc # svc1:8082 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="website.com/bar=svc1:8082,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Copy the local file `/tmp/foo` to the remote pod named `database-pod-2` in the `ingress-nginx` namespace, and place it at `/tmp/bar` inside the pod. | Command:
```bash
kubectl cp /tmp/foo ingress-nginx/database-pod-2::/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 kube... |
Expose a replication controller as a service with specified ports | Command:
```bash
kubectl expose -f centos-controller.yaml --port=3001 --target-port=909000
```
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... |
Taint the node labeled app-type=microservice with a key 'workload' and value 'app-node-6:PreferNoSchedule' | Command:
```bash
kubectl taint node -l app-type=microservice workload=app-node-6:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Add a taint with key 'disktype' on nodes having label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 disktype=web-node-8:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Get the output from running the 'sleep 3600' command in the stardust-shuttle container of the api-service-pod pod. | Command:
```bash
kubectl exec api-service-pod -c stardust-shuttle -- sleep 3600
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omi... |
Create a pod disruption budget named auth-service-pdb that will select all pods with the region=us-east label and require at least one of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget auth-service-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=... |
Get the output from the cyber-sleuth container in the pod named proxy-service-pod | Command:
```bash
kubectl attach proxy-service-pod -c cyber-sleuth
```
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 pod disruption budget with a specific selector and minimum availability requirement | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=version=v2 --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 named 'registry' that runs the 'alpine' image with 7 replicas | Command:
```bash
kubectl create deployment registry --image=alpine --replicas=7
```
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... |
Import specific keys from a config map into a deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Create a job called audit-job using the mysql image, and run the command "mysql" inside the job. | Command:
```bash
kubectl create job audit-job --image=mysql -- mysql
```
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. One of: j... |
Forward port 8080 on all addresses to port 8088 inside the pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8080: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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.