Sitemap
Vijaykumarbangaru

Vijaykumarbangaru

DevOps Engineer passionate about Docker, Kubernetes, and cloud infrastructure.

Kubernetes Services — How Networking Works(Day-8)

2 min readMar 22, 2026

--

In Kubernetes, Pods are ephemeral.

This means:

  • Pods can die
  • Pods can be recreated
  • IP addresses change

So we need a stable way to access them.

👉 This is where Services come in.

Press enter or click to view image in full size

1️⃣ What is a Service?

A Service is a Kubernetes object that provides:

✔ Stable IP
✔ Stable DNS name
✔ Load balancing

It acts as a bridge between users and Pods.

2️⃣ Why Services Are Needed

Without Service:

❌ Pod IP changes → App breaks

With Service:

✔ Stable endpoint → App works consistently

3️⃣ Types of Kubernetes Services

🔹 ClusterIP (Default)

  • Accessible only within the cluster
  • Used for internal communication

Example:

Frontend → Backend

🔹 NodePort

  • Exposes application on a port of each node
  • Accessible using:
<NodeIP>:<NodePort>

🔹 LoadBalancer

  • Exposes application externally
  • Uses cloud provider load balancer

Example:

Get Vijaykumarbangaru’s stories in your inbox

Join Medium for free to get updates from this writer.

AWS ELB / Azure LB

4️⃣ Service Example (YAML)

apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP

Apply:

kubectl apply -f service.yaml

5️⃣ How Service Works Internally

Flow:

User → Service → Pod

Service selects Pods using labels.

Example:

app: nginx

6️⃣ Real DevOps Scenario 🔥

Problem:

Application is running but not accessible.

Steps:

1️⃣ Check service

kubectl get svc

2️⃣ Check endpoints

kubectl get endpoints

👉 If endpoints = empty
➡ Label mismatch issue

7️⃣ Common Issues

❌ Service not working
→ Label mismatch

❌ Cannot access app
→ Wrong service type

❌ No endpoints
→ Pods not matching selector

8️⃣ Key Takeaways

  • Services provide stable networking
  • Pods are dynamic, Services are stable
  • Essential for communication in Kubernetes

Conclusion

Services are the backbone of Kubernetes networking.

Without Services, applications cannot communicate reliably.

📌 In Day 9, we will cover:

👉 Ingress — Managing External Traffic

--

--

Vijaykumarbangaru
Vijaykumarbangaru

DevOps Engineer passionate about Docker, Kubernetes, and cloud infrastructure.