prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Execute the 'dotnet --list-runtimes' command inside the time-machine container of pod mypod and retrieve the output. | Command:
```bash
kubectl exec mypod -c time-machine -- dotnet --list-runtimes
```
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... |
Forward local traffic from port 5000 to port 8000 in the pod selected by the mydeployment deployment. | Command:
```bash
kubectl port-forward deployment/mydeployment 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 will be selecte... |
Import the 'redis_host' key from the 'env-vars' config map into the environment variables of the 'api-server-deployment' deployment | Command:
```bash
kubectl set env --keys=redis_host --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 ... |
Set a custom TLS server name for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --tls-server-name=app-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate-authority... |
Return the previous logs of the container named "stardust-shuttle" from the pod named "api-service-pod" | Command:
```bash
kubectl logs -p -c stardust-shuttle api-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--containe... |
Create a new ExternalName service named 'external-ldap-service' with the external name 'placeholder-app.app' | Command:
```bash
kubectl create service externalname external-ldap-service --external-name placeholder-app.app
```
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 ser... |
Output the modified deployment in YAML format without making changes to the deployment object on the server | Command:
```bash
kubectl set env deployment/analytics-platform-deployment PORT=8080 -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod te... |
Execute the command 'mongo --version' inside the 'backend-pod' pod using the 'warp-drive' container and get the output. | Command:
```bash
kubectl exec backend-pod -c warp-drive -- mongo --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a debug container called 'dgb-img' and change the container image of the 'payment-gateway-pod' to 'debian' | Command:
```bash
kubectl debug payment-gateway-pod -it --copy-to=dgb-img --image=debian --set-image=cache=redis:alpine,worker=my-custom-worker:1.2.3
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by... |
Create a pod disruption budget named logging-pdb that selects pods with the release=1.0.0 label and requires at least one of them to be available at any given time. | Command:
```bash
kubectl create poddisruptionbudget logging-pdb --selector=release=1.0.0 --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 [--d... |
Create a deployment named sonarqube using the hazelcast image and expose port 8089 | Command:
```bash
kubectl create deployment sonarqube --image=hazelcast/hazelcast --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": "", "usage": "Output f... |
Forward ports locally to a pod selected by the deployment | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 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, ... |
Forward local traffic from port 5432 to port 3000 in a pod selected by the 'authentication-service-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 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, ... |
Forward traffic from local port 6379 to port 3000 in a pod selected by the "mydeployment" deployment. | Command:
```bash
kubectl port-forward deployment/mydeployment 6379 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 selecte... |
List deployments in the "hotfix-1.1.2" version of the "beta-apps" API group in JSON format. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.beta-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you... |
Create a role named "foo" with the ability to use pods and specifically target the "order-fulfillment" and "backup-service" resources | Command:
```bash
kubectl create role foo --verb=use --resource=pods --resource-name=order-fulfillment --resource-name=backup-service
```
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=server|cl... |
Copy a file from a remote pod to a local directory. | Command:
```bash
kubectl cp velero/cache-pod-5:/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 the kubectl.kub... |
Update the 'cdn' pod by setting the annotation 'alert-email' to 'alerts@example.com' | Command:
```bash
kubectl annotate --overwrite pods cdn alert-email='alerts@example.com'
```
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 a... |
Copy a file from a remote pod to a local directory | Command:
```bash
kubectl cp kube-proxy/ingress-controller-pod-8::/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, u... |
Use the vi editor to edit the email-service service | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/email-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, or... |
Create a job named "log-processing-job" using the NGINX image and run the command "nginx -g 'daemon off;'" | Command:
```bash
kubectl create job log-processing-job --image=nginx -- nginx -g "daemon off;"
```
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":... |
Copy the service account file from the local machine to the specified path in a specific container of the remote pod. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ backend-pod-13::/tmp/bar -c auth-service
```
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": "... |
Create a new secret named git-credentials-secret with keys for each file in the folder path/to/configs | Command:
```bash
kubectl create secret generic git-credentials-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 cluster role named "foo" with specified resource names | Command:
```bash
kubectl create clusterrole foo --verb=exec --resource=pods --resource-name=report-generator --resource-name=database-master
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|n... |
Start a hazelcast pod named nginx using the hazelcast/hazelcast image, but customize the specification by providing a partial set of values in JSON format. | Command:
```bash
kubectl run nginx --image=hazelcast/hazelcast --overrides='{ "apiVersion": "dev-2.2.0", "spec": { ... } }'
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--com... |
Create a new ingress named 'public-api-ingress' with a routing rule that directs requests from foo.com/input to the service 'svc1' on port 3000 | Command:
```bash
kubectl create ingress public-api-ingress --rule="foo.com/input=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": "", "usa... |
List deployments in YAML format for the "third-party-apps" API group, specifically in the "stable-2.0.0" version. | Command:
```bash
kubectl get deployments.stable-2.0.0.third-party-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 namespa... |
set resource limits for the Jenkins container in the deployment | Command:
```bash
kubectl set resources deployment jenkins -c=nginx --limits=cpu=3,memory=2Gi
```
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... |
Output the modified api-server-deployment deployment in YAML format, without altering the object on the server. | Command:
```bash
kubectl set env deployment/api-server-deployment REDIS_HOST=redis-server -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more ... |
Create a pod disruption budget named cache-cluster-pdb that will select all pods with the region=us-east label and require a minimum of four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget cache-cluster-pdb --selector=region=us-east --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... |
Copy a file from local to a remote pod in a specific container | Command:
```bash
kubectl cp :/tmp/foo logging-agent-pod-7:/tmp/bar_dir -c cache-container
```
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... |
List deployments in YAML output format, specifically in the "beta-1.0" version of the "api-v1" API group | Command:
```bash
kubectl get deployments.beta-1.0.api-v1 -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 o... |
Create a debug version of the "mypod" pod where all container images are replaced with the "mongo" image | Command:
```bash
kubectl debug mypod --copy-to=debug-image-api --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 resource is... |
Set the cluster field in the on-prem-context context to dev-cluster | Command:
```bash
kubectl config set contexts.on-prem-context.cluster dev-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you w... |
Attach to the 'astro-container' in the 'e-commerce-pod' pod and get its output | Command:
```bash
kubectl attach e-commerce-pod -c astro-container
```
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 omitte... |
Delete both the pod and service resources with the names "foo" and "analytics" | Command:
```bash
kubectl delete pod,service foo 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 selector.
S... |
Create an ingress called 'api-v1-ingress' that directs requests from site.com/example to svc1:5432 and use the tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="site.com/example=svc1:5432,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... |
Update the image of all containers in the 'app-v2' DaemonSet to 'node:14.17.3' | Command:
```bash
kubectl set image daemonset app-v2 *=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:
`kube... |
Create a deployment named logging using the postgres image and expose port 8082. | Command:
```bash
kubectl create deployment logging --image=postgres --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... |
Create an ingress called 'website-ingress' that directs requests to foo.com/example to svc1:9090 with the tls secret "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="foo.com/example=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": "", "usag... |
Create a new ClusterIP service named backend-service-clusterip that maps TCP port 6379 on the service to port 5000 on the backend. | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=6379:5000
```
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"... |
Forward traffic from local port 8888 to port 9090 in the web-app-pod pod | Command:
```bash
kubectl port-forward pod/web-app-pod 8888: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 automa... |
Create a role named "reader" with the ability to update pods and specific resource names "file-storage" and "monitoring-prometheus" | Command:
```bash
kubectl create role reader --verb=update --resource=pods --resource-name=file-storage --resource-name=monitoring-prometheus
```
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=s... |
Forward data between local port 5000 and pod port 8088 for the cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 5000 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Embed the certificate authority data for the cluster entry named "my-k8s-cluster" | Command:
```bash
kubectl config set-cluster my-k8s-cluster --embed-certs --certificate-authority=~/.kube/galaxy-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config... |
Set the CPU limit of the 'postgres' deployment container to 1 and the memory limit to 2Gi. | Command:
```bash
kubectl set resources deployment postgres -c=nginx --limits=cpu=1,memory=2Gi
```
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... |
Forward local port 8080 to port 9090 in the pod named 'proxy-server-pod' | Command:
```bash
kubectl port-forward pod/proxy-server-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 a... |
Partially update a node by specifying a strategic merge patch in YAML format. | Command:
```bash
kubectl patch node edge-node-10 -p $'data:\n key: new-value'
```
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]`
Helpful flag... |
Create a cluster role named "admin_role" with a specified NonResourceURL. | Command:
```bash
kubectl create clusterrole "admin_role" --verb=create --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": "--outp... |
Force replace the resource defined in the setup.json file, deleting it if it already exists and then re-creating it. | Command:
```bash
kubectl replace --force -f ./setup.json
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replace -f F... |
Create an ingress called 'api-ingress' with a rule that directs requests for 'foo.com/bar' to 'svc1:8081' and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="foo.com/bar=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": "", "usage": "Out... |
Auto scale the deployment "api" with the number of pods between 6 and 13. | Command:
```bash
kubectl autoscale deployment api --min=6 --max=13
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Forward local port 6379 to port 8888 in the pod named security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 6379: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 select... |
Return previous terminated container logs from a pod | Command:
```bash
kubectl logs -p -c astro-container 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", "... |
force replace the resource using the provided yaml file | Command:
```bash
kubectl replace --force -f ./preferences.yaml
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replac... |
Create a pod named hazelcast using the nginx image and expose port 9000 | Command:
```bash
kubectl run hazelcast --image=nginx --port=9000
```
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... |
Forward traffic from port 8888 on any IP address to port 3000 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8888: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 ... |
Create a cron job that runs a Python command every 1 minute | Command:
```bash
kubectl create cronjob monthly-audit --image=python --schedule="*/1 * * * *" -- python
```
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", "d... |
Update the cpu and memory limits of the mongo container in the deployment named "mongo" | Command:
```bash
kubectl set resources deployment mongo -c=nginx --limits=cpu=1,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 ... |
Create a new ClusterIP service named 'backend-service-clusterip' that maps port 8082 to port 9000 | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=8082: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"... |
Create an ingress called 'www-ingress' that directs requests to foo.com/example to svc1:8089 with a TLS secret "my-cert" | Command:
```bash
kubectl create ingress www-ingress --rule="foo.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": "", "usage": ... |
Taint a node with key 'cpu-type' and value 'x86' and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes monitoring-node-15 cpu-type=x86:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output forma... |
Create a job to run a command | Command:
```bash
kubectl create job indexing --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet --list-sdks
```
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", "defa... |
Set the service account of the deployment "scheduler-app-deployment" to "dashboard". | Command:
```bash
kubectl set serviceaccount deployment scheduler-app-deployment dashboard
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`ku... |
Remove all the taints with the key 'environment' from the node 'kube-master-9' | Command:
```bash
kubectl taint nodes kube-master-9 environment-
```
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|... |
Rename the context 'cluster-1-context' to 'app-1-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context cluster-1-context app-1-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will a... |
Embed certificate authority data for the cluster-beta cluster entry | Command:
```bash
kubectl config set-cluster cluster-beta --embed-certs --certificate-authority=~/.kube/cloud-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config se... |
Create a job named "cleanup" using the "php" image and run the "composer --version" command inside the job. | Command:
```bash
kubectl create job cleanup --image=php -- composer --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. ... |
Autoscale the deployment "vpn" with a minimum of 1 pod and a maximum of 9 pods. | Command:
```bash
kubectl autoscale deployment vpn --min=1 --max=9
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the ... |
Display the most recent 31 lines of logs from the pod named e-commerce-pod. | Command:
```bash
kubectl logs --tail=31 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 an ingress with the name 'app2-ingress' that routes requests for 'testing.com/example' to the service 'svc1' at port 9091, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/example=svc1:9091,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... |
Begin streaming the logs of the nebula-navigator container in the web-app-pod pod. | Command:
```bash
kubectl logs -f -c nebula-navigator web-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", ... |
Get the output of the 'gem --version' command from the 'security-service-pod' pod, running in the 'quantum-quark' container | Command:
```bash
kubectl exec security-service-pod -c quantum-quark -- gem --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. I... |
Begin streaming the logs of the time-machine container in pod cdn-service-pod | Command:
```bash
kubectl logs -f -c time-machine cdn-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", ... |
create a new config map named 'env-vars' with the specified keys from the specified files | Command:
```bash
kubectl create configmap env-vars --from-file=properties=/path/to/options/file1.txt --from-file=key1=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a co... |
Add a taint with key 'zone' on nodes having label team=devops, with the value 'storage-node-13' and the effect 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l team=devops zone=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": "", "usage": "Ou... |
Retrieve the password for the "staging-cluster" user | Command:
```bash
kubectl config view -o jsonpath='{.users[?(@.name == "staging-cluster")].user.password}'
```
What it does:
Display merged kubeconfig settings or a specified kubeconfig file.
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.
Syntax:
`kubectl config view`
Help... |
Update the pod 'monitoring' by adding the annotation 'env' with the value 'staging'. | Command:
```bash
kubectl annotate pods monitoring 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 arbitrary strin... |
Add the label 'component=worker' to the pod named 'email' | Command:
```bash
kubectl label pods email component=worker
```
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":... |
get a pod in JSON output format | Command:
```bash
kubectl get -o json pod frontend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see res... |
Execute the 'mysql --version' command in the 'warp-drive' container of the 'auth-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec auth-service-pod -c warp-drive -- mysql --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 omi... |
Create a service for the hazelcast replica set named "hazelcast" that serves on port 8443 and connects to the containers on port 330600. | Command:
```bash
kubectl expose rs hazelcast --port=8443 --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 po... |
Add a taint with key 'disktype' on nodes having label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 disktype=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Update the pod 'proxy-server' with the label 'env' and the value 'development' | Command:
```bash
kubectl label pods proxy-server env=development
```
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", "u... |
Import environment variables from a config map into a deployment with a specified prefix | Command:
```bash
kubectl set env --from=configmap/log-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... |
Copy the directory '/tmp/foo_dir' from the 'admin-dashboard-pod-16' pod in the 'kube-flannel' namespace to the local directory '/tmp/bar'. | Command:
```bash
kubectl cp kube-flannel/admin-dashboard-pod-16:/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... |
Set the resource request and limits for all containers in the 'mysql' deployment to a CPU limit of 200m, memory limit of 512Mi, CPU request of 1, and memory request of 128Mi. | Command:
```bash
kubectl set resources deployment mysql --limits=cpu=200m,memory=512Mi --requests=cpu=1,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... |
Create a role binding named 'foo' that grants the 'foo' cluster role to the users 'jane.doe', 'bob.smith', and the 'developers' group. | Command:
```bash
kubectl create rolebinding foo --clusterrole=foo --user=jane.doe --user=bob.smith --group=developers
```
What it does:
Create a role binding for a particular role or cluster role.
Syntax:
`kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--servicea... |
Copy a local file to a remote pod in a specific namespace | Command:
```bash
kubectl cp /tmp/foo rook-ceph/monitoring-agent-pod-6:/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 deployment named 'scheduler' that runs the 'mysql' image and expose port 8089 | Command:
```bash
kubectl create deployment scheduler --image=mysql --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": "", "usage": "Output format. One of:... |
Create a pod disruption budget named payment-gateway-pdb that will select all pods with the component=web label and require at least 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget payment-gateway-pdb --selector=component=web --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-availabl... |
Change the cluster field in the staging-context context to cluster-alpha | Command:
```bash
kubectl config set contexts.staging-context.cluster cluster-alpha
```
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... |
Execute the command 'redis-cli' in the 'time-machine' container of the 'vpn-service-pod' pod and display the output. | Command:
```bash
kubectl exec vpn-service-pod -c time-machine -- redis-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Create a new ExternalName service named external-security-service | Command:
```bash
kubectl create service externalname external-security-service --external-name demo-service.dev
```
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... |
Add the label 'component=api' to the pod 'media-stream' | Command:
```bash
kubectl label pods media-stream component=api
```
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", "usa... |
Copy the file "/tmp/foo" from the remote pod "kube-public/file-server-pod-14" to the local directory "/tmp/bar". | Command:
```bash
kubectl cp kube-public/file-server-pod-14:/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 ku... |
Create a debug copy of the "security-service-pod" by adding a debug container and changing container images. | Command:
```bash
kubectl debug security-service-pod -it --copy-to=debug-image-memcached --image=debian --set-image=cache=redis:alpine,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 res... |
Create a deployment named "monitoring" that runs the "alpine" image with 5 replicas. | Command:
```bash
kubectl create deployment monitoring --image=alpine --replicas=5
```
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 ... |
Set the resource request and limits for all containers in the alpine deployment to CPU limit of 200m and memory limit of 512Mi, and CPU request of 10m and memory request of 128Mi. | Command:
```bash
kubectl set resources deployment alpine --limits=cpu=200m,memory=512Mi --requests=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 request... |
Copy the file '/tmp/foo' from the 'payment-gateway-pod-19' pod in the 'kube-node-lease' namespace to the '/tmp/bar' directory locally. | Command:
```bash
kubectl cp kube-node-lease/payment-gateway-pod-19::/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, us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.