kubernetes: Redhat 8 install kubernetes, that can't communication between the podip
What happened: Redhat 8 install kubernetes, that can’t communication between the podip
How to reproduce it (as minimally and precisely as possible): install kubernetes in redhat 8.
# install kubelet、kubeadm、kubectl
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet
systemctl start kubelet
# set firewall
firewall-cmd --zone=public --permanent --add-port={6443,2379,2380,10250,10251,10252}/tcp
# install cluster
kubeadm init --pod-network-cidr=10.254.0.0/16 --image-repository registry.aliyuncs.com/google_containers
# to start using cluster
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
# install calico
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
# use master node
kubectl taint nodes --all node-role.kubernetes.io/master-
podA (busybox): 10.254.219.69 podB (nginx): 10.254.219.68,listen 80 tcp port
kubectl exec -it podA – sh
/ # wget 10.254.219.68:80
Connecting to 10.254.219.68:80 (10.254.219.68:80)
wget: can't connect to remote host (10.254.219.68): No route to host
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version
):
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:59:43Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:51:19Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
-
Cloud provider or hardware configuration:
-
OS (e.g:
cat /etc/os-release
):
NAME="Red Hat Enterprise Linux"
VERSION="8.2 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.2"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.2 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.2:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.2
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.2"
- Kernel (e.g.
uname -a
):
Linux localhost.localdomain 4.18.0-193.el8.x86_64 #1 SMP Fri Mar 27 14:35:58 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Install tools:
- Network plugin and version (if this is a network-related bug):
calico
- Others: The problem was that the firewalld dropped the packet forwarding packet.
like this:
[root@localhost ~]# nft list chain inet firewalld filter_FORWARD
table inet firewalld {
chain filter_FORWARD {
type filter hook forward priority filter + 10; policy accept;
ct state { established, related } accept
ct status dnat accept
iifname "lo" accept
ip6 daddr { ::/96} reject with icmpv6 type addr-unreachable
jump filter_FORWARD_IN_ZONES_SOURCE
jump filter_FORWARD_IN_ZONES
jump filter_FORWARD_OUT_ZONES_SOURCE
jump filter_FORWARD_OUT_ZONES
ct state { invalid } drop
reject with icmpx type admin-prohibited
}
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (14 by maintainers)
Hi,
I solved this problem in CentOS 8 by creating a new firewalld zone for kubernetes pods and setting its target to ACCEPT. So, firewalld will accept packets going into POD SUBNET CIDR (ingress zone) and also packets coming out of POD SUBNET CIDR (egress zone)
Commands :
firewall-cmd man :
Versions :
To see what is getting rejected by firewalld, use the below commands
kubespray recommend to just stop firewalld, or to manage it manualy I personally leave firewalld enabled with basically the following rules
In the add-entry I put the nodes ips, the clusterIPs and podIPs cidr I have no idea if it affect Calico network policies as I don’t use them, but for sure your issue here is firewalld conf
your nft rule just allow any forwarding, might be too permissive
I’m not convinced that this is a documentation issue for Kubernetes. Maybe this’d work better as a Calico issue or support request?
@readerx Looks like you solved your issue report. If yes, could you please clarify it was firewalld settings? Could you please share what you did to solve it and close the issue report?