Services

View saved

Pods change, Services stay

Pod IPs are temporary. A Service selects pods by labels and load-balances traffic to them.

Expose a Deployment

ClusterIP is the default Service type—reachable inside the cluster.

kubectl create deployment web --image=nginx:1.27
kubectl expose deployment web --port=80 --target-port=80
kubectl get services

Service types (overview)

  • ClusterIP — internal only (default)
  • NodePort — opens a port on each node for learning access
  • LoadBalancer — cloud provider external IP (or simulated locally)

Local access tips

With Minikube, minikube service web helps open a browser. With kind, port-forward is a friendly option:

kubectl port-forward service/web 8080:80
# Then visit http://localhost:8080

Comments

One comment per signed-in account. Comments are saved with this page’s URL.