The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs.
Questions tagged [kubectl]
3648 questions
37
votes
6 answers
Delete kubernetes cluster on docker-for-desktop OSX?
What is the equivalent command for minikube delete in docker-for-desktop on OSX
As I understand, minikube creates a VM to host its kubernetes cluster but I do not understand how docker-for-desktop is managing this on OSX.

John Smith
- 433
- 1
- 4
- 9
37
votes
6 answers
Kubernetes - How to know latest supported API version
Is there a table that will tell me which set of API versions I should be using, given a k8s cluster version? Kubernetes docs always assume I always have a nice, up-to-date cluster (1.12 at time of writing) but platform providers don't always live on…

s g
- 5,289
- 10
- 49
- 82
37
votes
3 answers
kubectl ls -- or some other way to see into a POD
I'm using kubectl cp to copy a jar file from my local file system into a the home directory of a POD in my minikube environment. However, the only way I can confirm that the copy succeeded is to issue a new kubectl cp command to copy the file back…

Greg Charles
- 1,880
- 4
- 20
- 39
36
votes
4 answers
kubectl context vs cluster
In the world of kubectl and kubernetes config, what's the difference between context and a cluster? For example I see these commands:
Available Commands:
current-context Displays the current-context
delete-cluster Delete the specified cluster…
user7898461
34
votes
4 answers
How to remove warning in kubectl with gcp auth plugin?
When I run any kubectl command I get following WARNING:
W0517 14:33:54.147340 46871 gcp.go:120] WARNING: the gcp auth plugin is deprecated in v1.22+, unavailable in v1.25+; use gcloud instead.
To learn more, consult…

Alexander Meise
- 1,328
- 2
- 15
- 31
34
votes
2 answers
How to delete a deployment / image in kubernetes
I'm running kubernetes in azure.
I want to delete a specific deployment, with AZ AKS or kubectl.
The only info I've found is how to delete pods, but this is not what I'm looking for, since pods will regenerate once deleted.
I know I just can go to…

Carlo Luther
- 2,402
- 7
- 46
- 75
34
votes
2 answers
Script to continuously follow kubectl get pods
I'm trying to build a script that can follow(-f) kubectl get pods see a realtime update when I make any changes/delete pods on Ubuntu server.
What could be the easiest/efficient way to do so?

Swapnil Patel
- 757
- 1
- 7
- 9
34
votes
5 answers
Downgrade kubectl version to match minikube k8s version
I started minikube with k8s version 1.5.2 and I would like to downgrade my kubectl so that it is also 1.5.2. Currently when I run kubectl version I get:
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5",…

appdap1
- 521
- 1
- 6
- 17
34
votes
4 answers
Kubernetes assign pods to pool
is there a way to tell kubectl that my pods should only deployed on a certain instance pool?
For example:
nodeSelector:
pool: poolname
Assumed i created already my pool with something like:
gcloud container node-pools create poolname…

PlagTag
- 6,107
- 6
- 36
- 48
34
votes
2 answers
kubectl YAML config file equivalent of "kubectl run ... -i --tty ..."
I've been using "kubectl run" with assorted flags to run Jobs interactively, but have recently outgrown what I can do with those flags, and have graduated to using YAML config files to describe my jobs.
However, I can't find an equivalent to the…

garethw
- 483
- 1
- 4
- 6
32
votes
2 answers
kubelet does not have ClusterDNS IP configured in Microk8s
I'm using MicroK8S in Ubuntu.
I'm trying to run a simple "hello world" program but I got the error when a pod is created.
kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to "Default"…

Azeem Haider
- 509
- 1
- 4
- 10
32
votes
3 answers
How can I determine the current ephemeral-storage usage of a running Kubernetes pod?
How can I tell with kubectl how much ephemeral storage a pod is currently using?
In a Kubernetes pod spec, I can specify resource requests and limits for CPU, memory, and ephemeral storage:
resources:
requests:
memory: "60Mi"
cpu: "70m"
…

bskaggs
- 1,374
- 2
- 12
- 24
32
votes
10 answers
Failed create pod sandbox: rpc error: code = Unknown desc = NetworkPlugin cni failed to set up pod network
Issue Redis POD creation on k8s(v1.10) cluster and POD creation stuck at "ContainerCreating"
Type Reason Age From Message
---- ------ ---- ---- …

suboss87
- 479
- 2
- 10
- 14
31
votes
3 answers
Service account secret is not listed. How to fix it?
I have used kubectl create serviceaccount sa1 to create service account. Then I used kubectl get serviceaccount sa1 -oyaml command to get service account info. But it returns as below.
apiVersion: v1
kind: ServiceAccount
metadata:
…

racketer
- 345
- 1
- 5
- 9
31
votes
4 answers
What is the difference between namespaces and contexts in Kubernetes?
I found specifying like kubectl --context dev --namespace default {other commands} before kubectl client in many examples. Can I get a clear difference between them in a k8's environment?

Kishor Unnikrishnan
- 1,928
- 4
- 21
- 33