Skip to content
Advanced ContainersLesson 4 of 5 2 min read

Kubernetes Networking & Scaling

ClusterIP, Ingress, and the Horizontal Pod Autoscaler - how traffic finds pods, and how pods multiply under load.

On this page4 sections

Getting traffic to the right Pods, and making sure there are enough of them, is most of what running Kubernetes in production actually feels like day to day.

Service types

A Service's type decides how it's reachable:

TypeReachable from
ClusterIP (default)Only inside the cluster
NodePortAny cluster node's IP, on a fixed port
LoadBalancerThe internet, via a cloud provider's load balancer

Most internal services (a database, an internal API another service calls) stay ClusterIP - no reason to expose them any wider than that.

Ingress

Giving every public-facing service its own cloud load balancer gets expensive and repetitive fast. An Ingress is a single entry point that routes HTTP traffic to many different internal Services, based on hostname or URL path:

example.com/api      → api-service
example.com/app      → frontend-service
blog.example.com     → blog-service

One load balancer, one place to manage TLS certificates, routing rules that live in your cluster's config as code.

Horizontal Pod Autoscaler (HPA)

Rather than someone watching a dashboard and manually running kubectl scale, an HPA does it automatically, based on a metric - CPU usage being the default:

target: 70% average CPU
min replicas: 2
max replicas: 10

Traffic spikes, average CPU climbs past 70%, the HPA adds Pods. Traffic drops back off, and it scales back down - the exact same elastic-scaling idea from the cloud-compute lesson, just applied one layer up, at the Pod level instead of the VM level.

Try it

Run these in the practice terminal (opens in a new tab). It opens in a new tab, so you keep your place here.
bash
netstat -tulpn

When you're ready, hit Mark complete and move to the next lesson.

Challenge

List every listening network port on this host - exactly what you'd check if a Service wasn't reaching its pods.

Want to experiment first? Try things in the practice terminal (opens in a new tab), then enter the command that solves the task here.

Quiz

Lock in the concepts. Score at least 80% to mark the lesson complete.

0 of 2 answered

Done with this one?

Skipped the challenge? You can mark the lesson complete by hand.

Your notes

Kept on this browser only.