liveBook · Manning

Clusterip service type

As explained in Road to Kubernetes

A ClusterIP Service is a Kubernetes Service type that provides an internal cluster-only endpoint and balances traffic across selected Pods.

A ClusterIP Service provides an internal, cluster-only endpoint for Pods or Deployments. It lets containers communicate without exposing the selected workloads to the internet, while Kubernetes routes and balances requests across matching Pods. section 8.6 section 8.5.1

Use ClusterIP when a workload needs to remain reachable inside the cluster:

Internal PostgreSQL Service

A PostgreSQL StatefulSet can use a ClusterIP Service named postgres-svc. Its port and targetPort are both 5432, and selector app: postgres routes traffic to the matching database Pod. Local verification can use kubectl port-forward service/postgres 3312:5432, followed by a client connection to localhost:3312. section 8.4.2

Listing 8.21 ClusterIP Service for Postgres
apiVersion: v1
kind: Service
metadata:
  name: postgres-svc
spec:
  type: ClusterIP
  ports:
  - port: 5432
    targetPort: 5432
  selector:
    app: postgres

Inspect the complete ClusterIP Service manifest for PostgreSQL, including its port mapping and Pod selector. section 8.4.2

How Road to Kubernetes covers it

How deep it goes
Explains internal routing, label-based selection, ports, and practical verification, without detailing Kubernetes networking internals.
Examples
Uses internal APIs, databases, a PostgreSQL StatefulSet, kubectl port-forward, and a selector-based Service manifest.
What it assumes
Assumes Pods or Deployments and declarative YAML, while teaching that matching labels are required for Service routing.
What you can do after
Operate/configure a private Service with kubectl, labels, selectors, ports, and port forwarding.
How it connects
Connects Kubernetes Services with Pods, Deployments, StatefulSets, selectors, DNS, NodePort, and LoadBalancer Services.

Also explained in

Compare how 6 books explain clusterip service type →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.