prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a job to run a command inside a container | Command:
```bash
kubectl create job cleanup --image=wordpress -- apache2ctl -D FOREGROUND
```
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": "Out... |
Create a debug copy of the frontend pod, using the debian image for the debug container and changing the container image of the main app container to app:debug. | Command:
```bash
kubectl debug frontend-pod -it --copy-to=debug-image-1 --image=debian --set-image=app=app:debug,app=app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Po... |
Execute the 'go version' command in the stardust-shuttle container of the log-aggregator-pod pod and display the output. | Command:
```bash
kubectl exec log-aggregator-pod -c stardust-shuttle -- go 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 ... |
Import the 'config_file_path' key from the 'app-config' config map into the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-config deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Set the custom TLS server name "app-cluster" for validation of the cluster-beta cluster entry | Command:
```bash
kubectl config set-cluster cluster-beta --tls-server-name=app-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-... |
Setup autoscaling for replication controller "api" with a target CPU utilization of 60%, allowing the number of pods to vary between 1 and 6. | Command:
```bash
kubectl autoscale rc api --max=6 --cpu-percent=60
```
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... |
Forward traffic from all addresses on port 9090 to port 9090 in the backend-pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 9090: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 ... |
Forward the local port 8081 to the port 8888 in the pod called "backend-pod" | Command:
```bash
kubectl port-forward pod/backend-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 automa... |
Add a taint with key 'environment' and value 'prod-node-5:PreferNoSchedule' on nodes having label 'service=auth' | Command:
```bash
kubectl taint node -l service=auth environment=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":... |
Create a new ClusterIP service with the name "monitoring-service-clusterip" and map port 3306 of the service to port 8010 on the pods. | Command:
```bash
kubectl create service clusterip monitoring-service-clusterip --tcp=3306:8010
```
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": "... |
List the deployments in the "rc-1.1.0" version of the "backup-apps" API group in JSON output format | Command:
```bash
kubectl get deployments.rc-1.1.0.backup-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 w... |
Update some configuration on a node using a strategic merge patch in JSON format. | Command:
```bash
kubectl patch node k8s-node-1 -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:
`kubectl pa... |
Remove the label named 'component' from the pod 'proxy-server' | Command:
```bash
kubectl label pods proxy-server component-
```
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"... |
Add a 'PreferNoSchedule' taint with the key 'app' on nodes having the label 'instance=app-instance-1' | Command:
```bash
kubectl taint node -l instance=app-instance-1 app=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": "... |
Import the "redis_host" key from the "app-secrets" ConfigMap and set it as an environment variable in the "notification-handler-deployment" deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-secrets deployment/notification-handler-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... |
Embed the certificate authority data for the 'cluster-alpha' cluster entry by running the command 'kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/prod-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster cluster-alpha --embed-certs --certificate-authority=~/.kube/prod-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config se... |
Start streaming the logs of the mycontainer container in the backend-pod pod | Command:
```bash
kubectl logs -f -c mycontainer backend-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... |
Return snapshot logs from the container "backend-microservice-deployment-1" of the "backend-microservice-deployment" deployment. | Command:
```bash
kubectl logs deployment/backend-microservice-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 fl... |
import the CONFIG_FILE_PATH key from the db-config config map and set it as an environment variable in the web-app-deployment deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/db-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 definitions... |
Create a new ClusterIP service named inventory-service-clusterip that maps port 3001 on the service to port 5432 on the target pod. | Command:
```bash
kubectl create service clusterip inventory-service-clusterip --tcp=3001: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": "-... |
Create a new config map named 'global-config' in the current namespace, using the 'properties' key and the contents of the '/path/to/parameters/file1.txt' file, and using the 'key1' key and the contents of the '/path/to/options/file2.txt' file as the values. | Command:
```bash
kubectl create configmap global-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/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 creati... |
Create a new secret named 'cert-manager-secret' with the following keys instead of names on disk: | Command:
```bash
kubectl create secret generic cert-manager-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
```
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 se... |
Set the service account of the deployment "frontend-deployment" to "kube-proxy" | Command:
```bash
kubectl set serviceaccount deployment frontend-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:
`kubect... |
Retrieve information about the 'security-service-pod' pod in JSON format | Command:
```bash
kubectl get -o json pod security-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only... |
Create a deployment named 'drupal' using the 'confluentinc/cp-kafka' image and expose port 9000 | Command:
```bash
kubectl create deployment drupal --image=confluentinc/cp-kafka --port=9000
```
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 fo... |
Update the annotation of the pod 'log-aggregator' with the annotation 'SLA' and the value '99.9% uptime'. | Command:
```bash
kubectl annotate pods log-aggregator SLA='99.9% uptime'
```
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 arbi... |
Retrieve the output of the command 'npm --version' from the first running container in the 'database-deployment' deployment | Command:
```bash
kubectl exec deploy/database-deployment -- npm --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Create a service named "frontend" for the pod "monitoring-pod" serving on port 444 | Command:
```bash
kubectl expose pod monitoring-pod --port=5001 --name=frontend
```
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 p... |
Import the redis_host key from the global-config config map and set it as an environment variable in the payment-processor-deployment deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/global-config deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Update the pod 'web' by adding the annotation 'security-scan-status' with the value 'pass'. | Command:
```bash
kubectl annotate pods web security-scan-status=pass
```
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 arbitrar... |
Embed the certificate authority data for the 'sun-cluster' cluster entry by running the command: "kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster sun-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/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... |
Create a deployment named "jenkins" with the "mysql" image and expose port 9092 | Command:
```bash
kubectl create deployment jenkins --image=mysql --port=9092
```
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... |
Create a single ingress called 'public-service-ingress' that directs requests to website.com/module to svc1:9000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/module=svc1:9000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default":... |
Listen on port 5432 on all addresses and forward traffic to port 3000 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 5432: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... |
Create a new config map named app-secrets, using the files file1.txt and file2.txt for the keys conf and data respectively. | Command:
```bash
kubectl create configmap app-secrets --from-file=conf=/path/to/configs/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 config... |
Create a job for batch-processing using the centos image and run the bash command. | Command:
```bash
kubectl create job batch-processing --image=centos -- bash
```
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. On... |
Run the 'jenkins-plugin-cli' command in the cosmic-container container of the analytics-pod pod and print the output. | Command:
```bash
kubectl exec analytics-pod -c cosmic-container -- 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. ... |
Create a deployment named monitoring using the alpine image and expose port 3000 | Command:
```bash
kubectl create deployment monitoring --image=alpine --port=3000
```
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 a service for the node deployment, which serves on port 8088 and connects to the containers on port 801000. | Command:
```bash
kubectl expose deployment node --port=8088 --target-port=801000
```
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 local port 8081 to port 8080 in the pod | Command:
```bash
kubectl port-forward pod/web-app-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 criteria, a pod will be selected automa... |
Start streaming the logs of the 'cyber-sleuth' container in the 'gateway-pod' pod | Command:
```bash
kubectl logs -f -c cyber-sleuth 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", "sho... |
Add a taint with key 'environment' on nodes having label component=proxy | Command:
```bash
kubectl taint node -l component=proxy environment=kube-master-9: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... |
Set up port forwarding from port 5432 on all addresses to port 6379 in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 5432: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 po... |
Start port forwarding from local port 8080 to port 5000 of a pod selected by the mydeployment deployment. | Command:
```bash
kubectl port-forward deployment/mydeployment 8080 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... |
Retrieve the logs from all containers in pods that have the label "stack=tech-stack" | Command:
```bash
kubectl logs -l stack=tech-stack --all-containers=true
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--conta... |
List the deployments in the "v1.0.0" version of the "my-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.v1.0.0.my-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 on... |
Disable certificate checking for the cluster entry named cluster-beta | Command:
```bash
kubectl config set-cluster cluster-beta --insecure-skip-tls-verify=true
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificat... |
Autoscale the "email" deployment with a minimum of 4 pods and a maximum of 9 pods. | Command:
```bash
kubectl autoscale deployment email --min=4 --max=9
```
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 th... |
create a service for the 'php' deployment, which serves on port 8088 and connects to the containers on port 543200 | Command:
```bash
kubectl expose deployment php --port=8088 --target-port=543200
```
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 ... |
Execute the command 'java -jar /usr/share/jenkins/jenkins.war' within the container named 'time-machine' in the 'frontend-pod' pod and get the output. | Command:
```bash
kubectl exec frontend-pod -c time-machine -- 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": "", "usage": ... |
Forward traffic from port 8080 on all addresses to port 5432 in the proxy-server-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 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 ... |
Set the CPU and memory limits for the Hazelcast container in the deployment to "500m" and "128Mi" respectively. | Command:
```bash
kubectl set resources deployment hazelcast -c=nginx --limits=cpu=500m,memory=128Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst u... |
Update the 'proxy' pod by adding or updating the annotation 'scaling-policy' with the value 'auto-horizontal-scaling'. | Command:
```bash
kubectl annotate --overwrite pods proxy scaling-policy='auto-horizontal-scaling'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger tha... |
Copy the ~/.config/kube file from a remote pod to the /etc/kubernetes directory locally. | Command:
```bash
kubectl cp argocd/load-balancer-pod-9:~/.config/kube /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Create a cluster role named "foo" with the specified NonResourceURL | Command:
```bash
kubectl create clusterrole "foo" --verb=watch --non-resource-url=/attach/*
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short"... |
Execute the command 'pip --version' on the first container of the first pod of the 'gateway-service' service. | Command:
```bash
kubectl exec svc/gateway-service -- pip --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... |
Listen on a random port locally, forwarding to port 8080 in the pod 'proxy-server-pod' | Command:
```bash
kubectl port-forward pod/proxy-server-pod :8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Expose a replication controller named "ruby" as a service, listening on port 8181 and connecting to containers on port 543200. | Command:
```bash
kubectl expose rc ruby --port=8181 --target-port=543200
```
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. A... |
Listen on port 5000 on all addresses and forward the traffic to port 3000 in the chat-app-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 5000: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... |
List all deployments in the "internal-apps" API group with the label "feature-branch-2.3.0" and display the output in JSON format. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.internal-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 na... |
Remove exec auth plugin environment variables for the "app-service" entry | Command:
```bash
kubectl config set-credentials app-service --exec-env=var-to-remove-
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token flag... |
Add a taint with the key 'cpu-type' and no value to the node 'dev-node-4' | Command:
```bash
kubectl taint nodes dev-node-4 cpu-type:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Forward port 5432 on all addresses to port 8080 in the pod named 'chat-app-pod' | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 5432:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will... |
Start a Kafka pod with specific labels | Command:
```bash
kubectl run hazelcast --image=confluentinc/cp-kafka --labels="app=kafka,env=prod"
```
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.... |
Execute the 'wp' command on the first pod of the 'user-service' service. | Command:
```bash
kubectl exec svc/user-service -- 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.kuber... |
Add a taint with key 'workload' on nodes having label service=auth | Command:
```bash
kubectl taint node -l service=auth workload=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": "Ou... |
Scale the deployment named "payment-service-rs" to have 7 replicas, assuming the current size is 1. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=7 deployment/payment-service-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-... |
Listen on port 5432 locally, forwarding data to/from port 8080 in the pod "security-service-pod". | Command:
```bash
kubectl port-forward pod/security-service-pod 5432 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Create a new secret named 'git-credentials-secret' in the default namespace from the specified files 'path/to/id_rsa' and 'path/to/id_rsa.pub' | Command:
```bash
kubectl create secret generic git-credentials-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
```
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... |
Create an ingress with a rule that directs requests to a specific service and port, and include a tls secret for SSL encryption. | Command:
```bash
kubectl create ingress api-gateway-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": "", "us... |
Import the SECRET_KEY key from the app-name-config config map into the database-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-name-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 definition... |
Create a new secret named tls-certificate-secret from an environment file | Command:
```bash
kubectl create secret generic tls-certificate-secret --from-env-file=path/to/configs.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to th... |
Start a pod named "hazelcast" using the "node" image and expose port 8082. | Command:
```bash
kubectl run hazelcast --image=node --port=8082
```
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... |
Update the cluster field in the 'my-context' context to 'star-cluster' | Command:
```bash
kubectl config set contexts.edge-context.cluster star-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you wan... |
Create an ingress called 'service-ingress' that directs requests to 'foo.com/example' to 'svc1:6379' using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="foo.com/example=svc1:6379,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Create a debug container in a copy of the frontend-pod, and change the container images | Command:
```bash
kubectl debug frontend-pod -it --copy-to=debug-image-api --image=debian --set-image=proxy=nginx:1.21,proxy=nginx:1.21
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and ... |
Retrieve the snapshot logs from the container "proxy-service-pod-1" in the deployment "api-server-deployment". | Command:
```bash
kubectl logs deployment/api-server-deployment -c proxy-service-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... |
Forward data between local port 8088 and pod port 9090 for the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8088 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
import specific keys from a config map for a deployment in the monitoring stack | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/global-config deployment/monitoring-stack-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Add a taint with the key 'special' on nodes having the label service=auth, and set the taint value to monitoring-node-15:PreferNoSchedule | Command:
```bash
kubectl taint node -l service=auth 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": "", "usag... |
Import the 'max_connections' key from the 'log-config' config map to the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/log-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 defin... |
Edit the job 'image-processing-job' in JSON format using the v1 API format. | Command:
```bash
kubectl edit job.v1.batch/image-processing-job -o json
```
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 variab... |
create a service for a replication controller based on the specifications provided in "python-controller.yaml", serving on port 8082 and connecting to the containers on port 637900 | Command:
```bash
kubectl expose -f python-controller.yaml --port=8082 --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... |
Create a service for the 'hazelcast' deployment, which serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=9000 --target-port=900000
```
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... |
Rename the context 'old-name' to 'app-1-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context old-name app-1-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will also be up... |
Remove all taints with key 'app' from node 'dev-node-4' | Command:
```bash
kubectl taint nodes dev-node-4 app-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|g... |
Apply a taint with the key 'disktype=db-node-7' on nodes that have the label namespace=mynamespace. | Command:
```bash
kubectl taint node -l namespace=mynamespace disktype=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... |
Start a ruby pod with custom spec values from JSON | Command:
```bash
kubectl run nginx --image=ruby --overrides='{ "apiVersion": "v3.0.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND]... |
Copy the file "foo" from the remote pod "image-resizer-pod-20" and save it as "bar" locally in the "/tmp" directory | Command:
```bash
kubectl cp argocd/image-resizer-pod-20:/tmp/foo :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubec... |
Show the CPU and memory usage for the pods with the label environment=production | Command:
```bash
kubectl top pod -l environment=production
```
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 ... |
Remove the 'bar' label from the pod named 'auth' | Command:
```bash
kubectl label pods auth component-
```
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 tr... |
Create a single ingress called 'public-api-ingress' that directs requests to site.com/module to svc1:9090 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress public-api-ingress --rule="site.com/module=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": "", "u... |
Create a single ingress called 'public-service-ingress' that directs requests to website.com/example to the service named `svc1` on port `8082`, and use the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/example=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"... |
Forward traffic from port 8888 on all addresses to port 6379 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 8888: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 ... |
import the CONFIG_FILE_PATH key from the monitoring-config ConfigMap into the environment variables of the notification-handler-deployment deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/monitoring-config deployment/notification-handler-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... |
Copy the local file "/tmp/foo_dir" to the remote pod named "metrics-exporter-pod-10" in the "kube-public" namespace | Command:
```bash
kubectl cp /tmp/foo_dir kube-public/metrics-exporter-pod-10:/tmp/bar_dir
```
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... |
Set the cluster field in the 'my-context' context to 'sun-cluster' | Command:
```bash
kubectl config set contexts.edge-context.cluster sun-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you want... |
Create a new ingress called 'app2-ingress' with a rule that directs requests from 'website.com/input' to 'svc1:8443' | Command:
```bash
kubectl create ingress app2-ingress --rule="website.com/input=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... |
Add a taint with the key 'dedicated' and value 'testing-node-11:PreferNoSchedule' on all nodes that have the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend 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": "", "usag... |
Create a copy of the cdn-service-pod pod with a debug container | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=logger=logging-app:debug,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 ident... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.