Kubernetes Service

Umang PinchaUmang Pincha
2 min read

It is the method to expose your application with external world

In case we don’t have k8s service:

Let's say we don't have the k8s service feature, and a pod gets terminated. If the replicaset controller is set to 3, meaning it has auto-healing capabilities, then that particular pod will be assigned a different IP address. When a user tries to access that pod, it won't work because the IP address has changed. For these situations, we have a method called service.

Another Question Arises

Even a service (svc) will face the same issue when a pod is terminated and assigned a new IP. So, how does the svc allow users to access the pod?

Answer: It uses a method that involves labels and selectors to identify the pod instead of using the IP address. This way, even if the pod is terminated 1,000 times, it can be recognized by its label name. This process is known as service discovery.

Expose to world

3 ways in which svc expose application to the external world:

  • Cluster IP

    Only be accessed who has access to cluster.
  • NodePort

    Only be accessed who has access to worker nodes.
  • Load Balancer

    Expose the application to the outer world it uses cloud controller manager which is present in master node to provide the public IP by the load balancer services running on cloud provider platform like (AWS provide ELB) etc.
0
Subscribe to my newsletter

Read articles from Umang Pincha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Umang Pincha
Umang Pincha