prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Start a Jenkins pod named "nginx", using the "jenkins" image | Command:
```bash
kubectl run nginx --image=jenkins --overrides='{ "apiVersion": "custom-version", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-config-dev deployment/backend-microservice-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 variab... |
Import the "log_level" key from the "app-secrets" ConfigMap and set it as an environment variable in the "api-server-deployment" deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-secrets 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 i... |
Update the image of all containers in the 'services' DaemonSet to 'openjdk:16.0.2' | Command:
```bash
kubectl set image daemonset services *=openjdk:16.0.2
```
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:
`... |
Provide a description for the pod specified in the "setup.json" file. | Command:
```bash
kubectl describe -f setup.json
```
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 nam... |
Create a copy of the payment-gateway-pod and change all container images to ruby | Command:
```bash
kubectl debug payment-gateway-pod --copy-to=my-custom-dbg --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 ... |
Add a taint with key 'disktype' on nodes having label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app disktype=db-node-7:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Copy the local file /tmp/foo_dir to the remote pod security-scanner-pod-18 in the ingress-nginx namespace, and place it at /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo_dir ingress-nginx/security-scanner-pod-18:/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, ... |
Forward port 8888 on all addresses to port 8081 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8888: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 po... |
Update the image of all containers in the daemonset 'services' to 'nginx:1.21.3' | Command:
```bash
kubectl set image daemonset services *=nginx:1.21.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:
`ku... |
View the metrics for pods with the label "app=web-app" | Command:
```bash
kubectl top pod -l app=web-app
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl top pod [NAME | -l ... |
Update the pod 'analytics' with the annotation 'description' and the value 'Web server for marketing site' | Command:
```bash
kubectl annotate 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 larger than lab... |
Create a cluster role named "reader" with the ability to use pods and specifically the web-frontend and blog-backend resource names. | Command:
```bash
kubectl create clusterrole reader --verb=use --resource=pods --resource-name=web-frontend --resource-name=blog-backend
```
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]`... |
View the details of daemonset revision 3 for the my-deployment daemonset | Command:
```bash
kubectl rollout history daemonset/my-deployment --revision=3
```
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 ... |
Create a secret named payment-gateway-secret and load the keys from files in the folder bar. | Command:
```bash
kubectl create secret generic payment-gateway-secret --from-file=path/to/configs
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basena... |
Create a job named 'audit-job' using the 'mcr.microsoft.com/dotnet/core/runtime' image | Command:
```bash
kubectl create job audit-job --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-runtimes
```
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", ... |
Set the CPU and memory limits for the nginx container in the ubuntu deployment to 1 CPU and 64Mi of memory respectively. | Command:
```bash
kubectl set resources deployment ubuntu -c=nginx --limits=cpu=1,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 it... |
Set the cluster field in a specific context to a different cluster | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster cluster-beta
```
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 y... |
Retrieve the snapshot logs from the container 'log-aggregator-deployment-1' of the deployment named 'monitoring-pod' | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c monitoring-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"... |
Retrieve the snapshot logs from the container "log-aggregator-deployment-1" within the "email-service-pod" deployment. | Command:
```bash
kubectl logs deployment/log-aggregator-deployment -c email-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... |
Forward traffic from port 8081 on the local machine to port 9090 in a pod selected by the api-server-deployment deployment | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8081 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 b... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/ssh-key-secret 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 or more pod template... |
Expose the 'ubuntu' replication set as a service, serving on port 9000 and connecting to containers on port 500100. | Command:
```bash
kubectl expose rs ubuntu --port=9000 --target-port=500100
```
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.... |
Forward traffic from local port 8000 to port 6379 in the backend pod | Command:
```bash
kubectl port-forward pod/backend-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 automa... |
Retrieve the log output from the container named 'web-app-pod-1' within the 'gateway-deployment' deployment. | Command:
```bash
kubectl logs deployment/gateway-deployment -c web-app-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": "--... |
Forward traffic from port 5000 on all addresses to port 8000 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 5000: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 wi... |
Import specific keys from a config map into an environment variable of a deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config deployment/proxy-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 definition... |
Create an ingress named 'public-service-ingress' with a rule that directs requests from site.com/input to svc1:8000 | Command:
```bash
kubectl create ingress public-service-ingress --rule="site.com/input=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": "",... |
Get output from a command running in a specific container from a pod | Command:
```bash
kubectl exec vpn-service-pod -c mycontainer -- 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 omitte... |
Create a new deployment named "registry" using the mcr.microsoft.com/dotnet/core/runtime image and expose port 8010. | Command:
```bash
kubectl create deployment registry --image=mcr.microsoft.com/dotnet/core/runtime --port=8010
```
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": "", "... |
Forward the local ports 8081 and 6000 to the ports 8888 and 6000 of the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8081 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Set the cluster field of a specific context to a specific cluster | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster app-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value yo... |
Retrieve the output of the 'yum install -y aws-cli' command from the first pod of the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl exec deploy/monitoring-stack-deployment -- yum install -y aws-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 n... |
Update the 'payment-processor-deployment' deployment by setting the environment variable 'LOG_LEVEL' to 'info'. | Command:
```bash
kubectl set env deployment/payment-processor-deployment LOG_LEVEL=info
```
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 templa... |
Set up auto scaling for the deployment "log-aggregator" with a minimum of 2 and a maximum of 8 pods. | Command:
```bash
kubectl autoscale deployment log-aggregator --min=2 --max=8
```
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 tha... |
Delete the pods and services with names "security" and "api" | Command:
```bash
kubectl delete pod,service security api
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
So... |
Wait for the pod named "media-stream-pod" to become ready | Command:
```bash
kubectl wait --for=condition=Ready pod/media-stream-pod
```
What it does:
Experimental: Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.
Alternatively, the command c... |
Start streaming the logs of the 'ruby' container in the 'gateway-pod' pod | Command:
```bash
kubectl logs -f -c ruby 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": "-c... |
Create a service for the ruby deployment, serving on port 3000 and connecting to the containers on port 8000 | Command:
```bash
kubectl expose deployment ruby --port=3000 --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 specified... |
Create a new debug pod with the name debug-image-api, copying all containers from the database-pod and changing their images to hazelcast/hazelcast. | Command:
```bash
kubectl debug database-pod --copy-to=debug-image-api --set-image=*=hazelcast/hazelcast
```
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 defa... |
Add the annotation 'last-deployment=2023-03-15' to the 'api' pod | Command:
```bash
kubectl annotate pods api last-deployment=2023-03-15
```
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 arbitra... |
Create a copy of the 'email-service-pod' pod with a new pod named 'my-debugger' and change the command of the 'cosmic-container' to 'sh' | Command:
```bash
kubectl debug email-service-pod -it --copy-to=my-debugger --container=cosmic-container -- 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 b... |
Import specific keys from a config map to the environment variables of a deployment | Command:
```bash
kubectl set env --keys=api_key --from=configmap/namespace-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 definit... |
Import the SECRET_KEY from the ui-config config map into the environment of the email-server-deployment deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/ui-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 definitions ... |
Set the TLS server name to "data-cluster" for the "kube-cluster-2" cluster entry | Command:
```bash
kubectl config set-cluster kube-cluster-2 --tls-server-name=data-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifica... |
get deployments in YAML format for the "v2.1.0" version of the "my-apps" API group | Command:
```bash
kubectl get deployments.v2.1.0.my-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 will on... |
Remove all taints with the key 'workload' from the node 'db-node-7' | Command:
```bash
kubectl taint nodes db-node-7 workload-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|na... |
Begin streaming the logs of the 'astro-container' container in the 'e-commerce-pod' pod | Command:
```bash
kubectl logs -f -c astro-container 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"... |
Update the pod 'auth' by adding an annotation with the key 'deployment-script' and the value 'https://example.com/deploy.sh' | Command:
```bash
kubectl annotate pods auth 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 larger than la... |
Create a cron job named "database-maintenance" using the "python" image | Command:
```bash
kubectl create cronjob database-maintenance --image=python --schedule="*/1 * * * *" -- python --version
```
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", ... |
Update the last-applied-configuration of a pod using the contents of the 'pod.yaml' file, and create the annotation if it doesn't already exist. | Command:
```bash
kubectl apply set-last-applied -f pod.yaml --create-annotation=true
```
What it does:
Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run, without updatin... |
Return the snapshot of previous terminated "astro-container" container logs from the pod "mypod" | Command:
```bash
kubectl logs -p -c astro-container mypod
```
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"... |
Get the output from the 'lunar-launcher' container in the 'auth-service-pod' pod | Command:
```bash
kubectl attach auth-service-pod -c lunar-launcher
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Create a new ClusterIP service named frontend-service-clusterip with a TCP port mapping. | Command:
```bash
kubectl create service clusterip frontend-service-clusterip --tcp=3000:8080
```
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... |
Create a deployment named auth running the python image and exposing port 8082 | Command:
```bash
kubectl create deployment auth --image=python --port=8082
```
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... |
Retrieve the output from running the command 'jenkins --version' in the code-explorer container of the e-commerce-pod pod. | Command:
```bash
kubectl exec e-commerce-pod -c code-explorer -- 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 ... |
Update the team annotation of the pod specified in the "params.json" file to 'frontend team' | Command:
```bash
kubectl annotate -f params.json team='frontend team'
```
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 arbitra... |
Create a new ExternalName service named external-identity-provider-service that maps to the external host education-edu.edu | Command:
```bash
kubectl create service externalname external-identity-provider-service --external-name education-edu.edu
```
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 re... |
Create a new config map named app-settings in the current namespace using the properties and key1 files as sources | Command:
```bash
kubectl create configmap app-settings --from-file=properties=/path/to/options/file1.txt --from-file=key1=/path/to/configurations/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 cre... |
Copy the local file /tmp/foo_dir to the remote pod named argocd/image-resizer-pod-20 in the namespace | Command:
```bash
kubectl cp /tmp/foo_dir argocd/image-resizer-pod-20:/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... |
Set the cluster field of a specific context to a specific Kubernetes cluster | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster my-k8s-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value ... |
Get the output from running the 'redis-server' command on the first pod of the 'analytics-service' service. | Command:
```bash
kubectl exec svc/analytics-service -- redis-server
```
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... |
Create a cluster role named "foo" with the following permissions: | Command:
```bash
kubectl create clusterrole foo --verb=get --resource=services --resource-name=database-master --resource-name=file-processing
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client... |
Check if you have permission to list the job named "data-migration-job" in the "kube-dns" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/data-migration-job -n kube-dns
```
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 UR... |
Create a Pod Disruption Budget named "messaging-pdb" that will select all pods with the label "app=rails" and require at least one of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget messaging-pdb --selector=app=rails --min-available=1
```
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 [--dry... |
Copy the file '~/.config/kube' from your local machine to the '/tmp/bar_dir' directory inside the 'logging-agent-pod-7' pod, specifically in the 'ingress-controller' container. | Command:
```bash
kubectl cp ~/.config/kube logging-agent-pod-7:/tmp/bar_dir -c ingress-controller
```
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... |
Create a service for the replication controller specified in the "centos-controller.yaml" file | Command:
```bash
kubectl expose -f centos-controller.yaml --port=8088 --target-port=8000
```
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... |
Start a python pod and expose port 5432 | Command:
```bash
kubectl run hazelcast --image=python --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 new secret named cert-manager-secret using the options.env file as the source of environment variables. | Command:
```bash
kubectl create secret generic cert-manager-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 to the b... |
Import the `database_url` key from the `api-config` ConfigMap into the `database-deployment` deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/api-config deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions i... |
Forward local traffic on port 8088 to the pod 'analytics-pod' port 6379 | Command:
```bash
kubectl port-forward pod/analytics-pod 8088 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 auto... |
Listen on port 8080 locally and forward the traffic to port 5000 in the frontend-pod pod. | Command:
```bash
kubectl port-forward pod/frontend-pod 8080:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create a copy of the payment-gateway-pod with a debug container and updated container images | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=debug-image-memcached --image=debian --set-image=proxy=nginx:1.21,proxy=nginx:1.21
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by ... |
Add a taint with key 'dedicated' on nodes having label environment=production | Command:
```bash
kubectl taint node -l environment=production dedicated=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Listen on port 8081 on your local machine and forward the traffic to port 8888 in the web-app-pod pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 8081:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
List deployments in the "v2.0.0" version of the "api-v2" API group in JSON output format. | Command:
```bash
kubectl get deployments.v2.0.0.api-v2 -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will onl... |
Get the output from the 'code-explorer' container in the 'email-service-pod' pod. | Command:
```bash
kubectl attach email-service-pod -c code-explorer
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Set the custom TLS server name to "cloud-cluster" for the "moon-cluster" cluster entry | Command:
```bash
kubectl config set-cluster moon-cluster --tls-server-name=cloud-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] [--certificat... |
Create a new pod named 'debug-image-web' based on the 'web-app-pod', using the 'debian' image | Command:
```bash
kubectl debug web-app-pod -it --copy-to=debug-image-web --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... |
Update the 'database' pod with the annotation 'backup-strategy' and the value 'daily-backups', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite pods database 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 labe... |
Add a taint with key 'zone' on nodes having label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp zone=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
Create a pod named "hazelcast" using the image "confluentinc/cp-kafka", and expose port 3001. | Command:
```bash
kubectl run hazelcast --image=confluentinc/cp-kafka --port=3001
```
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 flag... |
Begin streaming the logs of the 'cosmic-container' container in the 'media-stream-pod' pod. | Command:
```bash
kubectl logs -f -c cosmic-container 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": "--contain... |
Check if you have permission to list the "cache-warming-job" in the "kube-node-lease" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/cache-warming-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... |
Copy the file /tmp/foo from the /tmp/bar directory of the 'monitoring-agent-pod-6' pod in the 'metallb-system' namespace to the local /tmp/bar directory | Command:
```bash
kubectl cp metallb-system/monitoring-agent-pod-6:/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 ... |
Start port forwarding from local port 5432 to port 8888 in the selected pod of the deployment named "notification-handler-deployment". | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 5432 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 ... |
Copy the file '/tmp/foo' from the 'security-scanner-pod-18' pod in the 'openfaas' namespace to the local '/tmp/bar' directory. | Command:
```bash
kubectl cp openfaas/security-scanner-pod-18::/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... |
Listen on ports 5432 and 6000 locally, forwarding data to/from ports 8081 and 6000 in the security-service-pod pod. | Command:
```bash
kubectl port-forward pod/security-service-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 select... |
Create a service for the 'hazelcast' deployment which serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=3000 --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 spec... |
Import environment variables from a config map with a specified prefix | Command:
```bash
kubectl set env --from=configmap/api-config --prefix=MYSQL_ 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 or mo... |
Create a new secret named api-key-secret from an environment file | Command:
```bash
kubectl create secret generic api-key-secret --from-env-file=path/to/preferences.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the ba... |
Create a copy of the e-commerce pod with a debug container, using the Debian image, and changing the container images for the cache and mailer containers. | Command:
```bash
kubectl debug e-commerce-pod -it --copy-to=my-debugger --image=debian --set-image=cache=redis:alpine,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource ... |
Update the pod 'foo' by setting the annotation 'description' to 'Web server for marketing site', replacing any existing value | Command:
```bash
kubectl annotate --overwrite pods foo 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 larger th... |
Check if you have permission to list the job named "report-generation-job" in the "namespace-1" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/report-generation-job -n namespace-1
```
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... |
Update the pod named 'foo' in the default namespace with the annotation 'app-version' and the value '2.5.1'. | Command:
```bash
kubectl annotate pods foo app-version=2.5.1
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string... |
Set environment variables from a specific key in a config map for a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/kube-system-config deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment varia... |
Copy the /tmp/foo file from the auth-service-pod-11 pod in the kube-dns namespace to the /etc/kubernetes directory locally. | Command:
```bash
kubectl cp kube-dns/auth-service-pod-11::/tmp/foo /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 t... |
Set the CPU limits of the Python container in the deployment to 2 and the memory limits to 4Gi. | Command:
```bash
kubectl set resources deployment python -c=nginx --limits=cpu=2,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 its... |
Set the custom TLS server name to use for validation for the "star-cluster" cluster entry | Command:
```bash
kubectl config set-cluster star-cluster --tls-server-name=dev-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-... |
Listen on port 8081 on all addresses and forward the traffic to port 8000 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/log-aggregator-pod 8081: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 po... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.