prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy the local file "/tmp/foo_dir" to remote pod "database-pod-2" in the namespace "kube-server" and save it as "/tmp/bar". | Command:
```bash
kubectl cp /tmp/foo_dir kube-server/database-pod-2::/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... |
Embed the certificate authority data for the kube-cluster-2 cluster entry using the specified certificate authority file in the "~/.kube/staging-cluster/kubernetes.ca.crt" location. | Command:
```bash
kubectl config set-cluster kube-cluster-2 --embed-certs --certificate-authority=~/.kube/staging-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 confi... |
Forward local port 5432 to port 8080 in the web-app-pod, allowing data to be sent and received between the two ports. | Command:
```bash
kubectl port-forward pod/web-app-pod 5432 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Forward local port 8888 to port 8888 in the 'frontend-pod' pod | Command:
```bash
kubectl port-forward pod/frontend-pod 8888 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 autom... |
Forward local port 8088 to port 8888 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8088:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
List the specified resources by their type and names | Command:
```bash
kubectl get rc/web service/analytics-rc pods/api-service-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 namespac... |
Update the 'gateway-deployment' deployment by adding a new environment variable 'SMTP_USERNAME' with the value 'your-username'. | Command:
```bash
kubectl set env deployment/gateway-deployment SMTP_USERNAME=your-username
```
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 tem... |
Auto scale the deployment "auth" with the number of pods between 7 and 8 using the default autoscaling policy. | Command:
```bash
kubectl autoscale deployment auth --min=7 --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 the... |
Update the server field of the on-prem-cluster cluster entry to use the value "https://1.2.3.4" without changing any other values. | Command:
```bash
kubectl config set-cluster on-prem-cluster --server=https://1.2.3.4
```
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-au... |
Copy the file "/var/run/secrets/kubernetes.io/serviceaccount/" from your local machine to the remote pod "worker-pod-4" in the container named "file-server" | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ worker-pod-4:/tmp/bar -c file-server
```
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": "Cont... |
Create a job to run an Ethereum client called "geth" using the image "ethereum/client-go" | Command:
```bash
kubectl create job indexing --image=ethereum/client-go -- geth
```
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... |
Create a deployment named drupal with the postgres image, and expose port 8088. | Command:
```bash
kubectl create deployment drupal --image=postgres --port=8088
```
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 service for the replication controller specified in the "ruby-controller.yaml" file, serving on port 8443 and connecting to the containers on port 818100 | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8443 --target-port=818100
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Retrieve the version of the Redis server running in the first pod of the deployment "authentication-service-deployment" using the first container. | Command:
```bash
kubectl exec deploy/authentication-service-deployment -- redis-server --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": "Conta... |
Update the pod 'gateway' with the annotation 'compliance-level' and the value 'PCI-DSS' | Command:
```bash
kubectl annotate pods gateway compliance-level=PCI-DSS
```
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 arbit... |
Create a cluster role named "view" with the ability to get pods and specifically target the "machine-learning" resource. | Command:
```bash
kubectl create clusterrole view --verb=get --resource=pods --resource-name=machine-learning --resource-name=machine-learning
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|... |
Create a service using the configuration file "node-controller.yaml" with port 8088 that connects to containers on port 900000 | Command:
```bash
kubectl expose -f node-controller.yaml --port=8088 --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 s... |
Create an ingress called 'website-ingress' with a rule that directs requests from testing.com/example to svc1:8088 | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/example=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": "", "... |
Embed certificate authority data for the staging-cluster cluster entry | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/app-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 s... |
Taint nodes with key 'disktype' for instance=app-instance-1 | Command:
```bash
kubectl taint node -l instance=app-instance-1 disktype=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": "", "usag... |
Retrieve the replication controller named 'web', the service named 'security-service-rc', and the pod named 'monitoring-pod' | Command:
```bash
kubectl get rc/web service/security-service-rc pods/monitoring-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 na... |
Create a secret named tls-certificate-secret by providing a file and a literal value | Command:
```bash
kubectl create secret generic tls-certificate-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
```
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 b... |
List the replication controllers, services, and pods by their names | Command:
```bash
kubectl get rc/web service/proxy-server-rc pods/chat-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 namespac... |
Update the pod 'log-aggregator' by adding the annotation 'compliance-level' with the value 'PCI-DSS' | Command:
```bash
kubectl annotate pods log-aggregator compliance-level=PCI-DSS
```
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 includ... |
Run the 'elasticsearch' command in the 'stardust-shuttle' container of the pod 'monitoring-pod' and get the output | Command:
```bash
kubectl exec monitoring-pod -c stardust-shuttle -- 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 o... |
Retrieve the output from running the 'irb' command in the 'time-machine' container of the 'analytics-pod' pod. | Command:
```bash
kubectl exec analytics-pod -c time-machine -- irb
```
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... |
Open the search-service service for editing using the emacs editor | Command:
```bash
KUBE_EDITOR="emacs" kubectl edit svc/search-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables... |
Return the logs from a previous terminated container named "rocket-ranger" in the pod named "media-stream-pod" | Command:
```bash
kubectl logs -p -c rocket-ranger media-stream-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container"... |
Forward local port 3000 to port 8088 in the pod named proxy-server-pod. | Command:
```bash
kubectl port-forward pod/proxy-server-pod 3000 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 a... |
Copy the local file "/tmp/foo" to the "/tmp/bar_dir" directory of the "front-end-pod-12" pod, specifically in the "task-processor" container. | Command:
```bash
kubectl cp :/tmp/foo front-end-pod-12:/tmp/bar_dir -c task-processor
```
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... |
Listen on local port 9090 and forward data to/from port 5432 in the pod named web-app-pod | Command:
```bash
kubectl port-forward pod/web-app-pod 9090 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 automa... |
Add a taint with the key 'dedicated' and value 'app-node-6:PreferNoSchedule' on all nodes that have the label 'project=project-alpha' | Command:
```bash
kubectl taint node -l project=project-alpha dedicated=app-node-6: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... |
Set the CPU and memory limits for the mongo container in the deployment to "50m" and "128Mi" respectively. | Command:
```bash
kubectl set resources deployment mongo -c=nginx --limits=cpu=50m,memory=128Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-config deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
View the rollout history of the 'staging' deployment | Command:
```bash
kubectl rollout history deployment/staging
```
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 URL to files ident... |
Create a service for the replication controller specified in the "php-controller.yaml" file, serving on port 80 and connecting to the containers on port 8000. | Command:
```bash
kubectl expose -f php-controller.yaml --port=80 --target-port=808400
```
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... |
Copy the ~/.config/kube directory from a remote pod named front-end-pod-12 to the /tmp/bar directory on your local system. | Command:
```bash
kubectl cp kube-proxy/front-end-pod-12:~/.config/kube /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ... |
Run the 'elasticsearch --version' command in the nano-bot container of the backend-pod. | Command:
```bash
kubectl exec backend-pod -c nano-bot -- elasticsearch --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 om... |
Forward traffic from local port 5432 to port 8888 in the 'chat-app-pod' pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 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 pod will be selected autom... |
Update the 'email' pod by adding the annotation 'criticality' with the value 'high'. | Command:
```bash
kubectl annotate pods email criticality=high
```
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... |
Create a pod disruption budget named batch-processing-pdb with the following configurations: select all pods with the owner=team-1 label and require at least four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=owner=team-1 --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-availabl... |
Embed the certificate authority data for the 'app-cluster' cluster entry using the 'kubectl config set-cluster' command | Command:
```bash
kubectl config set-cluster app-cluster --embed-certs --certificate-authority=~/.kube/edge-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-... |
Execute a bash command on the first pod of the analytics-service service. | Command:
```bash
kubectl exec svc/analytics-service -- bash
```
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 kubect... |
Update the image of all containers in the daemonset 'prod' to 'python:3.9.7' | Command:
```bash
kubectl set image daemonset prod *=python:3.9.7
```
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:
`kubect... |
force replace the resource specified in the 'parameters.yaml' file | Command:
```bash
kubectl replace --force -f ./parameters.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 replace... |
Set the resource request and limits for all containers in the "node" deployment | Command:
```bash
kubectl set resources deployment node --limits=cpu=200m,memory=512Mi --requests=cpu=50m,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested,... |
Create a new config map named 'db-config' using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap db-config --from-file=conf=/path/to/configs/file1.txt --from-file=data=/path/to/options/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 m... |
Get the output from running the `docker run -it ubuntu` command in the first container of the first pod of the `cache-cluster-deployment` deployment. | Command:
```bash
kubectl exec deploy/cache-cluster-deployment -- docker run -it ubuntu
```
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.... |
Update the 'gateway-deployment' deployment by setting the new environment variable 'API_KEY' to 'your-api-key' | Command:
```bash
kubectl set env deployment/gateway-deployment API_KEY=your-api-key
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates ... |
Create a new config map named 'app-config' using the file 'file1.txt' from the '/path/to/profiles' directory and the file 'file2.txt' from the '/path/to/configurations' directory. | Command:
```bash
kubectl create configmap app-config --from-file=settings=/path/to/profiles/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 creati... |
create a job called 'image-build-job' with the nginx image and run the command "nginx -g 'daemon off;'" | Command:
```bash
kubectl create job image-build-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": "O... |
Create an ingress called 'private-api-ingress' that directs requests to site.com/bar to a service named svc1 on port 9092, and uses a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress private-api-ingress --rule="site.com/bar=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Create an ingress called 'public-service-ingress' that directs requests from testing.com/input to svc1:8083 and uses the tls secret "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/input=svc1:8083,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ... |
Get the output of the 'dotnet --list-runtimes' command from the first pod of the scheduler-service service. | Command:
```bash
kubectl exec svc/scheduler-service -- 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... |
Create a service for a replicated Hazelcast using replica set, which serves on port 9000 and connects to the containers on port 8083 | Command:
```bash
kubectl expose rs hazelcast --port=9000 --target-port=808300
```
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... |
Update the owner annotation of a pod specified in the "params.json" file | Command:
```bash
kubectl annotate -f params.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 arbitrar... |
Create a new pod named "hazelcast" using the "postgres" image and expose port 8084. | Command:
```bash
kubectl run hazelcast --image=postgres --port=8084
```
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": "-... |
Create a copy of the cdn-service-pod with the cosmic-container and change the command to "sh" for debugging. | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=debug-image-memcached --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 b... |
Annotate the pod 'cdn' with the annotation 'last-deployment' and the value 2023-03-15 | Command:
```bash
kubectl annotate pods cdn 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... |
Forward traffic from local port 3000 to port 8080 in a pod selected by the 'api-server-deployment' deployment | Command:
```bash
kubectl port-forward deployment/api-server-deployment 3000 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will b... |
Embed certificate authority data for the e2e cluster entry | Command:
```bash
kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/on-prem-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-clust... |
Embed the certificate authority data for the 'my-k8s-cluster' cluster entry by running the command: | Command:
```bash
kubectl config set-cluster my-k8s-cluster --embed-certs --certificate-authority=~/.kube/edge-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 s... |
Create an ingress called 'app-loadbalancer-ingress' with a rule that directs requests from 'website.com/module' to the service 'svc1' at port '9092' | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/module=svc1:9092,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default... |
Remove the 'on-prem-context' cluster context | Command:
```bash
kubectl config delete-context on-prem-context
```
What it does:
Delete the specified context from the kubeconfig.
Syntax:
`kubectl config delete-context NAME` |
Create a debug copy of the 'backend-pod' with a new container using the 'debian' image, and replace the 'app' container image with 'app:debug' and the 'mailer' container image with 'mailer:latest' | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-app --image=debian --set-image=app=app:debug,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 and ... |
Port forward locally listening on port 8080 and forwarding data to/from port 8888 in the chat-app-pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 8080 8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Create a LoadBalancer service named frontend-lb with port mapping from 8082 to 8888. | Command:
```bash
kubectl create service loadbalancer frontend-lb --tcp=8082:8888
```
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", "defaul... |
Forward traffic from port 6379 on all addresses to port 8000 in the frontend-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 6379: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... |
Copy the local file /tmp/foo_dir to the remote pod named database-pod-2 in the kube-public namespace, with the destination location /tmp/bar_dir. | Command:
```bash
kubectl cp /tmp/foo_dir kube-public/database-pod-2:/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... |
Create a copy of the proxy-service-pod and add a debug container to it | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=dgb-img --image=debian --set-image=worker=my-custom-worker:1.2.3,cache=redis:alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by r... |
Create a pod disruption budget with a specific selector and minimum availability constraint. | Command:
```bash
kubectl create poddisruptionbudget auth-service-pdb --selector=owner=team-1 --min-available=9
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N ... |
Get the output from running the 'kafka-server-start /etc/kafka/server.properties' command in the quantum-quark container of the backend-pod pod. | Command:
```bash
kubectl exec backend-pod -c quantum-quark -- kafka-server-start /etc/kafka/server.properties
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "u... |
Remove the label named 'bar' from the pod named 'analytics' | Command:
```bash
kubectl label pods analytics tier-
```
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 tr... |
Create a pod named 'hazelcast' using the 'ethereum/client-go' image, and configure the container to expose port 8443. | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --port=8443
```
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:
... |
Create an ingress with a rule that directs requests from foo.com/module to svc1:27017 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress app-ingress --rule="foo.com/module=svc1:27017,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 an ingress named "public-service-ingress" with a rule that directs requests to "website.com/module" and forwards them to the service "svc1" on port 8080 | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/module=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default":... |
Forward traffic from local port 8000 to port 8088 in the 'log-aggregator-pod' pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8000: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... |
Update the label of the pod named 'cdn' by setting the label 'component' to 'worker' | Command:
```bash
kubectl label pods cdn 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": "... |
List the deployments in the "third-party-apps" API group, version "legacy-1.0.0" in JSON output format. | Command:
```bash
kubectl get deployments.legacy-1.0.0.third-party-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 namespa... |
Switch to raw terminal mode and attach to the rocket-ranger container in the backend-pod | Command:
```bash
kubectl attach backend-pod -c rocket-ranger -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 omitt... |
Open the 'options.yaml' file in JSON format and edit the last-applied-configuration annotations using the kubectl apply command. | Command:
```bash
kubectl apply edit-last-applied -f options.yaml -o json
```
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 th... |
Attach to the 'nebula-navigator' container in the 'api-service-pod' pod and get the output | Command:
```bash
kubectl attach api-service-pod -c nebula-navigator
```
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 omit... |
Add a taint with the key 'zone' on nodes having the label zone=us-east-1 | Command:
```bash
kubectl taint node -l zone=us-east-1 zone=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": "", "usage... |
Forward local port 8000 to port 8088 in the pod named security-service-pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8000: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 select... |
Forward traffic from port 5000 on localhost and IP 10.19.21.23 to port 8080 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 5000: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 criter... |
Forward the local machine's random port to port 9090 in the e-commerce-pod container | Command:
```bash
kubectl port-forward pod/e-commerce-pod :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 automat... |
Forward local port 8088 to port 8000 in the 'api-server-deployment' deployment | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8088 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 b... |
Configure the custom TLS server name for the "star-cluster" cluster entry in the kubectl configuration. | Command:
```bash
kubectl config set-cluster star-cluster --tls-server-name=kube-cluster-1
```
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... |
Add a taint with key 'hardware' on nodes having label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 hardware=kube-master-9: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... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ file from the local machine to the /etc/kubernetes directory in a remote pod named cache-pod-5 | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ cache-pod-5:/etc/kubernetes -c metrics-exporter
```
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": "", "us... |
Create a deployment named 'mattermost' using the 'alpine' image and expose port 8010. | Command:
```bash
kubectl create deployment mattermost --image=alpine --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": "", "usage": "Output format. One o... |
Import the keys 'MAX_CONNECTIONS' from the 'app-settings' ConfigMap into the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-settings 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 variable def... |
Set the resource requests and limits for all containers in the hazelcast deployment | Command:
```bash
kubectl set resources deployment hazelcast --limits=cpu=200m,memory=512Mi --requests=cpu=10,memory=1Gi
```
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 reques... |
delete pods and services with the label "cluster" set to "my-cluster" | Command:
```bash
kubectl delete pods,services -l cluster=my-cluster
```
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 s... |
Update the label of pod 'frontend' to 'release=v1.0' | Command:
```bash
kubectl label pods frontend release=v1.0
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": ... |
Update the cluster field of a context to a specific cluster name. | Command:
```bash
kubectl config set contexts.client-2-context.cluster sun-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 ... |
Update the cluster role binding for Flux in the specified namespace and service account. | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:flux
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace... |
Create a job with a specific command using the provided image | Command:
```bash
kubectl create job monitoring-job --image=docker.elastic.co/elasticsearch/elasticsearch -- elasticsearch --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", "... |
Create a debug copy of the e-commerce pod by replacing all container images with busybox. | Command:
```bash
kubectl debug e-commerce-pod --copy-to=debug-image-web --set-image=*=busybox
```
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 ... |
Remove all taints with the key 'datacenter' from the node 'testing-node-11' | Command:
```bash
kubectl taint nodes testing-node-11 datacenter-
```
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.