kubernetes: Listen tcp :53: bind: permission denied ERROR!!
What happened?
kubectl get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-flannel kube-flannel-ds-962vp 1/1 Running 0 15m
kube-flannel kube-flannel-ds-qs6xr 1/1 Running 0 15m
kube-system coredns-7db6d8ff4d-6w776 0/1 CrashLoopBackOff 1 (10s ago) 12s
kube-system coredns-7db6d8ff4d-99tng 0/1 CrashLoopBackOff 1 (9s ago) 12s
kube-system etcd-controlplane 1/1 Running 0 12m
kube-system kube-apiserver-controlplane 1/1 Running 0 12m
kube-system kube-controller-manager-controlplane 1/1 Running 0 12m
kube-system kube-proxy-hbt5b 1/1 Running 0 12m
kube-system kube-proxy-x96js 1/1 Running 0 11m
kube-system kube-scheduler-controlplane 1/1 Running 0 12m
I was setting up the single-node k8s cluster (1 controlplane and 1 worker node). After going through all the installation process from the official k8s site -> at last, after deploying the network plugin on the k8s cluster. CoreDNS pods went into a Crashloopbackoff state. I did check for the container logs and found the following error message:
listen tcp :53: bind: permission denied
Please look into this and provide some insights. I have faced same issue while upgrading the cluster from v1.29 to v1.30.
Thanks & Regards, Tej Singh Rana
What did you expect to happen?
Both coreDNS pods should be in the running state, after deploying the network plugin.
How can we reproduce it (as minimally and precisely as possible)?
Simply follow the steps from the official k8s site.
Anything else we need to know?
I did some tests, and I used 1024 instead of 53 port, and it started to work. (AFAIK, using below port ~1000 was not working)
kubectl logs -n kube-system coredns-7db6d8ff4d-wchnq
.:1024
[INFO] plugin/reload: Running configuration SHA512 = e20da72760199c1bc59098f3ae16621ae48df8f7756e50bd0dfa5553ccb7be57af61562fff46a43fdcce51ac086b26aa19929386004908ad3afe3aea9b06316a
CoreDNS-1.11.1
linux/amd64, go1.20.7, ae2bbc2
Environment:
- the version of CoreDNS: registry.k8s.io/coredns/coredns:v1.11.1
- Corefile: The below content is from the
corednsconfigMap.
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
}
- logs:
listen tcp :53: bind: permission denied
Kubernetes version
$ kubectl version
Client Version: v1.30.0 <br>
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 <br>
Server Version: v1.30.1
Cloud provider
N/A
OS version
# On Linux:
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
$ uname -a
Linux controlplane 5.4.0-1106-gcp #115~18.04.1-Ubuntu SMP Mon May 22 20:46:39 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Install tools
kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.1
kubelet --version
Kubernetes v1.30.0
kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"30", GitVersion:"v1.30.0", GitCommit:"7c48c2bd72b9bf5c44d21d7338cc7bea77d0ad2a", GitTreeState:"clean", BuildDate:"2024-04-17T17:34:08Z", GoVersion:"go1.22.2", Compiler:"gc", Platform:"linux/amd64"}
Container runtime (CRI) and version (if applicable)
containerd containerd.io 1.6.26 3dd1e886e55dd695541fdcd67420c2888645a495
Related plugins (CNI, CSI, …) and versions (if applicable)
Service Account: flannel
Init Containers:
install-cni-plugin:
Image: docker.io/flannel/flannel-cni-plugin:v1.4.1-flannel1
Port: <none>
Host Port: <none>
Command:
cp
Args:
-f
/flannel
/opt/cni/bin/flannel
Environment: <none>
Mounts:
/opt/cni/bin from cni-plugin (rw)
install-cni:
Image: docker.io/flannel/flannel:v0.25.2
Port: <none>
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (8 by maintainers)
It has seen in few other setups as well with Kubernetes 1.29.4 and 1.30.1, coredns v1.11.1 ( non-root image and run) and containerd 1.6.
Workaround:
Non-system port bindingnet.ipv4.ip_unprivileged_port_start/EnableUnpriviledPortslooks to be helping to workaround the issue.However still not able to completely figure out the exact reason. The capability bit looks to be not set for privileged bind by a non-root user in our context:
Could be a combination of Kernel+capabilities , but yet to figure out the exact reason.
a better place to ask would be on the support channels. please see: https://git.k8s.io/kubernetes/SUPPORT.md
/kind support /close
I have similar issue with an RKE 1.29 install (1.6.0-rc6 v1.29.5-rancher1-1) with the CoreDNS deployment in the kube-system namespace. The pods are in Error and show the same message : “listen tcp :53: bind: permission denied” I can fix the problem by setting the “allowPrivilegeEscalation” to true in the core-dns deployment Security Context but in my older RKE deployments (1.28) it is working fine with the default allowPrivilegeEscalation set to false…
I’m wondering if something has changed in the new Kubernetes or container version (I also now have a new seccompProfile set in the coredns deployment securityContext definition…) ?
It’s an issue, that’s why I raised here to address.
[root@node1 ~]# kubectl logs -n kube-system coredns-5f98f8d567-5h7b4 kubectl logs -n kube-system coredns-5f98f8d567-j2hl6 Listen: listen tcp :53: bind: permission denied Listen: listen tcp :53: bind: permission denied [root@node1 ~]# sudo lsof -i :53 [root@node1 ~]# sudo netstat -tuln | grep :53 [root@node1 ~]# sudo netstat -tuln | grep :53
K8S 1.29.5&kube-flannel