Hey Cloudees ☁️!
If you’re working with Kubernetes, you’ve likely encountered “𝐶𝑙𝑢𝑠𝑡𝑒𝑟𝐼𝑃, 𝑁𝑜𝑑𝑒𝑃𝑜𝑟𝑡, 𝑎𝑛𝑑 𝐿𝑜𝑎𝑑𝐵𝑎𝑙𝑎𝑛𝑐𝑒𝑟” services. But what are they, and when should you use each? 🤔 Let’s break it down!
1️⃣ 𝐂𝐥𝐮𝐬𝐭𝐞𝐫𝐈𝐏:
𝑾𝒉𝒂𝒕 𝒊𝒕 𝒅𝒐𝒆𝒔: Exposes the service 𝑤𝑖𝑡ℎ𝑖𝑛 𝑡ℎ𝑒 𝑐𝑙𝑢𝑠𝑡𝑒𝑟. Pods communicate using an internal IP.
𝑾𝒐𝒓𝒌𝑭𝒍𝒐𝒘: User request -> Service (clusterIP) -> Pods.
How Service identifies the pods?
Ans: Through pod “labels”
✅ 𝑷𝒓𝒐𝒔:
✨ Simplifies internal networking.
✨Secure 🔐: Not exposed externally.
❌𝑪𝒐𝒏𝒔:
✨ Not accessible from outside the cluster.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒: Your backend microservice connecting with a database service internally.
𝑵𝒆𝒕𝒘𝒐𝒓𝒌 𝒕𝒚𝒑𝒆: Internal
𝑺𝒄𝒂𝒍𝒂𝒃𝒊𝒍𝒊𝒕𝒚: High ⏫
𝑪𝒐𝒔𝒕: Low ⏬
𝑼𝒔𝒆 𝑪𝒂𝒔𝒆: Inter service communications within the cluster.
(Ideal for internal communication between microservices)
2️⃣ 𝐍𝐨𝐝𝐞𝐏𝐨𝐫𝐭
𝑾𝒉𝒂𝒕 𝒊𝒕 𝒅𝒐𝒆𝒔: Opens a specific port on each 𝑛𝑜𝑑𝑒 in the cluster, forwarding traffic to the service.
𝑾𝒐𝒓𝒌𝑭𝒍𝒐𝒘: User Request -> NodePort – > Service ( ClusterIP ) -> Pods
✅ 𝑷𝒓𝒐𝒔:
✨ Easy to set up.
✨ External access without a load balancer.
❌𝑪𝒐𝒏𝒔:
✨ Ports are limited (30000-32767).
✨ Not suited for production; lacks flexibility and scalability.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒: Sharing a simple app demo accessible via :.
𝑵𝒆𝒕𝒘𝒐𝒓𝒌 𝒕𝒚𝒑𝒆: External
𝑺𝒄𝒂𝒍𝒂𝒃𝒊𝒍𝒊𝒕𝒚: Low ⏬
𝑪𝒐𝒔𝒕: Low ⏬
𝑼𝒔𝒆 𝑪𝒂𝒔𝒆: Dev/test external access.
( For basic external access during development or testing)
3️⃣ 𝐋𝐨𝐚𝐝𝐁𝐚𝐥𝐚𝐧𝐜𝐞𝐫
𝑾𝒉𝒂𝒕 𝒊𝒕 𝒅𝒐𝒆𝒔: Provisions a 𝑐𝑙𝑜𝑢𝑑 𝑝𝑟𝑜𝑣𝑖𝑑𝑒𝑟’𝑠 𝑙𝑜𝑎𝑑 𝑏𝑎𝑙𝑎𝑛𝑐𝑒𝑟 to route external traffic.
𝑾𝒐𝒓𝒌𝑭𝒍𝒐𝒘: User request -> LoadBalancer -> NodePort -> Service( clusterIP) -> Pods
✅ 𝑷𝒓𝒐𝒔:
✨ Handles traffic distribution.
✨ Highly scalable and reliable.
❌𝑪𝒐𝒏𝒔:
✨ Tied to cloud providers (AWS, GCP, Azure).
✨ Can incur extra costs.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒: Hosting your e-commerce application for global customers.
𝑵𝒆𝒕𝒘𝒐𝒓𝒌 𝒕𝒚𝒑𝒆: External
𝑺𝒄𝒂𝒍𝒂𝒃𝒊𝒍𝒊𝒕𝒚: High ⏫
𝑪𝒐𝒔𝒕: High ⏫
𝑼𝒔𝒆 𝑪𝒂𝒔𝒆: Production apps requiring reliability.
(For production-level external access with scaling and reliability)
📌 𝐏𝐫𝐨 𝐓𝐢𝐩: For advanced traffic control, consider combining these with Ingress controllers or switching to modern solutions like Service Mesh!
What service type do you use most often? Share your experiences below! ⬇️
Our Next topic “𝐈𝐧𝐠𝐫𝐞𝐬𝐬” layer4 & Layer7.
Do like, comment,repost and share and support me for more simple DevOps related topics ❤️.
devops #cicd #dev #k8s #kubernetes #docker