Kubernetes Service

·

2 min read

👩‍💼 Ms. Cool: Hey! Come let’s go for a break.
👨‍💼 Mr. Chaos: I won’t be able to make it.
👩‍💼 Ms. Cool : What happened?
👨‍💼 Mr. Chaos: Our application has been rolled out to production environment. I invested considerable effort into configuring the load balancer, keeping DNS records up to date, and expanding the server capacity to manage increased traffic. Unfortunately, we encountered a server crash, and now it appears that I’ll need to repeat the entire process. This situation has devolved into a state of disarray.
👩‍💼 Ms. Cool: Relax. It’s the perfect moment to embrace Kubernetes service.

✅ Kubernetes Service
In Kubernetes, services refer to a specific type of resource that provides networking and load-balancing capabilities to expose a set of Pods as a network service within the cluster or to external world.

✅ Advantages of Service
💡 Load Balancing
💡 Service Discovery
💡 Expose to world

✅ Service Type
🎯 Cluster IP
Exposes the Service on a cluster-internal IP. Choosing this value makes the Service only reachable from within the cluster. This is the default that is used if you don't explicitly specify a type for a Service.

🎯 NodePort
Exposes the Service on each Node's IP at a static port (the NodePort). Every node in the cluster configures itself to listen on that assigned port and to forward traffic to one of the ready endpoints associated with that Service. You'll be able to access the application, from outside the cluster, by connecting to any node of the cluster using the appropriate protocol (for example: TCP), and the appropriate port (as assigned to that Service).

🎯 LoadBalancer
Exposes the Service externally using an external load balancer. On cloud providers which support external load balancers, setting the type field to LoadBalancer provisions a load balancer for your Service. The actual creation of the load balancer happens asynchronously, and information about the provisioned balancer is published in the Service's .status.loadBalancer field.

🎯 ExternalName
ExternalName services provide a way to map a service to a DNS name. They are used for connecting to external services by providing a DNS alias.