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
0 answers
kubectl logs command gives error if worker node has IPv6 address
I have a 3-node cluster (1 master + 2 worker). I am exploring dual-stack capabilities of Kubernetes (version 1.21). I have used kubeadm to initialize this cluster.
To begin with, I see IPv4 address of nodes in the this command : command - kubectl…

darpan malhotra
- 11
- 1
1
vote
1 answer
Which Redis sentinel server should I connect to while connecting to Redis?
I am new to Redis and Kubernetes and have a Kubernetes cluster setup of 3 Redis and 3 Sentinel
kubernetes % kubectl -n redis get pods
NAME READY STATUS RESTARTS AGE
redis-0 1/1 Running 0 7d16h
redis-1 1/1 …

Avinav gupta
- 67
- 2
- 10
1
vote
1 answer
Using --net=host in Tekton sidecars
I am creating a tekton project which will spawn docker images which in turn will run few kubectl commands. This I have accomplished by using sidecars in tekton docker:dind image and setting
securityContext:
privileged: true
…

zXi
- 112
- 7
1
vote
2 answers
kubernetes delete jobs by name
I'm on a windows machine in a powershell prompt.
I don't have the Linux commands like grep, awk.
I have a couple of jobs that I want to delete
I'm not finding the correct syntax for deleting them such as
kubectl delete job…

CloudAnywhere
- 669
- 1
- 11
- 27
1
vote
1 answer
How to list deployments having specific environment variables
I would love to list deployments having mongodb environment value along with their phase status. Is there anyway to do so?
With this command, I get the deployments name which carries a specific environment value
kubectl get deploy…

titanic
- 87
- 1
- 11
1
vote
1 answer
Customizing kubectl output with go templates using custom function
I'm trying to add a custom function In Go template for parsing the time in PodStatus and getting the absolute time for it.
Example for the custom function:
PodScheduled, _ := time.Parse(time.RFC3339, "2021-12- 23T20:20:36Z")
Ready, _ :=…

Zipzap
- 121
- 2
- 5
1
vote
1 answer
Redirect everything with ingress-nginx
I have created a YAML file its only job is: It should immediately redirect to google.com
but it just doesn't work...
my localhost still returns 404-nginx
I'm on docker-desktop and my cluster version is v1.21.5
here is my redirect.yaml
apiVersion:…

Ali
- 922
- 1
- 9
- 24
1
vote
0 answers
Kubectl deleting of a namespace is always stuck
I am encountering a very weird issue. Every time when I try to create a new namespace using kubectl create namespace xx then when I try to delete it, the operation becomes stuck:
[root@k8s-master-node ~]# kubectl delete namespace xx2
namespace "xx2"…

DobreMihaela
- 174
- 1
- 10
1
vote
1 answer
How to print Status fields defined in Kubebuilder to show up when using Kubectl
How do I have to specify the comments like +kubebuilder:printcolumn to add columns to the output of the command kubectl get my-crd.my-group.my-domain.com?
I've a CRD (Custom Resource Definition) with the usual structs for the specs and the status…

TPPZ
- 4,447
- 10
- 61
- 106
1
vote
1 answer
Run Pod with unique POD name
I have a script which execute on container and i use following command to create my container and exit once execution complete, this is working as per our requirement.
kubectl run -i tmp-pod --rm -n=mynamespace --image=placeholder --restart=Never…

user1591156
- 1,945
- 4
- 18
- 31
1
vote
2 answers
Cannot create namespaces in AWS Elastic Kubernetes Service - Forbidden
I am trying to host an application in AWS Elastic Kubernetes Service(EKS). I have configured the EKS cluster using the AWS Console. Configured the Node Group and added a Node to the EKS Cluster and everything is working fine.
In order to connect to…

arjunbnair
- 330
- 7
- 18
1
vote
1 answer
What are "snapshot logs" and how they differ from "standard(?) logs" in Kubernetes?
I was looking for a way to stream the logs of all pods of a specific deployment of mine.
So, some days ago I've found this SO answer giving me a magical command:
kubectl logs -f deployment/ --all-containers=true
However, I've just…

Teodoro
- 1,194
- 8
- 22
1
vote
1 answer
Is there a docker daemon equivalent to kubectl port-forward?
Let's say you have a long docker-compose file with a lot of containers that speak to one another inside of a docker network. Let's call this a "stack". You want to launch this stack 3 times, each with a slightly different config. To do that you…

101010
- 14,866
- 30
- 95
- 172
1
vote
1 answer
AKS : kubectl exec & kubectl log exits in between while the process is running in the container still
I am running the following kubectl exec & kubectl logs cmd at the same time on two different windows command prompt
kubectl exec ${pod} containername -n namespace -- bash -c "cd somebatch.ksh > /proc/1/fd/1 2>&1"
kubectl logs ${pod} containername…

One Developer
- 99
- 5
- 43
- 103
1
vote
0 answers
AKS timeout container kubectl Rollout status check failed
I have a sporadic issue that I am struggling to understand - azure pipeline on promote fails due to kubectl rollout status Deployment/name --timeout 120s --namespace xyz
I have tried to increase the progressDeadlineSeconds, but I know it may not…

enavuio
- 1,428
- 2
- 19
- 31