prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a pod disruption budget named database-pdb that selects all pods with the region=us-east label and requires at least four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget database-pdb --selector=region=us-east --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 a taint with the key 'hardware' on nodes that have the label 'cluster=my-cluster' and the name 'db-node-7', and mark them as 'PreferNoSchedule'. | Command:
```bash
kubectl taint node -l cluster=my-cluster hardware=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"... |
Get output from running the 'apk add curl' command in astro-container from pod vpn-service-pod | Command:
```bash
kubectl exec vpn-service-pod -c astro-container -- apk add curl
```
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 om... |
delete pods and services with names "email" and "backend" | Command:
```bash
kubectl delete pod,service email backend
```
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.
S... |
Execute the command 'yum install -y wget' in the first container of the payment-service pod and display the output. | Command:
```bash
kubectl exec svc/payment-service -- yum install -y wget
```
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... |
Import environment variables starting with the prefix "MYSQL_" from the config map "app-config-dev" and set them in the deployment "order-processing-deployment" | Command:
```bash
kubectl set env --from=configmap/app-config-dev --prefix=MYSQL_ deployment/order-processing-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
List the deployments in the JSON output format of the "v1.0.0" version of the "alpha-apps" API group | Command:
```bash
kubectl get deployments.v1.0.0.alpha-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 will... |
Create a job called "security-scan-job" using the "ruby" image, and run the command "gem --version" inside the job. | Command:
```bash
kubectl create job security-scan-job --image=ruby -- gem --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 fo... |
Edit the 'api-server-deployment' deployment in YAML format, save the modified configuration in its annotation, and apply the changes. | Command:
```bash
kubectl edit deployment/api-server-deployment -o yaml --save-config
```
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 envir... |
Add a taint on nodes in a specific zone | Command:
```bash
kubectl taint node -l zone=us-east-1 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":... |
Update the pod 'vpn' by setting the annotation 'custom-label' to 'my-custom-value', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods vpn 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... |
Create an ingress named 'app1-ingress' that routes requests from foo.com/bar to svc1:8181 and uses the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress app1-ingress --rule="foo.com/bar=svc1:8181,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... |
Update the annotation 'deployment-script' of pod 'database' to 'https://example.com/deploy.sh', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods database 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 b... |
Run the 'java -jar /usr/share/jenkins/jenkins.war' command inside the astro-container of the pod named log-aggregator-pod and retrieve the output. | Command:
```bash
kubectl exec log-aggregator-pod -c astro-container -- java -jar /usr/share/jenkins/jenkins.war
```
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": "", ... |
Create a job for generating a report using the specified Docker image with Elasticsearch version as a command argument. | Command:
```bash
kubectl create job report-generation-job --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch --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": "--out... |
Forward traffic from port 8080 on all addresses to port 8000 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8080:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a ... |
List all deployments in the "dev-2.2.0" version of the "web-apps" API group and output the results in JSON format. | Command:
```bash
kubectl get deployments.dev-2.2.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 wil... |
Update the annotation 'monitoring-tool' of the pod 'payment' with the value 'Prometheus', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods payment 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 a... |
Import the smtp_server key from the app-config-dev ConfigMap and set it as an environment variable for the analytics-platform-deployment deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-config-dev 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 ... |
Return logs from the monitoring-stack-deployment-1 container of the monitoring-pod deployment | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c monitoring-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:... |
Set the cpu limit of the nginx container in the golang deployment to "200m" and the memory limit to "4Gi" | Command:
```bash
kubectl set resources deployment golang -c=nginx --limits=cpu=200m,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to ... |
attach to the proxy-server-pod and get output from the cosmic-container | Command:
```bash
kubectl attach proxy-server-pod -c cosmic-container
```
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 omi... |
Update the label of the pod 'monitoring' to 'app=myapp' | Command:
```bash
kubectl label pods monitoring app=myapp
```
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": "... |
Import specific keys from a config map into a deployment's environment variables | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-config-dev 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 def... |
List the replication controllers, services, and pods with the names "web", "web-app-rc", and "backend-pod". | Command:
```bash
kubectl get rc/web service/web-app-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 you... |
Add a taint with the key 'disktype' and value 'storage-node-13:PreferNoSchedule' on all nodes with the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace disktype=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": ""... |
View the logs from the first container of the "log-analysis-job" job | Command:
```bash
kubectl logs job/log-analysis-job
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-c",... |
Retrieve the list of deployments in the JSON output format from the "alpha-2.0" version of the "web-apps" API group. | Command:
```bash
kubectl get deployments.alpha-2.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 wil... |
Return the logs from the previously terminated 'cyber-sleuth' container in the 'cdn-service-pod' pod | Command:
```bash
kubectl logs -p -c cyber-sleuth cdn-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", ... |
Attach to the 'mycontainer' container in the 'payment-gateway-pod' pod to view its output. | Command:
```bash
kubectl attach payment-gateway-pod -c mycontainer
```
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 omitt... |
Create a deployment named 'scheduler' using the 'wordpress' image, and set the command as 'wp' | Command:
```bash
kubectl create deployment scheduler --image=wordpress -- wp
```
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: j... |
Start streaming the logs of the "code-explorer" container in the "payment-gateway-pod" pod | Command:
```bash
kubectl logs -f -c code-explorer payment-gateway-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... |
Execute the 'wp' command in the frontend-pod and print the output. | Command:
```bash
kubectl exec frontend-pod -- wp
```
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.kubernete... |
Auto scale the deployment "email" with a minimum of 7 pods and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment email --min=7 --max=15
```
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 t... |
create a cron job to run the cleanup-task command every minute | Command:
```bash
kubectl create cronjob cleanup-task --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", "def... |
Open the notification-service service for editing using the gedit editor | Command:
```bash
KUBE_EDITOR="gedit" kubectl edit svc/notification-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 var... |
Forward traffic from port 8000 on all addresses to port 5000 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8000: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 ... |
Retrieve logs from the first container of a specific job | Command:
```bash
kubectl logs job/log-rotation-job
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-c",... |
Create a service for the python replica set which serves on port 8443 and connects to the containers on port 9091. | Command:
```bash
kubectl expose rs python --port=8443 --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 port.... |
import the 'max_connections' key from the 'namespace-config' config map into the 'api-server-deployment' deployment | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/namespace-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Create a new config map named api-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/path/to/options/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 conf... |
Get output from running the 'postgres' command from the first container in the 'proxy-service-pod' pod. | Command:
```bash
kubectl exec proxy-service-pod -- postgres
```
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 kubect... |
Create a deployment for SonarQube using the Ruby image and a specific gem version. | Command:
```bash
kubectl create deployment sonarqube --image=ruby -- gem --version
```
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... |
Embed the certificate authority data for the "sun-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster N... |
Create an ingress that directs requests to a specific service and port, and use a TLS secret for HTTPS. | Command:
```bash
kubectl create ingress public-service-ingress --rule="site.com/bar=svc1:8181,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": "", "... |
Auto scale the replication controller "analytics" with a target CPU utilization of 40%, ensuring it has a minimum of 1 pod and a maximum of 5 pods. | Command:
```bash
kubectl autoscale rc analytics --max=5 --cpu-percent=40
```
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... |
Set environment variables from a config map for a specific deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/namespace-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Start streaming the logs of the 'ruby' container in the 'monitoring-pod' pod | Command:
```bash
kubectl logs -f -c ruby monitoring-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", "short": ... |
Create a new config map named app-secrets based on the files in the folder "path/to/configs" | Command:
```bash
kubectl create configmap app-secrets --from-file=path/to/configs
```
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 config map based on a file, the key will default to the basename o... |
Approve the certificate signing request 'csr-controller-6' | Command:
```bash
kubectl certificate approve csr-controller-6
```
What it does:
Approve a certificate signing request.
kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the a... |
Create a job for batch processing with the Ruby image, and run the `irb` command. | Command:
```bash
kubectl create job batch-processing --image=ruby -- irb
```
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 o... |
Create a service for a replicated nginx using a replica set, serving on port 9092, and connecting to the containers on port 909000. | Command:
```bash
kubectl expose rs nginx --port=9092 --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 specified port. ... |
Update the java:11.0.12 container image of the deployment named 'java' to 'java' and also update the busybox container image to 'busybox' | Command:
```bash
kubectl set image deployment/java busybox=busybox java=java:11.0.12
```
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 (... |
Create a pod disruption budget with the name "messaging-pdb" that selects all pods with the label "role=worker" and ensures that at least 9 of them are available at any given time. | Command:
```bash
kubectl create poddisruptionbudget messaging-pdb --selector=role=worker --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 [--d... |
Delete pods and services with the names "frontend" and "cdn" | Command:
```bash
kubectl delete pod,service frontend 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.
So... |
Partially update a node using a strategic merge patch, specifying the patch as JSON | Command:
```bash
kubectl patch node backup-node-14 -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]`
Helpfu... |
Forward local port 6379 to port 6379 in the selected pod of the web-app-deployment | Command:
```bash
kubectl port-forward deployment/web-app-deployment 6379 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be s... |
Listen on all addresses on port 8080 and forward the traffic to port 8081 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 8080:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Forward local ports 5432 and 6000 to ports 8088 and 6000 on the pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 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 pod will be selected a... |
create a deployment named 'sonarqube' with the image 'docker.elastic.co/elasticsearch/elasticsearch' and the command 'elasticsearch' | Command:
```bash
kubectl create deployment sonarqube --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch
```
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", "d... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/db-config deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
Create a debug copy of the 'gateway-pod' by adding a 'debian' debug container and changing the container images to 'api:v2' and 'redis:alpine' respectively | Command:
```bash
kubectl debug gateway-pod -it --copy-to=my-custom-dbg --image=debian --set-image=api=api:v2,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 name. P... |
Forward traffic from port 5000 on your local machine to port 9090 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5000: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 a... |
Listen on port 8080 on all addresses and forward the traffic to port 5432 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8080:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/kube-system-config 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 def... |
Forward local port 8081 to port 8888 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 8081 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 au... |
Forward local port 8081 to port 3000 in the security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8081 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 select... |
Attach to the log-aggregator-pod and select the default-container for output. | Command:
```bash
kubectl attach log-aggregator-pod
```
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 kube... |
Create a new ClusterIP service named payment-service-clusterip that maps port 9091 to port 27017. | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=27017: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... |
Forward traffic from port 5432 on all addresses to port 5000 in the pod named 'mypod' | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 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 sel... |
Create a cluster role named "reader" with specific resource names and permissions | Command:
```bash
kubectl create clusterrole reader --verb=proxy --resource=services --resource-name=cdn-proxy --resource-name=file-uploader
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|no... |
Set a custom TLS server name for validation in the "edge-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=galaxy-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifica... |
Import the 'debug_mode' key from the 'app-secrets' config map to the 'web-app-deployment' deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/app-secrets 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 ... |
Copy the local file "/tmp/foo" to the remote pod "kube-proxy/payment-gateway-pod-19" in the default namespace, and save it as "/tmp/bar" in the pod. | Command:
```bash
kubectl cp /tmp/foo kube-proxy/payment-gateway-pod-19:/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 ... |
Delete both the pod and service with the name "auth", as well as the pod and service with the name "foo". | Command:
```bash
kubectl delete pod,service auth foo
```
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.
Some r... |
Partially update the node 'testing-node-11' by applying a strategic merge patch specified as a JSON | Command:
```bash
kubectl patch node testing-node-11 -p '{"spec":{"rules":[{"http":{"paths":[{"path":"/","backend":{"service": {"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.
Syntax:
`kubec... |
display the last 12 lines of logs for the payment-gateway-pod pod | Command:
```bash
kubectl logs --tail=12 payment-gateway-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", "shor... |
Partially update the 'worker-node-3' node by specifying the patch in YAML format. Set the number of replicas to 3. | Command:
```bash
kubectl patch node worker-node-3 -p $'spec:\n 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 kube config file from your local machine to a specific container in a remote pod. | Command:
```bash
kubectl cp ~/.config/kube cache-pod-5::/tmp/bar -c image-resizer
```
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 th... |
Scale the deployment named staging-app-rs to 1 replica if its current size is 5 | Command:
```bash
kubectl scale --current-replicas=5 --replicas=1 deployment/staging-app-rs
```
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-vers... |
Set the environment variable 'DEBUG' to 'true' for the 'mydeployment' deployment | Command:
```bash
kubectl set env deployment/mydeployment DEBUG=true
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replicat... |
Output the modified 'gateway-deployment' deployment in YAML format with the 'CACHE_SIZE' environment variable set to '64MB', without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/gateway-deployment CACHE_SIZE=64MB -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 templat... |
Copy the local file "/tmp/foo" to the remote pod "default/load-balancer-pod-9" in the "/tmp/bar" directory. | Command:
```bash
kubectl cp :/tmp/foo default/load-balancer-pod-9:/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 job named 'scaling-job' using the 'alpine' image, and run the command 'ash' within the job. | Command:
```bash
kubectl create job scaling-job --image=alpine -- ash
```
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: ... |
Start a pod named "hazelcast" using the "mongo" image, and let the container in the pod expose port 3306 | Command:
```bash
kubectl run hazelcast --image=mongo --port=3306
```
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... |
Begin streaming the logs of the cyber-sleuth container in the monitoring-pod pod | Command:
```bash
kubectl logs -f -c cyber-sleuth monitoring-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "... |
Add a taint with key 'dedicated' on nodes having label team=devops | Command:
```bash
kubectl taint node -l team=devops dedicated=testing-node-11: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 specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/api-config deployment/user-management-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... |
Set the CPU and memory limits of the nginx container in the ubuntu deployment to 50m and 64Mi respectively. | Command:
```bash
kubectl set resources deployment ubuntu -c=nginx --limits=cpu=50m,memory=64Mi
```
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 ... |
Set the resource requests and limits for all containers in the 'wordpress' deployment | Command:
```bash
kubectl set resources deployment wordpress --limits=cpu=200m,memory=512Mi --requests=cpu=200m,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 re... |
Update the pod named 'gateway' with the annotation 'app-version' and set the value to '2.5.1', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods gateway app-version='2.5.1'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and includ... |
Create a deployment named "mattermost" with the "php" image and 6 replicas | Command:
```bash
kubectl create deployment mattermost --image=php --replicas=6
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of:... |
Remove the taint with key 'datacenter' and effect 'NoExecute' from node 'edge-node-10' if it exists | Command:
```bash
kubectl taint nodes edge-node-10 datacenter: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 o... |
Auto scale the 'log-aggregator' replication controller with the number of pods between 1 and 6, targeting a CPU utilization of 40%. | Command:
```bash
kubectl autoscale rc log-aggregator --max=6 --cpu-percent=40
```
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 th... |
Retrieve the snapshot logs from container monitoring-pod-1 of the deployment proxy-service-deployment. | Command:
```bash
kubectl logs deployment/proxy-service-deployment -c monitoring-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:
"f... |
Set the resource limits and requests for all containers in the 'centos' deployment | Command:
```bash
kubectl set resources deployment centos --limits=cpu=200m,memory=512Mi --requests=cpu=200m,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 request... |
Forward all traffic from port 9090 on all addresses to port 3000 in the mypod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 9090: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... |
Forward local port 8000 to port 8000 in the pod and listen for incoming traffic | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8000 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Forward local port 8088 to port 8000 in the pod 'web-app-pod' | Command:
```bash
kubectl port-forward pod/web-app-pod 8088: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 automa... |
Import the SECRET_KEY key from the monitoring-config config map and set it as an environment variable in the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/monitoring-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 var... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.