Services In Kubernetes

Services in Kubernetes are logical abstraction for a deployed group of pod in cluster. A service is responsible for exposing an interface to those pods, which enables network access from either within the cluster or between external processes and the service.

Types Of Services In Kubernetes

  1. ClusterIP – exposes a service which is only accessible from within the cluster
  2. NodePort – exposes a services via static port on each node’s IP which help to access service from outside the cluster
  3. LoadBalancer – exposes the service via the cloud provider’s load balancer
  4. ExternalName – Maps a service to a predefined externalName field 

Use Of Service named Kubernetes in default Namespace

Kubernetes service in the default namespace is used to forward the request to the Kubernetes master which is basically the API Server. So all the requests to the Kubernetes default service from the cluster will be routed to the configured Endpoint IP.

How does services work in Kubernetes?

For a service to work, the label selector at the load balancer should match the label selector of the pod so that the endpoint IP can be configured and the services can be accessible accordingly.