There are 3 types of services:
- Cluster IP which is the default service
- LoadBalancer : we need two of these , one for the nodes and one for the pods.
How it works:
End user hits the domain which hits the load balancer via DNS, the load balancer in turn hits the front end pod via node which then hits the backend service inside the cluster , which can provide access to the back end pod .
kubectl create svc clusterip name --tcp=49284:80
kubectl create svc nodeport name --tcp=49284:80
kubectl create svc loadbalancer name --tcp=49284:80
The selector label of service should match with the pods for the pods ip to be included in the endpoints.