prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Delete the pods and services named "frontend" and "vpn" | Command:
```bash
kubectl delete pod,service frontend vpn
```
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... |
Create an ingress resource named 'ingtls' with TLS enabled, using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="testing.com/=svc:https,tls" \
--rule="website.com/path/subpath*=othersvc:9090"
```
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"... |
Start a hazelcast pod with the nginx image, but override the spec with a partial set of values parsed from the provided JSON | Command:
```bash
kubectl run nginx --image=hazelcast/hazelcast --overrides='{ "apiVersion": "v2.0.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] [--comman... |
Start a pod using the ethereum/client-go image and expose port 8888 | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --port=8888
```
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:
... |
Return the snapshot logs from the pod "gateway-pod" that has only one container. | Command:
```bash
kubectl logs 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", "default... |
Edit the 'backup-job' job in JSON format using the v1 API format | Command:
```bash
kubectl edit job.v1.batch/backup-job -o json
```
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 fa... |
Execute the command 'elasticsearch-plugin --list' in the 'nano-bot' container of the 'email-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec email-service-pod -c nano-bot -- elasticsearch-plugin --list
```
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 image version (tag) of the api-service-pod to v4. | Command:
```bash
kubectl get pod api-service-pod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
```
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... |
Update the runtime deployment to set the CPU limit to "1" and memory limit to "64Mi" for the "nginx" container. | Command:
```bash
kubectl set resources deployment runtime -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 i... |
Import specific keys from a config map to the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config-dev deployment/user-management-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 defin... |
Copy the file /var/run/secrets/kubernetes.io/serviceaccount/ from your local machine to the /etc/kubernetes directory in the remote pod named image-resizer-pod-20 in the logging namespace. | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ logging/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... |
Create a new copy of the 'mypod' pod, with all container images changed to 'amazonlinux', and name it 'debug-image-1' | Command:
```bash
kubectl debug mypod --copy-to=debug-image-1 --set-image=*=amazonlinux
```
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 resourc... |
Update the image of a container in a pod | Command:
```bash
kubectl patch pod chat-app-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
```
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 FILENAM... |
Create a new ExternalName service named external-notification-service that points to the external domain education-edu.edu | Command:
```bash
kubectl create service externalname external-notification-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 referen... |
View the last-applied-configuration annotations in JSON format for the resource defined in the 'config.yaml' file. | Command:
```bash
kubectl apply view-last-applied -f config.yaml -o json
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-ap... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/api-config deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Expose the replication controller "ubuntu" as a service, listening on port 8181 and forwarding traffic to the containers on port 543200. | Command:
```bash
kubectl expose rc ubuntu --port=8181 --target-port=543200
```
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 port 8080 on all addresses to port 3000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 8080: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 wil... |
Add a taint with key 'workload' on nodes having label owner=john-doe, using the taint value 'monitoring-node-15:PreferNoSchedule' | Command:
```bash
kubectl taint node -l owner=john-doe workload=monitoring-node-15:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "u... |
Create a deployment named db with the ruby image and expose port 8081 | Command:
```bash
kubectl create deployment db --image=ruby --port=8081
```
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: json|ya... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-settings 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 defini... |
Import the SECRET_KEY key from the ui-config config map into the log-aggregator-deployment deployment | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/ui-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 definition... |
update the 'frontend-deployment' deployment by adding a new environment variable 'DB_HOST' with the value 'localhost' | Command:
```bash
kubectl set env deployment/frontend-deployment DB_HOST=localhost
```
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 (w... |
Execute the 'java -jar /usr/share/jenkins/jenkins.war' command in the rocket-ranger container of the chat-app-pod pod and retrieve the output. | Command:
```bash
kubectl exec chat-app-pod -c rocket-ranger -- java -jar /usr/share/jenkins/jenkins.war
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage":... |
Set the service account of the 'api-server-deployment' deployment to 'gitlab-runner' | Command:
```bash
kubectl set serviceaccount deployment api-server-deployment gitlab-runner
```
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:
`k... |
Forward local traffic from port 5000 to port 8000 in the selected pod, for the deployment "notification-handler-deployment" | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 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 ... |
Set the cluster field in the admin-context context to kube-cluster-1. | Command:
```bash
kubectl config set contexts.admin-context.cluster kube-cluster-1
```
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 ... |
Expose the hazelcast deployment as a service, serving on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=3306 --target-port=900000
```
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... |
Remove a specific taint from a node if it exists. | Command:
```bash
kubectl taint nodes k8s-node-1 special:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: j... |
Forward local port 8888 to the target port of the "https" service port in a selected pod. | Command:
```bash
kubectl port-forward service/web-service 8888:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Create a new config map named ui-config using specific files as the values for keys | Command:
```bash
kubectl create configmap ui-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 config map... |
Forward traffic from local port 3000 to port 8081 in the pod | Command:
```bash
kubectl port-forward pod/mypod 3000:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Create a copy of the "email-service-pod" with the container "cyber-sleuth" and change the command to "sh". | Command:
```bash
kubectl debug email-service-pod -it --copy-to=debug-image-api --container=cyber-sleuth -- 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... |
Copy the local file /tmp/foo_dir to the remote pod worker-pod-4 in the container named cache-container, and place it in the directory /tmp/bar_dir. | Command:
```bash
kubectl cp /tmp/foo_dir worker-pod-4:/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, us... |
Retrieve the snapshot logs from the container named gateway-pod-1 of the scheduler-app-deployment deployment. | Command:
```bash
kubectl logs deployment/scheduler-app-deployment -c gateway-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... |
Retrieve the logs from the container named media-stream-pod-1 in the deployment gateway-deployment. | Command:
```bash
kubectl logs deployment/gateway-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"... |
Forward port 8000 in the 'e-commerce-pod' to port 8080 on your local machine. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8080: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... |
Define new exec authentication plugin arguments for the "system" entry in the kubeconfig file, with the arguments "arg1" and "arg2". | Command:
```bash
kubectl config set-credentials system --exec-arg=arg1 --exec-arg=arg2
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token fla... |
Return the previous terminated logs from the 'cosmic-container' container in the 'database-pod' pod. | Command:
```bash
kubectl logs -p -c cosmic-container database-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container",... |
Start an alpine pod, but override the specifications with partial values parsed from a JSON file. | Command:
```bash
kubectl run nginx --image=alpine --overrides='{ "apiVersion": "v1.1.1", "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] -- [COMMAN... |
Set the service account of the 'notification-handler-deployment' deployment to 'dashboard'. | Command:
```bash
kubectl set serviceaccount deployment notification-handler-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
Synt... |
Add a taint with key 'disktype' on nodes having label environment=production | Command:
```bash
kubectl taint node -l environment=production disktype=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": "... |
Create a job named "indexing" using the nginx image and run the command "nginx -g "daemon off;"" | Command:
```bash
kubectl create job indexing --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": "Output f... |
Run a proxy to the Kubernetes API server on port 8010, serving static content from the ./local/www/ directory | Command:
```bash
kubectl proxy --port=8010 --www=./local/www/
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote... |
Listen on port 5000 on your local machine and forward the traffic to port 3000 in the mypod pod. | Command:
```bash
kubectl port-forward pod/mypod 5000:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Add the label 'app=myapp' to the pod named 'auth' | Command:
```bash
kubectl label pods auth app=myapp
```
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": "If tru... |
Create a service using the ubuntu replica set, which serves on port 9000 and connects to the containers on port 909000 | Command:
```bash
kubectl expose rs ubuntu --port=9000 --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 port.... |
create a priority class named "production-priority" with a value of 150 and a description of "Priority for production workloads" | Command:
```bash
kubectl create priorityclass production-priority --value=150 --description="Priority for production workloads" --preemption-policy="Never"
```
What it does:
Create a priority class with the specified name, value, globalDefault and description.
Syntax:
`kubectl create priorityclass NAME --value=VALUE ... |
See the logs from the pod named proxy-service-pod that were written in the last hour | Command:
```bash
kubectl logs --since=1h proxy-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short... |
Update the annotation 'security-scan-status' of pod 'email' with the value 'pass' | Command:
```bash
kubectl annotate --overwrite pods email security-scan-status='pass'
```
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 ... |
create an ingress called 'www-ingress' with a rule that directs requests for 'website.com/module' to 'svc1:3001' and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress www-ingress --rule="website.com/module=svc1:3001,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 service for a replication controller based on a YAML file, exposing it on port 8080 and connecting to the containers on port 909000 | Command:
```bash
kubectl expose -f php-controller.yaml --port=8080 --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 sp... |
Execute the 'wp' command inside the 'cosmic-container' of the 'proxy-service-pod' and retrieve the output. | Command:
```bash
kubectl exec proxy-service-pod -c cosmic-container -- wp
```
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, ... |
Show the deployments in the "v1.0.0" version of the "web-apps" API group in JSON format. | Command:
```bash
kubectl get deployments.v1.0.0.web-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 will o... |
Forward traffic from port 8000 on localhost and IP address 10.19.21.23 to port 9090 in the backend-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/backend-pod 8000: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 criteri... |
Set the service account for the `email-server-deployment` deployment to `tekton`. | Command:
```bash
kubectl set serviceaccount deployment email-server-deployment tekton
```
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:
`kubect... |
Add a taint with key 'environment' on nodes having label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack environment=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": "", "usag... |
Set the cluster field of the my-context context to cluster-alpha | Command:
```bash
kubectl config set contexts.user-b-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 ... |
Forward local port 5432 to port 5432 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-pod 5432: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 a... |
create a service for the replication controller specified in "nginx-controller.yaml", serving on port 5000 and connecting to containers on port 888800 | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=5000 --target-port=888800
```
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 ... |
Copy the directory "/var/run/secrets/kubernetes.io/serviceaccount/" from the pod "api-server-pod-3" in the namespace "metallb-system" to the local directory "/tmp/bar_dir". | Command:
```bash
kubectl cp metallb-system/api-server-pod-3:/var/run/secrets/kubernetes.io/serviceaccount/ /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage... |
Create an ingress named 'private-service-ingress' that maps requests for 'foo.com/bar' to 'svc1:8084' with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="foo.com/bar=svc1:8084,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": "", "... |
Remove the taint with key 'workload' and effect 'NoSchedule' from the node 'backup-node-14' if it exists. | Command:
```bash
kubectl taint nodes backup-node-14 workload:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
get specific resources by their type and names | Command:
```bash
kubectl get rc/web service/email-service-rc pods/payment-gateway-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 ... |
Output the modified deployment in YAML format without making any changes to the deployed object on the server. | Command:
```bash
kubectl set env deployment/load-balancer-deployment JWT_SECRET=your-jwt-secret -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or... |
Create an ingress called 'app2-ingress' that routes requests to testing.com/module to the service 'svc1' on port 8089 | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/module=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": "", "usag... |
Create a deployment named "jenkins" using the "amazonlinux" image and run the "bash" command inside the deployment container. | Command:
```bash
kubectl create deployment jenkins --image=amazonlinux -- bash
```
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:... |
Add the 'special' taint to nodes that have the label 'environment=production' | Command:
```bash
kubectl taint node -l environment=production special=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Copy the local file /var/run/secrets/kubernetes.io/serviceaccount/ to the /etc/kubernetes directory inside the pod named velero/image-resizer-pod-20 in the namespace image-resizer | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ velero/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"... |
Get the output from running the 'python --version' command in the nebula-navigator container of the analytics-pod | Command:
```bash
kubectl exec analytics-pod -c nebula-navigator -- python --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... |
Get the output from running the 'elasticsearch' command in the first container of the 'auth-service-pod' pod | Command:
```bash
kubectl exec auth-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 ku... |
Create a new ExternalName service named external-notification-service with the external name "illustration-shop.shop" | Command:
```bash
kubectl create service externalname external-notification-service --external-name illustration-shop.shop
```
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... |
Embed certificate authority data for the kube-cluster-2 cluster entry: | Command:
```bash
kubectl config set-cluster kube-cluster-2 --embed-certs --certificate-authority=~/.kube/web-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... |
forward the local port 8888 to port 9090 in the 'cdn-service-pod' pod. | Command:
```bash
kubectl port-forward pod/cdn-service-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 au... |
Copy a directory from a pod to a local directory | Command:
```bash
kubectl cp openfaas/api-server-pod-3:/tmp/foo_dir /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Import the environment variable 'api-secret-key' from the secret into the 'authentication-service-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/api-secret-key deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one... |
Copy the local file /tmp/foo to the remote pod file-server-pod-14 in the istio-system namespace, and place it in the /tmp/bar_dir directory. | Command:
```bash
kubectl cp :/tmp/foo istio-system/file-server-pod-14:/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... |
Update the status label of pod 'auth' only if its resource version is 1 | Command:
```bash
kubectl label pods auth status=unhealthy --resource-version=1
```
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... |
Scale the deployment named "dev-environment-rs" to 5 replicas if its current size is 1 | Command:
```bash
kubectl scale --current-replicas=1 --replicas=5 deployment/dev-environment-rs
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-... |
Create a new LoadBalancer service named security-service-lb that forwards traffic from port 8443 to port 8010 | Command:
```bash
kubectl create service loadbalancer security-service-lb --tcp=8443:8010
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o",... |
attach to the chat-app-pod and get output from the code-explorer container | Command:
```bash
kubectl attach chat-app-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 omitted, u... |
Add a taint with key 'disktype' on nodes having label customer=acme-corp | Command:
```bash
kubectl taint node -l customer=acme-corp disktype=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... |
Update the image of all containers in the 'prod' daemonset to 'openjdk:16.0.2' | Command:
```bash
kubectl set image daemonset prod *=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:
`kube... |
Create a service for the replicated ruby deployment, which serves on port 8089 and connects to the containers on port 500100. | Command:
```bash
kubectl expose rc ruby --port=8089 --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. A... |
List the specified resources by their type and names. | Command:
```bash
kubectl get rc/web service/proxy-server-rc pods/web-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespace... |
Copy the directory '/tmp/foo_dir' from the remote pod 'kube-dns/file-server-pod-14' to the local directory '/tmp/bar'. | Command:
```bash
kubectl cp kube-dns/file-server-pod-14:/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, use the k... |
Create a new config map called monitoring-config with specified keys from files | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/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... |
Create a deployment named 'my-dep' that runs the 'alpine' image and exposes port 8888. | Command:
```bash
kubectl create deployment my-dep --image=alpine --port=8888
```
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: j... |
Create an ingress called 'api-v2-ingress' that forwards requests to testing.com/input to svc1:8088 using the TLS secret "my-cert" | Command:
```bash
kubectl create ingress api-v2-ingress --rule="testing.com/input=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": "", "usa... |
Use a different text editor to modify a service configuration | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/payment-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, ... |
attach to a specific container in a pod and enter raw terminal mode for interactive shell access | Command:
```bash
kubectl attach monitoring-pod -c time-machine -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 omi... |
Create a deployment named 'auth' using the 'ethereum/client-go' image and expose port 8089. | Command:
```bash
kubectl create deployment auth --image=ethereum/client-go --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.... |
Create an autoscaling policy for the "email" deployment with a minimum of 4 pods and a maximum of 8 pods. | Command:
```bash
kubectl autoscale deployment email --min=4 --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 that uses th... |
Update the pod named 'proxy-server' by removing the label named 'bar' if it exists | Command:
```bash
kubectl label pods proxy-server app-
```
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": "If ... |
Execute the command 'elasticsearch-plugin --list' in the 'time-machine' container of the 'log-aggregator-pod' pod to get the output. | Command:
```bash
kubectl exec log-aggregator-pod -c time-machine -- elasticsearch-plugin --list
```
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": "Contai... |
Edit the last-applied-configuration annotations for a deployment named "centos" in YAML format. | Command:
```bash
kubectl apply edit-last-applied deployment/centos
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the edit... |
Add an annotation to a pod identified by type and name in "parameters.json" | Command:
```bash
kubectl annotate -f parameters.json owner='alice smith'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbi... |
Create an ingress called 'default-ingress' that directs requests to website.com/example to a specific service, using TLS encryption with a provided certificate secret. | Command:
```bash
kubectl create ingress default-ingress --rule="website.com/example=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": "", "... |
Create a service for a replicated python using a replica set, which serves on port 8888 and connects to the containers on port 9090. | Command:
```bash
kubectl expose rs python --port=8888 --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 port.... |
Forward port 9090 on all addresses to port 8088 in the analytics-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 9090:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.