Skip to main content
Networking & service meshLesson 1 of 11

Service Types (ClusterIP · NodePort · LoadBalancer)

Create one Service. Follow which pods it groups, and how far it is exposed depending on its type.

Service type—
Target pods—
Reachable from—
Kubernetes clusterExternal userOutside clusterLoad balancerExternal addressCaller podSame clusterWorker nodeNode IPServiceshop-svcshop-aapp=shopshop-bapp=shopshop-capp=shop
RequestResponse / reportWatchAppears in a later step

What you will learn

  • A Service picks pods by label, not by name
  • Why ClusterIP is reachable only inside the cluster
  • How NodePort and LoadBalancer expose it outside
  • A wrong selector silently leaves zero targets

Try it yourself​

kubectl get svc shop-svc -o wide # TYPE, CLUSTER-IP, EXTERNAL-IP, PORT(S), SELECTOR
kubectl get pods -l app=shop --show-labels # Are there pods matching the selector?
kubectl get endpointslices -l kubernetes.io/service-name=shop-svc # Are target pod addresses non-empty?
kubectl get svc shop-svc -o yaml # type, selector, ports, sessionAffinity

Check yourself

  1. An external user cannot reach a Service of type ClusterIP. Why?
  2. A LoadBalancer Service on-premises shows EXTERNAL-IP stuck at <pending>. What should you check?
  3. A Service exists with no error, but nothing connects and its endpoints are empty. What is the most likely cause?

Further reading: Service · EndpointSlices · Finding Services by Name (Service·DNS)