Is api server serviceIP iptable rule coded by kube-proxy? #9427
Replies: 2 comments
-
Generally speacking, Service IPs are allocated and distributed by Kubernetes. However, after you create a service then your CNI (here Calico) will write some iptables logic(using kube-proxy) or programs some eBPF logic (using libbpf) depending on your dataplane of choice to map those IPs to your workloads. Try calico certified operator course level 1 it has a dedicated module around this topic. |
Beta Was this translation helpful? Give feedback.
-
What do you mean by "setting" ? k8s is reponsible for allocating the IP and assigning it to the service (unless explicitly set by user). KUbe-proxy is responsible for implementing the service, that is, making sure that the service IP is translated to an IP of the backend pod. If you are using ebpf dataplane, calico's replacement of kube-proxy implements the service. calico is setting up many iptable rules, however, if you are using ebpf, then calico is not setting up rules for implementing services in iptables. |
Beta Was this translation helpful? Give feedback.
-
I am trying to understand in the cluster, who is responsible for setting the serviceIP, is it calico or kube-proxy? I am using kubeadm to start a k8s cluster, and deploy the calico by canal.yaml with bpf dataplane disabled.
We have some serviceIP like 10.96.0.13, and apparently I can see from felix logs that it's trying to code the iptable rule. However, I can also see that when cluster is initially provisioned, kube-flannel is trying to talk to API server with ip 10.96.0.1, and it failed with following logs
And then kube-flannel pod is restarted, and then it is able to connect to API server. So it looks to me that in this case, kube-proxy is apparently setting up the iptable rule for api server and 10.96.0.1, and I think calico-node container also needs to talk to API server, but for another cluster serviceIP, like 10.96.0.13, apparently calico-node is setting up the iptable rule. So my question is: is my understanding correct that kube-proxy will only be responsible for setting up 10.96.0.1? If yes, how does calico tell kube-proxy that calico should setup the iptable rule for other services?
Beta Was this translation helpful? Give feedback.
All reactions