prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Add a taint to nodes with a specific label | Command:
```bash
kubectl taint node -l myLabel special=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
Update the environment variables of the 'gateway-deployment' deployment by importing the 'DATABASE_URL' key from the 'app-name-config' config map. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-name-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Add an annotation to a pod, specified in a preferences.json file, with the value 'daily backups' for the backup-strategy key. | Command:
```bash
kubectl annotate -f preferences.json backup-strategy='daily backups'
```
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... |
Forward local port 9090 to the target port of the "https" service port in a pod selected by the "api-service" service. | Command:
```bash
kubectl port-forward service/api-service 9090:https
```
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 job for batch processing with a command | Command:
```bash
kubectl create job batch-processing --image=confluentinc/cp-kafka -- kafka-console-producer --broker-list localhost:9092 --topic test
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"f... |
Disable certificate checking for the specified cluster | Command:
```bash
kubectl config set-cluster moon-cluster --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... |
Get the logs of the previous terminated 'nano-bot' container from the 'gateway-pod' pod. | Command:
```bash
kubectl logs -p -c nano-bot 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", "short":... |
import the "database_url" key from the "log-config" config map and set it as an environment variable in the "authentication-service-deployment" deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/log-config deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Run the 'go' command in the code-explorer container of the cdn-service-pod | Command:
```bash
kubectl exec cdn-service-pod -c code-explorer -- go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use t... |
Begin streaming the logs of the "nebula-navigator" container in the "backend-pod" pod. | Command:
```bash
kubectl logs -f -c nebula-navigator 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", ... |
Update the pod identified by the type and name in "docker-registry.yaml" to have a label status=unhealthy | Command:
```bash
kubectl label -f docker-registry.yaml status=unhealthy
```
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": "fal... |
Import the 'max_connections' key from the 'monitoring-config' ConfigMap into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/monitoring-config 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 va... |
Update the 'backend' pod by adding or updating the annotation 'release-notes' with the value 'https://example.com/release-notes/v2.5.1', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods backend release-notes='https://example.com/release-notes/v2.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... |
Create a golang pod named "hazelcast" using the golang image and configure the container to expose port 5432. | Command:
```bash
kubectl run hazelcast --image=golang --port=5432
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
create a priority class named security-priority with a value of 800 and a description of "Priority for security-critical workloads" | Command:
```bash
kubectl create priorityclass security-priority --value=800 --description="Priority for security-critical workloads"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VALUE --global-default=BOOL [... |
Forward local port 8080 to port 8088 in the pod | Command:
```bash
kubectl port-forward pod/web-app-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 pod will be selected automa... |
Create a deployment named 'auth' using the 'python' image and exposing port 5432. | Command:
```bash
kubectl create deployment auth --image=python --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: jso... |
Display the last 23 lines of logs for the pod named vpn-service-pod | Command:
```bash
kubectl logs --tail=23 vpn-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", "short": ... |
Add a taint with the key 'special' on the nodes that have the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace special=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": "", "us... |
import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/api-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Set the service account of the deployment "log-aggregator-deployment" to "vault" | Command:
```bash
kubectl set serviceaccount deployment log-aggregator-deployment vault
```
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:
`kubec... |
Create a service for the replicated centos, which serves on port 9090 and connects to the containers on port 8080 | Command:
```bash
kubectl expose rc centos --port=9090 --target-port=808000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Display the differences between the configuration in the 'config.json' file and the current state of the cluster. | Command:
```bash
cat config.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... |
Forward traffic from local port 8080 to port 8081 on the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-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 criteri... |
Forward traffic from port 3000 on all addresses to port 5432 in the chat-app-pod pod, by running the command "kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 3000:5432" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 3000: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... |
Retrieve a list of deployments in YAML output format from the "external-apps" API group with the version "stable-2.0.0". | Command:
```bash
kubectl get deployments.stable-2.0.0.external-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... |
Get the output by running the 'irb' command in the 'nano-bot' container from the 'media-stream-pod' pod. | Command:
```bash
kubectl exec media-stream-pod -c nano-bot -- irb
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Create a service for the replication controller specified in "python-controller.yaml" file, which serves on port 8084 and connects to the containers on port 808400. | Command:
```bash
kubectl expose -f python-controller.yaml --port=8084 --target-port=808400
```
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... |
Forward local port 5000 to remote port 9090 in the selected pod of the analytics platform deployment. | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 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 po... |
List all deployments in YAML output format in the "beta-1.0" version of the "prod-apps" API group. | Command:
```bash
kubectl get deployments.beta-1.0.prod-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 wil... |
Set the environment variable for a deployment using keys from a specific config map. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/global-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Add a taint with key 'datacenter' and no value to the node 'web-node-8' | Command:
```bash
kubectl taint nodes web-node-8 datacenter: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:... |
Update the image of all containers in the daemonset named 'staging' to 'wordpress:5.8.1' | Command:
```bash
kubectl set image daemonset staging *=wordpress:5.8.1
```
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:
`... |
Create a copy of the 'email-service-pod' with a debug container and change the container images | Command:
```bash
kubectl debug email-service-pod -it --copy-to=debug-image-app --image=debian --set-image=web=nginx:latest,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 resour... |
Update node 'node-1' with a taint | Command:
```bash
kubectl taint nodes node-1 cpu-type=x86: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... |
Create a job named "report-generation-job" using the Redis image and the command "redis-server". | Command:
```bash
kubectl create job report-generation-job --image=redis -- redis-server
```
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": "Outpu... |
Import specific keys from a config map for a deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/namespace-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 ... |
Create a new config map named log-config using specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap log-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/properties/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... |
Forward all traffic from port 8888 on all addresses to port 8088 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 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 ... |
Set the cpu limits for the 'go' container in the 'nginx' deployment to "100m" and the memory limits to "64Mi" | Command:
```bash
kubectl set resources deployment go -c=nginx --limits=cpu=100m,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 its... |
Create an ingress named 'internal-ingress' with a rule that directs requests for 'foo.com/input' to the 'svc1:6379' service, using the tls secret named "my-cert" | Command:
```bash
kubectl create ingress internal-ingress --rule="foo.com/input=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": "", "usage... |
Create a cluster role named "custom_role" with the verb "use" and the resource "pods" allowed | Command:
```bash
kubectl create clusterrole custom_role --verb=use --resource=pods --resource-name=identity-provider --resource-name=auth-service
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cli... |
Return snapshot logs from container frontend-deployment-1 of a deployment named log-aggregator-pod | Command:
```bash
kubectl logs deployment/frontend-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 flags:
"fl... |
Output modified deployment in YAML, without altering the object on the server. | Command:
```bash
kubectl set env deployment/scheduler-app-deployment JWT_SECRET=your-jwt-secret -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... |
Create a ClusterIP service named ldap-service-clusterip | Command:
```bash
kubectl create service clusterip ldap-service-clusterip --tcp=5432:9090
```
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", "... |
Update the annotation of a pod named 'api' with the key 'custom-label' and the value 'my-custom-value', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods api 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... |
Set the resource request and limits for all containers in the 'runtime' deployment | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=cpu=50m,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 reque... |
Forward local port 8088 to port 8088 in the mypod pod | Command:
```bash
kubectl port-forward pod/mypod 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 automaticall... |
Expose a replicated node as a service | Command:
```bash
kubectl expose rs node --port=3001 --target-port=844300
```
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... |
Run the 'jenkins --version' command in the email-service-pod pod | Command:
```bash
kubectl exec email-service-pod -- jenkins --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 t... |
View the last-applied-configuration annotations of the resource specified in options.yaml file in JSON format. | Command:
```bash
kubectl apply view-last-applied -f options.yaml -o json
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-a... |
Create a config map named namespace-config with specified keys and file paths | Command:
```bash
kubectl create configmap namespace-config --from-file=settings=/path/to/settings/file1.txt --from-file=key2=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creati... |
Expose a replica set named "php" as a service, which listens on port 9091 and forwards traffic to the containers on port 808400. | Command:
```bash
kubectl expose rs php --port=9091 --target-port=808400
```
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 ... |
Create a copy of the gateway-pod pod, adding a debug container and changing the container images | Command:
```bash
kubectl debug gateway-pod -it --copy-to=debug-image-app --image=debian --set-image=app=app:debug,api=api:v2
```
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... |
Get the output from running the 'redis-cli' command on the first container of the first pod of the 'loadbalancer-service' service. | Command:
```bash
kubectl exec svc/loadbalancer-service -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use th... |
Attach to a specific container in a pod and open a raw terminal session. | Command:
```bash
kubectl attach payment-gateway-pod -c warp-drive -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
create a deployment named 'grafana' using the 'centos' image and expose port 3000 | Command:
```bash
kubectl create deployment grafana --image=centos --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 of: ... |
Copy the local file "/tmp/foo" to the remote pod "monitoring-agent-pod-6" in the "kube-node-lease" namespace, at the destination path "/etc/kubernetes". | Command:
```bash
kubectl cp /tmp/foo kube-node-lease/monitoring-agent-pod-6:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Create a new NodePort service named "monitoring-nodeport" that maps port 8081 of the service to port 3306 of the target | Command:
```bash
kubectl create service nodeport monitoring-nodeport --tcp=3306:8081
```
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": ... |
Forward traffic from local port 6379 to port 8000 in the 'database-deployment' pod, selected by the deployment. | Command:
```bash
kubectl port-forward deployment/database-deployment 6379 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 ... |
set resource request and limits for all containers in amazonlinux deployment | Command:
```bash
kubectl set resources deployment amazonlinux --limits=cpu=200m,memory=512Mi --requests=cpu=200m,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 re... |
Get the output from running the 'elasticsearch --version' command in the first container of the first pod of the 'notification-service' service. | Command:
```bash
kubectl exec svc/notification-service -- 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": "Container name. If o... |
View the modified deployment configuration in YAML format without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/payment-processor-deployment DEBUG=true -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 te... |
Forward data between local ports 3000 and pod ports 8080 | Command:
```bash
kubectl port-forward pod/backend-pod 3000 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... |
Listen on port 9090 on localhost and IP 10.19.21.23, and forward the traffic to port 8088 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 9090: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 th... |
Expose a replication controller described in a YAML file as a service on port 8084, connecting to containers on port 808900. | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8084 --target-port=808900
```
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... |
Delete a resource using the configuration specified in a JSON file | Command:
```bash
kubectl delete -f ./options.json
```
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 reso... |
Forward ports locally to a pod selected by a deployment | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 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, ... |
Retrieve information about the replication controller 'web', service 'monitoring-rc', and pod 'frontend-pod' | Command:
```bash
kubectl get rc/web service/monitoring-rc pods/frontend-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... |
Create a cluster role named "foo" with the ability to delete specific pods named "auth-service" and "file-storage" | Command:
```bash
kubectl create clusterrole foo --verb=delete --resource=pods --resource-name=auth-service --resource-name=file-storage
```
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]`... |
Create a copy of the api-service-pod named debug-image-web, replacing all container images with the golang image | Command:
```bash
kubectl debug api-service-pod --copy-to=debug-image-web --set-image=*=golang
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no ... |
Create an ingress called 'private-ingress' that directs requests to testing.com/bar to svc1 on port 3000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress private-ingress --rule="testing.com/bar=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Annotate a specific pod with an expiration date | Command:
```bash
kubectl annotate pods media-stream expiration-date='2024-12-31'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and incl... |
Execute the 'node' command inside the pod 'chat-app-pod' | Command:
```bash
kubectl exec chat-app-pod -- node
```
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.kuberne... |
Import specific keys from a config map into a deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/namespace-config deployment/mydeployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one ... |
Start a proxy to the Kubernetes API server on port 8088, serving static content from the ./local/www/ directory. | Command:
```bash
kubectl proxy --port=8088 --www=./local/www/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote... |
Import specific keys from a config map into the environment variables of a deployment named "email-server-deployment" | Command:
```bash
kubectl set env --keys=SECRET_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 def... |
Forward local port 8000 to port 8081 on the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod 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 will be selected automa... |
Create a copy of the "security-service-pod" and change all the container images to "wordpress". | Command:
```bash
kubectl debug security-service-pod --copy-to=debug-image-1 --set-image=*=wordpress
```
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 ... |
Remove taint from node | Command:
```bash
kubectl taint nodes edge-node-10 workload: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... |
Import the 'SMTP_SERVER' key from the 'app-config-prod' config map into the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-config-prod deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Update the environment variable 'SECRET_KEY' in the deployment 'web-app-deployment' | Command:
```bash
kubectl set env deployment/web-app-deployment SECRET_KEY=your-secret-key
```
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 temp... |
Switch the current context to "cluster-alpha" to work with the cluster. | Command:
```bash
kubectl config use-context cluster-alpha
```
What it does:
Set the current-context in a kubeconfig file.
Syntax:
`kubectl config use-context CONTEXT_NAME` |
Retrieve the previous terminated logs of the container named "nebula-navigator" from the pod named "gateway-pod" | Command:
```bash
kubectl logs -p -c nebula-navigator 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", ... |
Forward local port 3000 to the target port of the "https" service port in a pod selected by the "logging-service" service | Command:
```bash
kubectl port-forward service/logging-service 3000:https
```
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... |
Execute the 'sleep 3600' command in the pod 'vpn-service-pod' using the 'quantum-quark' container and get the output. | Command:
```bash
kubectl exec vpn-service-pod -c quantum-quark -- 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 omitte... |
If the current size of the deployment named 'backend-service-replicaset' is 3, scale the 'mysql' deployment to 5 replicas. | Command:
```bash
kubectl scale --current-replicas=3 --replicas=5 deployment/backend-service-replicaset
```
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 --r... |
Forward local port 8080 to port 9090 in a specific pod selected by the deployment "web-app-deployment" | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8080 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 s... |
Copy the local file "/tmp/foo" from your local machine to the "/tmp/bar_dir" directory inside the pod named "backend-pod-13" in the "kube-node-lease" namespace. | Command:
```bash
kubectl cp :/tmp/foo kube-node-lease/backend-pod-13:/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, use th... |
Retrieve information about the 'web' replication controller, the 'backend-rc' service, and the 'log-aggregator-pod' pods | Command:
```bash
kubectl get rc/web service/backend-rc pods/log-aggregator-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespa... |
Forward local ports 8000 and 6000 to the corresponding ports in a pod selected by the web-app-deployment deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 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 s... |
List the deployments in the "web-apps" API group with the version "custom-version" in YAML output format. | Command:
```bash
kubectl get deployments.custom-version.web-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 yo... |
Create a deployment named sonarqube that runs the redis image with 2 replicas | Command:
```bash
kubectl create deployment sonarqube --image=redis --replicas=2
```
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... |
Create a new job named "testing" using the "mongo" image, and run the "mongo" command within the job | Command:
```bash
kubectl create job testing --image=mongo -- mongo
```
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: jso... |
Retrieve the snapshot logs from the container "proxy-server-pod" of the deployment named "scheduler-app-deployment-1" | Command:
```bash
kubectl logs deployment/scheduler-app-deployment -c proxy-server-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:
... |
Create a deployment called 'registry' with 6 replicas running the 'ubuntu' image | Command:
```bash
kubectl create deployment registry --image=ubuntu --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... |
Copy the contents of /var/run/secrets/kubernetes.io/serviceaccount/ directory from the "argocd/security-scanner-pod-18" pod to the "/tmp/bar_dir" directory on your local machine. | Command:
```bash
kubectl cp argocd/security-scanner-pod-18:/var/run/secrets/kubernetes.io/serviceaccount/ /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"... |
Add a taint to nodes with the label 'instance=app-instance-1' | Command:
```bash
kubectl taint node -l instance=app-instance-1 workload=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Embed certificate authority data for the staging-cluster cluster entry. | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/galaxy-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 confi... |
Copy the local file /tmp/foo_dir to the /etc/kubernetes directory inside the task-processor-pod-17 pod's container with the name 'image-resizer'. | Command:
```bash
kubectl cp /tmp/foo_dir task-processor-pod-17:/etc/kubernetes -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 o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.