October 19, 2024

In Kubernetes, there are Service resources available as a way to expose applications within a cluster. These Service resources come in four types:

  • ClusterIP: Allocates a reachable IP address within the Kubernetes cluster to expose the application. The IP is NOT exposed to external services.
  • NodePort: Associates the application with port numbers on each node and ClusterIP for external access. Cluster IP which is associated with the NodePort, is automatically allocated.
  • ExternalName: Links the created Service resource with a user-defined DNS name.
  • Load Balancer: Provisions a load balancer based on the configured settings, either from a cloud provider or one you’ve set up yourself, and associates it with the application for external access.

Among these four types, ClusterIP, NodePort, and Load Balancer support load balancing using IP addresses or port numbers. Specifically, ClusterIP and NodePort work in conjunction with kube-proxy, using iptables or IPVS to distribute the load, while LoadBalancer employs a load balancer for load distribution.