Learn Services in Kubernetes

What is a Service?

Services in Kubernetes nothing but load balancer. It is load balancer for POD. It enables a group of pods, which provide specific functions (web services, image processing, etc.) to be assigned a name and unique IP address (clusterIP).

What is the types Services?

  • ClusterIP. Exposes a service which is only accessible from within the cluster.
  • NodePort. Exposes a service via a static port on each node’s IP.
  • LoadBalancer. Exposes the service via the cloud provider’s load balancer.
  • ExternalName. Maps a service to a predefined external Name field by returning a value for the CNAME record.

What is the use of service named with “kubernetes” in default namespace?

The kubernetes service in the default namespace is a service which forwards requests to the Kubernete API server. All the requests to the kubernetes default service from the cluster will be routed to the configured Endpoint IP.

How services works?

A Kubernetes service is a logical abstraction for a deployed group of pods in a cluster (which all perform the same function). Since pods are ephemeral, a service enables a group of pods, which provide specific functions (web services, image processing, etc.) to be assigned a name and unique IP address (clusterIP).