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
1
vote
1 answer
ErrImagePull: Kubectl and Minikube when creating a pod
I'm new to Kubernetes and learning it these days. I'm trying to create a deployment with the help of kubectl and every time I create a deployment, the container is not running and I get ErrImagePull or ImagePullBackOff.
I have tried on two machines,…

Rehan Sattar
- 3,497
- 4
- 13
- 21
1
vote
1 answer
query cpu request and limit for each containers in kubernetes context / namespace with kubectl
Is there a way query cpu request and limit with kubectl for each container in a kubernetes context / namespace, just as I can query cpu usage with kubectl top pods.

morfys
- 2,195
- 3
- 28
- 35
1
vote
1 answer
Programmatically detect if a Kubernetes node is a master/control plane
How via command line can I detect if a Kubernetes node is a master/control plane or not? Is there an environment variable I can check?

Justin
- 42,716
- 77
- 201
- 296
1
vote
0 answers
Download directory from Pod to local using Python kubernetes client
I have been able to download a file from Pod to local using the Python Kube client. The code is available here.
However, I don't see any example to download directory from pod to local in the official examples.
As a workaround, I am creating a tar…

Geek-bit
- 21
- 3
1
vote
0 answers
kubectl logs -f missing log lines
I am doing some experiments, as we are obviously losing log lines currently in our Kubernetes setup.
Now as a test, I built a small python script that outputs 500000 log lines one after the other.
When recording this with kubectl logs -f podname…

peez80
- 1,583
- 2
- 15
- 32
1
vote
0 answers
How to run Kubectl command from Bastion Host on Private EKS clsuter
I have setup a EKS Cluster on in a VPC (VPC-1) with 2 private subnets and no public internet access. I have created another VPC (VPC-2) with a public subnet and launched a Bastion host in this VPC. Created VPC peering between VPC-1 and VPC-2. I have…

ZZzzZZzz
- 1,800
- 3
- 29
- 51
1
vote
1 answer
Pod is not found when trying to delete, however, can be patched
I have a pod that I can see on GKE. But if I try to delete them, I got the error:
kubectl delete pod my-pod --namespace=kube-system --context=cluster-1
Error from server (NotFound): pods "my-pod" not found
However, if I try to patch it, the…

Rodrigo
- 135
- 4
- 45
- 107
1
vote
1 answer
How to parse the command line output of a command and return a specific value
I need to return output of kubectl describe secret command output as a rest response. I first use kubectl get secret which support -o json to return the output in json form. But kubectl describe secret doesn't support this.
I have below output
…

Neeraj
- 13
- 6
1
vote
2 answers
minikube - EXTERNAL-IP remains
My Service definition is as follows
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
# if your cluster…

funtyper
- 165
- 1
- 9
1
vote
1 answer
Get docs for Resources (like kubectl explain) via Python
I would like to write a small programm similar to kubectl explain.
I use the python client.
With kubectl explain pods -v=8 I see which APIs get called.
The URL is /openapi/v2
I tried this:
from kubernetes import client, config
# Configs can be set…

guettli
- 25,042
- 81
- 346
- 663
1
vote
0 answers
Ephemeral Container kubectl debug prompt issue
I am trying to test Ephemeral Container in v1.23.5 & containerd://1.4.9 in minikube v1.23.0
after entering kubectl debug -it ephemeral-demo --image=busybox:1.35 --target=ephemeral-demo , i can see 2 issues
prompt displayed improper format. each…

Venkat G
- 11
- 2
1
vote
1 answer
Using kubectl logs in sidecar mode
To implement a log alerting solution, i need to retrieve directly logs from my containers. I can't use the solution deployed on kubernetes infrastructure (fluentd or other).
I am considering to use kubectl logs command (or access to kubernetes api…

Loïc
- 11
- 4
1
vote
2 answers
error: the path "nginx-deployment.yaml" does not exist when I use kubectl apply -f nginx-deployment.yaml
I use kubectl apply -f nginx-deployment.yaml enter image description here

Nawaf
- 11
- 2
1
vote
1 answer
kubectl keeps asking for login every command
What happened:
We're on AKS with RBAC enabled. Executing any kubectl/helm command that connects to the k8s cluster, I have to reauthenticate. Output:
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code…

keshav goyal
- 29
- 7
1
vote
0 answers
Kubernetes: no errors when editing node config, but changes not reflected
I am following this tutorial on kubernetes site to reconfigure my nodes so that I can change gracefullshutdown from 0s to 30s.
after generating the configz file from kubectl proxy, I made the changes and pushed it to the control plane kube-system…

jake wong
- 4,909
- 12
- 42
- 85