prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create an ingress that directs requests to a specific service with HTTPS support | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="testing.com/module=svc1:8081,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 3000 on all addresses to port 9090 in the pod named "chat-app-pod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 3000: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... |
Copy the kube config file from a remote pod to a local directory. | Command:
```bash
kubectl cp kube-proxy/load-balancer-pod-9:~/.config/kube :/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 ... |
Forward local port 9090 to port 8080 in a pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 9090: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 automaticall... |
Forward traffic from port 5432 on all addresses to port 8000 in the pod "chat-app-pod". | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 5432: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... |
Forward traffic from local port 5432 to port 8081 in the pod 'chat-app-pod' | Command:
```bash
kubectl port-forward pod/chat-app-pod 5432:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Set the CPU and memory limits for a container in a deployment. | Command:
```bash
kubectl set resources deployment node -c=nginx --limits=cpu=500m,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 i... |
Create an ingress with a rule that directs requests to a specified service at a specific path and port, using a TLS secret. | Command:
```bash
kubectl create ingress private-api-ingress --rule="testing.com/example=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": "... |
Copy /tmp/foo_dir from a remote pod to :/tmp/bar locally. | Command:
```bash
kubectl cp kube-public/security-scanner-pod-18:/tmp/foo_dir :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Retrieve the logs of the previous terminated 'warp-drive' container from the 'proxy-server-pod' pod. | Command:
```bash
kubectl logs -p -c warp-drive proxy-server-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "... |
Create a cron job named 'system-health-check' that runs the command 'mongo' every minute using the 'mongo' image. | Command:
```bash
kubectl create cronjob system-health-check --image=mongo --schedule="*/1 * * * *" -- mongo
```
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"... |
Setup port forwarding to forward port 6379 on localhost and IP address 10.19.21.23 to port 5432 in the backend-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 6379:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Listen on port 5000 locally and forward all traffic to the 'frontend-pod' pod's port 3000 | Command:
```bash
kubectl port-forward pod/frontend-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 be selected autom... |
Set basic auth credentials for the "web-app" entry | Command:
```bash
kubectl config set-credentials web-app --username=admin --password=uXFGweU9l35qcif
```
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
Bea... |
Create a single ingress called 'app1-ingress' that directs requests to site.com/input to svc # svc1:8080 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/input=svc1:8080,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": ... |
Update the container images of a deployment to specific versions. | Command:
```bash
kubectl set image deployment/redis busybox=busybox redis=redis:6.2.5
```
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 ... |
Execute the 'mongo' command in the 'rocket-ranger' container within the 'database-pod' pod to interact with the MongoDB database. | Command:
```bash
kubectl exec database-pod -c rocket-ranger -- mongo
```
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... |
Start streaming the logs of the 'lunar-launcher' container in the 'proxy-server-pod' pod. | Command:
```bash
kubectl logs -f -c lunar-launcher proxy-server-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container... |
Delete pods and services with names "media-stream" and "frontend" | Command:
```bash
kubectl delete pod,service media-stream frontend
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label sel... |
Create a new config map named env-vars with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap env-vars --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map b... |
Forward port 8088 on localhost and IP 10.19.21.23 to port 5432 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 8088:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cr... |
Add a taint with the key 'app' and the value 'backup-node-14:PreferNoSchedule' on nodes having the label 'region=eu-west-2' | Command:
```bash
kubectl taint node -l region=eu-west-2 app=backup-node-14: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 SECRET_KEY key from the app-config ConfigMap and set it as an environment variable in the notification-handler-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-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 variable def... |
Switch to raw terminal mode and attach to the 'nebula-navigator' container in the 'e-commerce-pod' pod. | Command:
```bash
kubectl attach e-commerce-pod -c nebula-navigator -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... |
Forward local port 6379 to port 8080 in the pod named "api-service-pod", allowing local access to the pod's service. | Command:
```bash
kubectl port-forward pod/api-service-pod 6379 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 au... |
List the replication controller named "web", the service named "e-commerce-rc", and the pod named "analytics-pod". | Command:
```bash
kubectl get rc/web service/e-commerce-rc pods/analytics-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 namespace... |
Create an ingress rule named 'api-ingress' that maps requests for 'site.com/module' to service 'svc1' on port 8083 | Command:
```bash
kubectl create ingress api-ingress --rule="site.com/module=svc1:8083,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": ... |
Annotate the pod 'analytics' with a new description value, overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods analytics description='Web server for marketing site'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be lar... |
Create a new ClusterIP service named 'catalog-service-clusterip' that listens on TCP port 8888 and forwards the traffic to port 9000 | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=8888:9000
```
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"... |
Start a redis pod and expose port 7000 | Command:
```bash
kubectl run hazelcast --image=redis --port=7000
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Create a new NodePort service named "proxy-service-nodeport" that maps port 8082 on the cluster nodes to port 8888 on the service | Command:
```bash
kubectl create service nodeport proxy-service-nodeport --tcp=8082:8888
```
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... |
view the details of revision 1 for the daemonset named "development" | Command:
```bash
kubectl rollout history daemonset/development --revision=1
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or UR... |
Import the 'smtp_server' key from the 'env-vars' ConfigMap into the 'api-server-deployment' deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/env-vars 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 definitions in... |
Expose the ubuntu deployment as a service on port 8443, connecting to the containers on port 818100. | Command:
```bash
kubectl expose deployment ubuntu --port=8443 --target-port=818100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specifi... |
Undo the previous deployment for the 'my-deployment' deployment. | Command:
```bash
kubectl rollout undo deployment/my-deployment
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Retrieve the previous terminated container logs from the 'mycontainer' container in the 'database-pod' pod. | Command:
```bash
kubectl logs -p -c mycontainer database-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... |
Create a role named "admin_role" with the ability to list pods and access specific named resources | Command:
```bash
kubectl create role admin_role --verb=list --resource=pods --resource-name=search-elasticsearch --resource-name=app-worker-1
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=... |
Add a taint with key 'app' on nodes having label release=beta | Command:
```bash
kubectl taint node -l release=beta app=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": "Ou... |
Create a service for the 'alpine' replicated set, which serves on port 5001 and connects to the containers on port 330600 | Command:
```bash
kubectl expose rs alpine --port=5001 --target-port=330600
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Update the pod 'email' by adding or overwriting the annotation 'deployment-script' with the value 'https://example.com/deploy.sh'. | Command:
```bash
kubectl annotate --overwrite pods email deployment-script='https://example.com/deploy.sh'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be l... |
Set the CPU limit to "10" and the memory limit to "128Mi" for the PHP container in the NGINX deployment. | Command:
```bash
kubectl set resources deployment php -c=nginx --limits=cpu=10,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 up to its... |
Output the modified deployment in YAML format, without making any changes to the actual deployment. | Command:
```bash
kubectl set env deployment/user-management-deployment MONGO_URI=mongodb://localhost:27017/mydb -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 defin... |
Create a copy of the "vpn-service-pod" pod with the container "code-explorer" using the "kubectl debug" command | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=debug-image-1 --container=code-explorer -- sh
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by d... |
Retrieve the previous terminated logs of the lunar-launcher container from the frontend-pod pod. | Command:
```bash
kubectl logs -p -c lunar-launcher frontend-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", "... |
Listen locally on port 8888 and forward traffic to port 8080 in the pod | Command:
```bash
kubectl port-forward pod/mypod 8888: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 automaticall... |
Configure autoscaling for the replication controller "proxy" with a target CPU utilization of 20% | Command:
```bash
kubectl autoscale rc proxy --max=3 --cpu-percent=20
```
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 pod disruption budget named replica-set-pdb that will select all pods with the label "tier=frontend" and require a minimum of 9 of them to be available at any point in time | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=tier=frontend --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 ... |
Update the label of pod 'payment' to 'release=v1.0' | Command:
```bash
kubectl label pods payment release=v1.0
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "... |
Set up autoscaling for the 'backend' deployment with a minimum of 4 pods and a maximum of 12 pods. | Command:
```bash
kubectl autoscale deployment backend --min=4 --max=12
```
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... |
Create a debug copy of a pod with all container images changed to Ruby. | Command:
```bash
kubectl debug gateway-pod --copy-to=debug-image-app --set-image=*=ruby
```
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 resour... |
Create a debug copy of the 'auth-service-pod' pod, with all container images changed to 'mongo', named 'debug-image-app'. | Command:
```bash
kubectl debug auth-service-pod --copy-to=debug-image-app --set-image=*=mongo
```
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-api-ingress' that directs requests to 'site.com/module' to the service 'svc1' on port '8082', and use the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress private-api-ingress --rule="site.com/module=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": "", "... |
Create a deployment named "grafana" with the image "hazelcast/hazelcast" | Command:
```bash
kubectl create deployment grafana --image=hazelcast/hazelcast
```
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 on node 'monitoring-node-15' with key 'cpu-type' and effect 'NoSchedule' if it exists | Command:
```bash
kubectl taint nodes monitoring-node-15 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. ... |
Embed the certificate authority data for the my-k8s-cluster cluster entry | Command:
```bash
kubectl config set-cluster my-k8s-cluster --embed-certs --certificate-authority=~/.kube/my-k8s-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... |
Forward data between local port 8000 and the pod's port 6379 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8000 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Set up a custom TLS server name for validation for the "moon-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster moon-cluster --tls-server-name=sun-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate-... |
Add the annotation 'description' with value 'my frontend running nginx' to all pods in the current namespace | Command:
```bash
kubectl annotate pods --all description='my frontend running nginx'
```
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 port 3000 on all addresses to port 8080 in the frontend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-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... |
Launch a raw terminal in the 'cosmic-container' container of the 'email-service-pod' pod, and connect to it interactively. | Command:
```bash
kubectl exec email-service-pod -c cosmic-container -i -t -- bash -il
```
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. ... |
Import specific keys from a config map to a deployment or replica set's environment variables | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/env-vars 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 ... |
Create a copy of the "monitoring-pod", replacing all container images with "wordpress" for debugging purposes | Command:
```bash
kubectl debug monitoring-pod --copy-to=debug-image-app --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 if n... |
Delete the pods and services named "gateway" and "analytics" | Command:
```bash
kubectl delete pod,service gateway analytics
```
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 selecto... |
Set a custom TLS server name for validation of the on-prem-cluster cluster entry | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=testing-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] [--certi... |
Begin streaming the logs of the "astro-container" container in the "payment-gateway-pod" pod. | Command:
```bash
kubectl logs -f -c astro-container 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": "--conta... |
Create a new ExternalName service with the name "external-git-service" and the external name "governmental-demo.gov" | Command:
```bash
kubectl create service externalname external-git-service --external-name governmental-demo.gov
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference se... |
Create a job named "log-processing-job" using the "redis" image, and run the command "redis-server --version" in the created job. | Command:
```bash
kubectl create job log-processing-job --image=redis -- redis-server --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":... |
Update the pod 'media-stream' only if the resource is unchanged from version 1 | Command:
```bash
kubectl annotate pods media-stream description='my frontend running nginx' --resource-version=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 ca... |
Create an ingress named 'public-ingress' with a rule that directs requests for site.com/bar to svc1:3000 and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="site.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": "", "usage": ... |
Remove the taint with key 'datacenter' and effect 'NoExecute' from the node 'app-node-6' if one exists. | Command:
```bash
kubectl taint nodes app-node-6 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 of:... |
import the CONFIG_FILE_PATH key from the config map named 'env-vars' and set it as an environment variable in the 'analytics-platform-deployment' deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/env-vars 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 d... |
Create a pod disruption budget named batch-processing-pdb that will require at least four pods with the app=rails label to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=app=rails --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... |
Create a new NodePort service named log-aggregator-nodeport that maps port 8080 on the cluster to port 9000 on the service. | Command:
```bash
kubectl create service nodeport log-aggregator-nodeport --tcp=8080:9000
```
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", "defaul... |
Forward port 8088 on your local machine to port 8888 in the backend-pod pod | Command:
```bash
kubectl port-forward pod/backend-pod 8088: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... |
Expose a replica set as a service, serving on port 8888 and connecting to containers on port 9091 | Command:
```bash
kubectl expose rs node --port=8888 --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. A... |
import the 'redis_host' key from the 'global-config' config map and set it as an environment variable in the 'mydeployment' deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/global-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 ... |
Forward traffic from local port 8000 to the targetPort of the "https" service port in a pod selected by the "api-service" service. | Command:
```bash
kubectl port-forward service/api-service 8000: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... |
View logs from the first container of a job named "batch-processing-job" | Command:
```bash
kubectl logs job/batch-processing-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": "... |
Create a new NodePort service named web-app-nodeport | Command:
```bash
kubectl create service nodeport web-app-nodeport --tcp=8088:27017
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ""... |
Update the 'load-balancer-deployment' deployment by setting the environment variable REDIS_HOST to 'redis-server' | Command:
```bash
kubectl set env deployment/load-balancer-deployment REDIS_HOST=redis-server
```
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 t... |
Describe all services managed by the 'frontend' replication controller. | Command:
```bash
kubectl describe services frontend
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a... |
Execute command within the backend-service pod to get the version of Geth | Command:
```bash
kubectl exec svc/backend-service -- geth version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Create a new config map named api-config using the file1.txt and file2.txt files from the specified paths as keys instead of file basenames on disk | Command:
```bash
kubectl create configmap api-config --from-file=settings=/path/to/properties/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... |
Copy the directory "/tmp/foo_dir" from the remote pod named "file-server-pod-14" in the "rook-ceph" namespace to the local directory "/tmp/bar_dir". | Command:
```bash
kubectl cp rook-ceph/file-server-pod-14:/tmp/foo_dir /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 t... |
Create a new config map named `namespace-config` and populate it with the specified keys and corresponding file paths. | Command:
```bash
kubectl create configmap namespace-config --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
Execute the command 'java -jar /usr/share/jenkins/jenkins.war' in the nebula-navigator container of the vpn-service-pod pod | Command:
```bash
kubectl exec vpn-service-pod -c nebula-navigator -- 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": "", "u... |
Update the password of a node using a strategic merge patch in a YAML format | Command:
```bash
kubectl patch node node-1 -p $'stringData:\n password: new-password'
```
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]`
Help... |
Forward traffic from port 8081 on all addresses to port 5000 in the "e-commerce-pod" pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8081: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 wi... |
Forward port 5432 on localhost and selected IP to port 8088 in the pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 p... |
Retrieve the output from running the 'npm --version' command on the first container of the first pod of the 'scheduler-app-deployment' deployment. | Command:
```bash
kubectl exec deploy/scheduler-app-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 omit... |
Set the 'expiration-date' annotation to '2024-12-31' on the 'auth' pod. | Command:
```bash
kubectl annotate pods auth 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 include arbi... |
Auto scale the deployment "frontend" with a minimum of 3 pods and a maximum of 12 pods. | Command:
```bash
kubectl autoscale deployment frontend --min=3 --max=12
```
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 use... |
Create a new ingress called 'app-loadbalancer-ingress' with a rule that directs requests from website.com/input to svc1:8083 | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/input=svc1:8083,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"... |
Create a secret from an environment file | Command:
```bash
kubectl create secret generic gcp-service-account-secret --from-env-file=path/to/options.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 t... |
Create a priority class named 'external-priority' with a value of 5, a description of "Priority for external-facing services", and a preemption policy of "Never". | Command:
```bash
kubectl create priorityclass external-priority --value=5 --description="Priority for external-facing services" --preemption-policy="Never"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VALUE ... |
Create a job named 'report-generation-job' using the 'ethereum/client-go' image and execute the command 'geth attach' | Command:
```bash
kubectl create job report-generation-job --image=ethereum/client-go -- geth attach
```
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": "", "us... |
Auto scale the "payment" deployment with a range of 2 to 11 pods. | Command:
```bash
kubectl autoscale deployment payment --min=2 --max=11
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Retrieve the output from running the 'node --version' command in the rocket-ranger container of the chat-app-pod pod. | Command:
```bash
kubectl exec chat-app-pod -c rocket-ranger -- node --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 omitt... |
Create a new config map named monitoring-config in the current namespace | Command:
```bash
kubectl create configmap monitoring-config --from-file=properties=/path/to/data/file1.txt --from-file=key1=/path/to/parameters/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 creat... |
Execute the 'go' command in the quantum-quark container of the web-app-pod pod and get the output. | Command:
```bash
kubectl exec web-app-pod -c quantum-quark -- 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 the k... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.