prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new NodePort service named payment-gateway-nodeport that maps port 5000 on the node to port 5432 on the service. | Command:
```bash
kubectl create service nodeport payment-gateway-nodeport --tcp=5000:5432
```
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", "defau... |
Auto scale the replication controller "foo" with a target CPU utilization of 50% and a maximum of 7 pods. | Command:
```bash
kubectl autoscale rc foo --max=7 --cpu-percent=50
```
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... |
Create a service for a Hazelcast deployment, with the service serving on port 3001 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=3001 --target-port=800000
```
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... |
Create a new config map named kube-system-config with the specified keys and corresponding file paths | Command:
```bash
kubectl create configmap kube-system-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
Set the CPU limit for the 'nginx' container in the 'centos' deployment to "50m" and the memory limit to "4Gi". | Command:
```bash
kubectl set resources deployment centos -c=nginx --limits=cpu=50m,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to i... |
remove the pods and services named 'foo' | Command:
```bash
kubectl delete pod,service foo foo
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
Some re... |
Forward traffic from port 8888 on all addresses to port 8080 in the pod "mypod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 sel... |
Update the image of all containers in the 'development' daemonset to 'node:14.17.3' | Command:
```bash
kubectl set image daemonset development *=node:14.17.3
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
... |
Create a copy of the mypod pod with a debug container and changes to container images | Command:
```bash
kubectl debug mypod -it --copy-to=debug-image-memcached --image=debian --set-image=database=mysql:5.7,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and... |
Create a copy of the 'cdn-service-pod' pod and add a 'debug' container to it | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=my-custom-dbg --image=debian --set-image=proxy=nginx:1.21,web=nginx:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and... |
Create a single ingress called 'api-ingress' that directs requests to 'testing.com/bar' to the 'svc1:9092' service with the 'my-cert' TLS secret | Command:
```bash
kubectl create ingress api-ingress --rule="testing.com/bar=svc1:9092,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 deployment named "grafana" using the "mcr.microsoft.com/dotnet/core/runtime" image and expose port 8083 | Command:
```bash
kubectl create deployment grafana --image=mcr.microsoft.com/dotnet/core/runtime --port=8083
```
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": "", "u... |
Get the version of Ruby running on the quantum-quark container in the gateway-pod pod. | Command:
```bash
kubectl exec gateway-pod -c quantum-quark -- ruby --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 omitte... |
Get the output from running the 'elasticsearch' command inside the first container of the pod 'api-service-pod' | Command:
```bash
kubectl exec api-service-pod -- elasticsearch
```
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 kub... |
Execute the command 'nginx -t' inside the 'monitoring-pod' pod, specifically in the 'lunar-launcher' container and display the output. | Command:
```bash
kubectl exec monitoring-pod -c lunar-launcher -- nginx -t
```
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,... |
Get the output from running the 'docker run ubuntu echo "Hello, World"' command in the 'cosmic-container' from the pod 'mypod' | Command:
```bash
kubectl exec mypod -c cosmic-container -- docker run ubuntu echo "Hello, World"
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Conta... |
Start forwarding local port 5000 to port 9090 in the pod named api-service-pod | Command:
```bash
kubectl port-forward pod/api-service-pod 5000 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Attach an interactive raw terminal to the nano-bot container in the mypod pod. | Command:
```bash
kubectl attach mypod -c nano-bot -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 omitted, use the... |
Copy the local kube configuration file to the /etc/kubernetes directory of a remote pod in the prometheus namespace. | Command:
```bash
kubectl cp ~/.config/kube prometheus/cache-pod-5:/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, use th... |
Create a deployment named logging that runs the php image with 7 replicas. | Command:
```bash
kubectl create deployment logging --image=php --replicas=7
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: js... |
Create a cluster role named "custom_role" with the verb "use" and the non-resource URL "/debug/pprof/*" specified. | Command:
```bash
kubectl create clusterrole "custom_role" --verb=use --non-resource-url=/debug/pprof/*
```
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": "--outpu... |
Copy the local file /tmp/foo to the /etc/kubernetes directory in the remote pod named monitoring/logging-agent-pod-7 in the namespace. | Command:
```bash
kubectl cp /tmp/foo monitoring/logging-agent-pod-7:/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, use ... |
Check if you have the permission to list jobs in the "monitoring" namespace, specifically for the job named "content-import-job" | Command:
```bash
kubectl auth can-i list jobs.batch/content-import-job -n monitoring
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial ... |
Retrieve the snapshot logs from container 'cdn-service-pod-1' in the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c cdn-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... |
Update the pod named 'foo' with the annotation 'SLA' and the value '99.9% uptime', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite pods foo 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 arb... |
Check if you have permission to list the job named "security-scan-job" in the namespace "kube-node-lease" | Command:
```bash
kubectl auth can-i list jobs.batch/security-scan-job -n kube-node-lease
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a part... |
Taint nodes with specific label | Command:
```bash
kubectl taint node -l owner=john-doe cpu-type=dev-node-4: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": "... |
Execute a command inside a specific container in a deployment and retrieve the output | Command:
```bash
kubectl exec deploy/web-app-deployment -- /bin/bash -c "echo 'Hello, Amazon Linux'"
```
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": "C... |
Create a service for the nginx deployment, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose deployment nginx --port=8084 --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 specifie... |
Create a config map named namespace-config using specified keys and file paths | Command:
```bash
kubectl create configmap namespace-config --from-file=conf=/path/to/data/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a con... |
Create an ingress called 'website-ingress' that directs requests to testing.com/bar to svc1:8000. Use the TLS secret "my-cert". | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/bar=svc1:8000,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... |
Embed certificate authority data for the data-cluster cluster entry. | Command:
```bash
kubectl config set-cluster data-cluster --embed-certs --certificate-authority=~/.kube/on-prem-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 ... |
Import specific keys from a config map to a deployment's environment variables. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/app-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 definit... |
Create a service for a replication controller based on the configuration specified in "node-controller.yaml", serving on port 9091 and connecting to the containers on port 808800. | Command:
```bash
kubectl expose -f node-controller.yaml --port=9091 --target-port=808800
```
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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/ui-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 variable defini... |
Create a pod named "hazelcast" using the "wordpress" image, and expose the container port 3000. | Command:
```bash
kubectl run hazelcast --image=wordpress --port=3000
```
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": "... |
Add a taint to nodes with the label 'role=database' using the key 'hardware' and the value 'backup-node-14' with the effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l role=database hardware=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"... |
Copy the local directory ~/.config/kube_dir to the remote pod load-balancer-pod-9 in the /etc/kubernetes_dir directory. | Command:
```bash
kubectl cp ~/.config/kube_dir load-balancer-pod-9:/etc/kubernetes_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, u... |
Forward local port 5432 to port 3000 in the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-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 be selected... |
Add a taint with the key 'cpu-type' and value 'web-node-8:PreferNoSchedule' on nodes that have the label 'myLabel'. | Command:
```bash
kubectl taint node -l myLabel cpu-type=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": "Output ... |
Retrieve the environment variables defined on the 'backend-microservice-deployment' deployment | Command:
```bash
kubectl set env deployment/backend-microservice-deployment --list
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (... |
Create a new config map named "app-name-config" using specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/options/file1.txt --from-file=data=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a c... |
Embed the client certificate data located at "~/.kube/admin.crt" in the "app-operator" entry. | Command:
```bash
kubectl config set-credentials app-operator --client-certificate=~/.kube/admin.crt --embed-certs=true
```
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 --cli... |
Import the 'REDIS_HOST' key from the 'monitoring-config' ConfigMap into the 'web-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/monitoring-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 definitio... |
Retrieve the snapshot logs from the container named proxy-service-pod-1 within the load-balancer-deployment deployment. | Command:
```bash
kubectl logs deployment/load-balancer-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:... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/ui-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... |
Forward port 8080 on localhost and IP address 10.19.21.23 to port 8888 in the e-commerce-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 8080: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 crit... |
Import the specific keys 'secret_key' from the config map 'kube-system-config' and set them as environment variables for the deployment named 'mydeployment'. | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/kube-system-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... |
Execute the 'python' command in the 'code-explorer' container of the 'e-commerce-pod' pod and display the output. | Command:
```bash
kubectl exec e-commerce-pod -c code-explorer -- python
```
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, us... |
Forward all traffic from port 8888 on all addresses to port 5000 in the 'chat-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/chat-app-pod 8888: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... |
Begin streaming the logs of the "lunar-launcher" container in the "chat-app-pod" pod | Command:
```bash
kubectl logs -f -c lunar-launcher chat-app-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 service for the nginx replication controller specified in the "nginx-controller.yaml" file, which serves on port 8081 and connects to the containers on port 808100 | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=8081 --target-port=808100
```
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 ... |
Dump the namespaces default and kube-system to the directory /path/to/cluster-state | Command:
```bash
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state
```
What it does:
Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-dire... |
Update the pod 'web' by adding/overwriting the annotation 'env' with the value 'staging' | Command:
```bash
kubectl annotate --overwrite pods web env='staging'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrar... |
Forward traffic from port 9090 on localhost and IP 10.19.21.23 to port 5000 in the pod named chat-app-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 9090: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 criter... |
Create a new ClusterIP service named inventory-service-clusterip | Command:
```bash
kubectl create service clusterip inventory-service-clusterip --tcp=9090:7000
```
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": "-... |
Forward local port 8080 to port 5432 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-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 will be selected... |
Retrieve the logs of the previous terminated Ruby container within the pod named "e-commerce-pod" | Command:
```bash
kubectl logs -p -c ruby e-commerce-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": ... |
Create a new config map named app-config with the specified keys and file paths | Command:
```bash
kubectl create configmap app-config --from-file=settings=/path/to/settings/file1.txt --from-file=key2=/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 co... |
Set the service account for a deployment to a specified account | Command:
```bash
kubectl set serviceaccount deployment notification-handler-deployment my-service-account
```
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), stateful... |
Create a new ClusterIP service named auth-service-clusterip with a TCP port mapping from 8089 to 27017 | Command:
```bash
kubectl create service clusterip auth-service-clusterip --tcp=8089:27017
```
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 pod 'payment' by setting the annotation 'custom-label' to 'my-custom-value', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite pods payment 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... |
Create an ingress called 'private-service-ingress' that directs requests to 'site.com/module' to a service called 'svc1' on port '8088' using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress private-service-ingress --rule="site.com/module=svc1:8088,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": "... |
Expose a Ruby deployment as a service, serving on port 8082 and connecting to the containers on port 9090 | Command:
```bash
kubectl expose deployment ruby --port=8082 --target-port=909000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified... |
Create a pod disruption budget named critical-services-pdb that will select all pods with the env=production label and require at least 9 of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget critical-services-pdb --selector=env=production --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-avail... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/global-config deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defini... |
List deployments in JSON output format in a specific version of the API group | Command:
```bash
kubectl get deployments.custom-version.alpha-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced ... |
Create a job that runs a specific command using a specified image | Command:
```bash
kubectl create job scaling-job --image=ruby -- ruby --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format.... |
Embed the certificate authority data for the kube-cluster-1 cluster entry using the command 'kubectl config set-cluster kube-cluster-1 --embed-certs --certificate-authority=~/.kube/cluster-gamma/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster kube-cluster-1 --embed-certs --certificate-authority=~/.kube/cluster-gamma/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 ... |
Create a single ingress named 'web-ingress' that directs requests for the path '/input' on the 'website.com' domain to the service 'svc1' running on port 9090 | Command:
```bash
kubectl create ingress web-ingress --rule="website.com/input=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": "", "usage"... |
Set the cluster field to cluster-gamma for the my-context context | Command:
```bash
kubectl config set contexts.dev-context.cluster cluster-gamma
```
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 a service named "frontend" to expose the pod "e-commerce-pod", which serves on port 8443 | Command:
```bash
kubectl expose pod e-commerce-pod --port=8443 --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 specific keys from a config map | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/ui-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 variable ... |
Update the expiration date annotation of a pod in "setup.json" | Command:
```bash
kubectl annotate -f setup.json 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 ... |
Update the environment variable QUEUE_NAME to 'task-queue' in the deployment 'notification-handler-deployment' | Command:
```bash
kubectl set env deployment/notification-handler-deployment QUEUE_NAME=task-queue
```
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 ... |
Delete the pods and services named "proxy" and "email" | Command:
```bash
kubectl delete pod,service proxy email
```
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.
Som... |
Create a new job named "indexing" using the "mysql" image, and run the command "mysqld" inside the job container. | Command:
```bash
kubectl create job indexing --image=mysql -- mysqld
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Copy a file from a remote pod to a local directory | Command:
```bash
kubectl cp kube-system/admin-dashboard-pod-16:/tmp/foo /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... |
Get the output from running the 'composer --version' command in the lunar-launcher container of the media-stream-pod pod. | Command:
```bash
kubectl exec media-stream-pod -c lunar-launcher -- composer --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.... |
Create a new config map named app-settings with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-settings --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/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 creati... |
Create a deployment named 'monitoring' using the 'ethereum/client-go' image and expose port 5001 | Command:
```bash
kubectl create deployment monitoring --image=ethereum/client-go --port=5001
```
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 f... |
Create an ingress with a specific rule that directs requests to a service with a specified TLS secret | Command:
```bash
kubectl create ingress public-api-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": "", "usa... |
Forward local port 8080 to port 9090 in the pod named api-service-pod | Command:
```bash
kubectl port-forward pod/api-service-pod 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 selected au... |
Create a cluster role named "view" with non-resource URL specified for watching the swagger UI. | Command:
```bash
kubectl create clusterrole "view" --verb=watch --non-resource-url=/swagger-ui/*
```
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", "s... |
Forward port 8081 on your local machine to port 5000 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward 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 will be selected aut... |
Create a deployment named nats with the redis image and 3 replicas. | Command:
```bash
kubectl create deployment nats --image=redis --replicas=3
```
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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-config-dev 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... |
Create a deployment named 'jenkins' using the 'mcr.microsoft.com/dotnet/core/runtime' image and expose port 8089. | Command:
```bash
kubectl create deployment jenkins --image=mcr.microsoft.com/dotnet/core/runtime --port=8089
```
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": "", "u... |
Forward local port 3000 to port 8000 in the pod "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 3000:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
import the 'REDIS_HOST' key from the 'ui-config' config map and set it as an environment variable in the 'notification-handler-deployment' deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/ui-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 defi... |
Open and edit the 'search-service' service using the 'vi' editor | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/search-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, o... |
Copy /tmp/foo from a remote pod to /tmp/bar locally | Command:
```bash
kubectl cp openfaas/cache-pod-5:/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 kubectl.kuber... |
Add a taint with the key 'special' on nodes having the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app special=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": "Out... |
Show all logs from the pod named 'media-stream-pod' that were written in the last hour | Command:
```bash
kubectl logs --since=1h media-stream-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"... |
Copy a file named "foo" from a remote pod to a local directory named "bar_dir" | Command:
```bash
kubectl cp kube-public/image-resizer-pod-20:/tmp/foo /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... |
Return snapshot logs from the container 'database-deployment-1' of the 'media-stream-pod' deployment. | Command:
```bash
kubectl logs deployment/database-deployment -c media-stream-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:
"flag... |
Add a taint to nodes labeled as 'environment=production' with a key of 'environment' and a value of 'web-node-8:PreferNoSchedule' | Command:
```bash
kubectl taint node -l environment=production environment=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": "",... |
Check if you have the permission to list the job named "content-import-job" in the "kube-public" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/content-import-job -n kube-public
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial... |
Create a job with a specific command to run | Command:
```bash
kubectl create job certificate-renewal --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": "", "usag... |
Retrieve the previous terminated logs of the "quantum-quark" container from the "monitoring-pod" pod. | Command:
```bash
kubectl logs -p -c quantum-quark monitoring-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.