Debug School

Ananthu PM
Ananthu PM

Posted on

K8S - Service

What is service?

service is a routing used to manage network traffic between pods.
When we have multiple pods service make management and discovery of service make easy.

service manage pods which match the pods label with service selector field.

Service can be creating as 4 types:

  • clusterip
  • nodeport
  • loadbalancer
  • ExternalName

clusterip

cluserip used to create service which need to accessible only inside the cluster.
which manage different pods as single endpoint.

kubectl create service clusterip service-name --tcp=5678:80
Enter fullscreen mode Exit fullscreen mode

nodeport

nodeport used to create service and port forward to each Node/host port include master node.

kubectl create service nodeport service-name --tcp=5678:80
Enter fullscreen mode Exit fullscreen mode

loadbalancer

load balancer create service that can be accessible from out side as single endpoint and this service balance the traffic and route the traffic to the node port which port forward to the clusterip service.

kubectl create service loadbalancer service-name --tcp=5678:80
Enter fullscreen mode Exit fullscreen mode

Top comments (0)