202 β€” Services and Networking

Intermediate

Master Kubernetes Services to expose applications, enable pod-to-pod communication, and provide stable networking endpoints.

Learning Objectives

1
Understand Service types: ClusterIP, NodePort, LoadBalancer
2
Create Services to expose applications
3
Use DNS for service discovery
4
Configure service endpoints and selectors
Step 1

Create a Deployment to expose

Deploy an application that we'll expose via Services.

Commands to Run

kubectl create deployment web --image=nginx:alpine --replicas=3
kubectl get pods -o wide

What This Does

Create a 3-replica nginx Deployment. Note the pod IPs - they're ephemeral and change when pods restart.

Expected Outcome

3 nginx pods running, each with its own internal IP address.

Pro Tips

  • 1
    Pod IPs are not stable - they change on restart
  • 2
    Services provide stable endpoints
  • 3
    Don't hardcode pod IPs in configurations
Was this step helpful?

All Steps (0 / 10 completed)