calico: Failed to connect to kube-dns after setting up calico cni
Expected Behavior
Should be able to connect with kube-dns ip from any of the pods
Current Behavior
Fails to connect with kube-dns service ip from within the pod and because of this any operation that needs dns resolution fails inside any of the scheduled pods in the cluster.
Possible Solution
Steps to Reproduce (for bugs)
Context
I’ve setup kubernetes v1.29 using kubeadm and using tiegra operator for setting up the calico version v3.27.3. All of the calico-nodes are running fine without any restarts and I don’t see any obvious errors.
Installation config
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec:
# Configures Calico networking.
logging:
cni:
logSeverity: Debug
serviceCIDRs:
- "172.31.0.0/16"
calicoNetwork:
# Note: The ipPools section cannot be modified post-install.
bgp: Disabled
ipPools:
- blockSize: 26
cidr: 192.168.0.0/16
encapsulation: VXLANCrossSubnet
natOutgoing: Enabled
nodeSelector: all()
---
I also tried by removing `serviceCIDRs` from the `Installation` manifest because it's defined in kubadm config too `ClusterConfiguration`, but didn't work for me
# This section configures the Calico API server.
# For more information, see: https://docs.tigera.io/calico/latest/reference/installation/api#operator.tigera.io/v1.APIServer
apiVersion: operator.tigera.io/v1
kind: APIServer
metadata:
name: default
spec: {}
Nodes
main-k8s-master-1 Ready control-plane 67m v1.29.4
main-k8s-master-2 Ready control-plane 68m v1.29.4
main-k8s-master-3 Ready control-plane 67m v1.29.4
main-k8s-regular-1 Ready <none> 66m v1.29.4
All pods in calico-system namespace
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-7f94fb7cd8-jsqpg 1/1 Running 0 8m29s
calico-node-4b9l6 1/1 Running 0 8m29s
calico-node-88kqr 1/1 Running 0 8m29s
calico-node-nsks9 1/1 Running 0 8m29s
calico-node-zppdr 1/1 Running 0 8m29s
calico-typha-677c4f7b68-6d6qn 1/1 Running 0 8m29s
calico-typha-677c4f7b68-pqwxb 1/1 Running 0 8m21s
csi-node-driver-7t6zz 2/2 Running 0 8m29s
csi-node-driver-gpbrz 2/2 Running 0 8m29s
csi-node-driver-rjbrg 2/2 Running 0 8m29s
csi-node-driver-s5xhk 2/2 Running 0 8m29s
ubuntu 1/1 Running 0 6m43s
Service kube-dns
kube-dns ClusterIP 172.31.0.10 <none> 53/UDP,53/TCP,9153/TCP 62m
From withing the pod I’m able to connect to any external public IP but the dns resolution fails because of timeout. the rest of pods ip allocation and everything works as expected.
ubuntu:~# curl google.com
curl: (6) Could not resolve host: google.com
ubuntu:~# telnet 172.31.0.10 53
telnet: can't connect to remote host (172.31.0.10): Operation timed out
ubuntu:~# telnet 142.250.181.142 443
Connected to 142.250.181.142
Although I’m able to connect with other service IP’s for example
ubuntu:~# telnet 172.31.219.128 5473
Connected to 172.31.219.128
I’m sure I’ve allowed all required ports from the firewall ingress/egress from all the k8s nodes that are listed here https://docs.tigera.io/calico/latest/getting-started/kubernetes/requirements#network-requirements
Your Environment
- Calico version:
v3.27.3 - Kubernetes version:
v1.29 - Operating System and version:
Ubuntu 22.04 - Containerd:
v1.29.0SystemdCgroup = trueSystemd Groups are configured correctly BTW
I’m new to setting up calico so I’d really appreciate all the help, I can shared the calico-node logs if that’s required.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 29 (7 by maintainers)
I changed to using tigera-operator instead of just a manifest file. v1.34.5
We ran into a similar issue when we tested Calico. Only difference in our setup is that we run IPv6 Single-Stack. DNS was not working, but the underlying issue was deeper and general pod-to-pod traffic was not working between pods on different nodes.
Config looked as follows:
The root cause in our setup seems to be that the VXLAN device is not used as routes are incorrectly set by Calico:
We were expecting
fd80:cafe::a8:4d00/122 via fd01:cafe::f14c:9fa1:8496:5550 dev eth0 proto 80 metric 1024 onlink pref mediumto go through the vxlan interface and not be directly routed to the second node (fd01...).@matthewdupre Hopefully that helps. We are currently working around this issue by using flannel, but would prefer calico.
Glad more people are finally running into this…
I have the same problem, pods not able to resolve pods in same namespace. VMs (9) are RHEL9, k8s 1.30.4, calico 3.28.1. Using calico host firewall, no firewalld. CRI-O for runtime. Calico installed with manifest. hot fix does not work - restart coredns deployment. If i exec into an init container that is stuck with bad address output, nc gives bad address, nslookup of coredns - no route to host. To me it looks like the Pod network can not talk to the clusterip network.
Could one of you please help me out with some diags?
What I’d like to know is:
ip addrandip routefrom the nodes containing your client pod and kube-dns, and record the IP addresses of both of those pods.iptables -Zon the node with the client, then try a dig, and then captureiptables-save -cfrom the node with the clienti dont have any firewall rules, pretty vanilla setup… for me if I only have one node, I get pods that can’t do dns/TLS verification.
I found something. If coredns pods runs on
masternodes then no pod can communicate to it overtcpbut if coredns runs onworkernodes then pods can connect with thecorednspods and able to resolve dns. I don’t have any specific networkpolicy configured. Does anyone know what could be the issue? From the looks of it I’d say it’s firewall issue on master node vm’s but I’ve added allow all ingress tcp0.0.0.0/0and that doesn’t work so it might be something elseI also have the same version v3.27.3 and encountered the same problem nc -uvz 10.10.0.2 53 is Connected, but dig timeout. It is normal if you use dig +tcp