Home > front end >  difference between Kubeproxy and service
difference between Kubeproxy and service

Time:09-06

I see in an article that I can access to pods from kubeproxy, so what is the role of kubernetes service here? and what is the difference between Kube Proxy and service? finally, is kube proxy part of service?

CodePudding user response:

From my understanding

  1. If you are only accessing the pod ports inside the cluster, then there are no Service involved, as you need Service objects to expose your pods outside of your Cluster

  2. Service exposes your pods outside of your Cluster. Service provides a stable virtual IP address. A controller keeps track of the pods that are associated with the Service. While kube-proxy is a daemon running on each node and watches the service resources defined in the cluster and manages the rules for the requests on a Service’s backend pods

  3. kube-proxy interacts with the Service so kube-proxy can change the iptable rules when there are changes on Service objects. Hence they are separate entities.

CodePudding user response:

We can discuss this for a while, but let's short a long story.

  1. Requests come to Service
  2. Then Service passes it to Kube-Proxy
  3. Kube-Proxy decides to which Pod this request go

How requests are forwarded from Service to Pod
  • Kube Proxy forwards the request
  • Responsible for maintaining a list of Service IPs and corresponding Pod IPs

Check this section for more details...

CodePudding user response:

As far as I understand:

Service is a Kubernetes object that has a stable name and stable IP and sits in front of a set of pods. All requests sent to the pods should go to the service.

Kube-proxy is a networking component running on every cluster node(basically its a Daemonset). It implements the low-level rules to allow communication to pods from inside as well as outside the Kubernetes Cluster. We can say that kube-proxy is a part of service.

So when a user tries to reach an application deployed on Kubernetes first it reaches the service and then forwards the request one of the underlying pods. This is done by using the rules that Kube proxy created.

For more understanding refer this video : Kube proxy & blog Closer look at Kube proxy

  • Related