Kubernetes Services

Services

Kubernetes services connect a set of pods to an abstracted service name and IP address. Services provide discovery and routing between pods. Services use labels and selectors to match pods with other applications

Types of Services

ClusterIP service

ClusterIP is the default type of service, which is used to expose a service on an IP address internal to the cluster. Access is only permitted from within the cluster.

NodePort service

NodePorts are open ports on every cluster node. Kubernetes will route traffic that comes into a NodePort to the service, even if the service is not running on that node. Exposes a service via a static port on each node’s IP.

ExternalName service  

ExternalName services are similar to other Kubernetes services; however, instead of being accessed via a clusterIP address, it returns a CNAME record with a value that is defined in the externalName: parameter when creating the service.

 Load Balancer service

 Exposes the service via the cloud provider’s load balancer.

How does Kubernetes services works?

Services simply point to pods using labels. Labels of the pod must match the selector of service. Then endpoind IP is configured.

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 Kubernetes master ( Typically kubernetes API server).So all the requests to the kubernetes. default service from the cluster will be routed to the configured Endpoint IP.