liveBook · Manning

Service IP

As explained in Kubernetes for Developers

A cluster-local IP address is an address reachable within a Kubernetes cluster but not normally from the public internet.

A service IP is a cluster-local address for reaching a Kubernetes Service from other Pods. It is normally unavailable from the public internet. A Service provides a stable access point even while its Pods change, and routes traffic only to running Pods that can receive it. section 3.2.5 section 7.1.2

A service IP supports several practical deployment behaviors:

  • Connects applications inside a microservice architecture without exposing every application publicly. section 7.0
  • Load-balances requests across selected Pods and adapts as replicas become unavailable or temporarily exceed the desired count during rollout. section 3.2.5
  • Supports service discovery through environment variables and DNS, avoiding dependence on manually recorded addresses. section 7.3
  • Differs from an external IP: a ClusterIP Service has no external IP, while other Service types can additionally expose an application. section 7.1.2 section 3.2.5

Calling an internal service

A Robohash Service receives the cluster IP 10.63.254.218. Other Pods can request http://10.63.254.218/example, but a client outside the cluster cannot normally reach that address. For local testing, kubectl port-forward service/robohash-internal 8080:80 makes the service available at localhost:8080. section 7.1.2

Listing 7.2 Chapter07/7.1_InternalServices/robohash-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: robohash-internal
spec:
  selector:
    app: robohash
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
  type: ClusterIP      #1
#1 Defines a local service

Shows a ClusterIP Service definition that selects Pods by label and maps its service port to the Pod port. section 7.1.2

How Kubernetes for Developers covers it

How deep it goes
Explains internal reachability, replica-aware routing, service types, ports, and discovery, but defers detailed service discovery configuration.
Examples
Uses a Robohash ClusterIP, the 10.63.254.218 address, HTTP requests between Pods, and kubectl port-forward for local testing.
What you can do after
Operate/configure internal Kubernetes access using ClusterIP Services, selectors, ports, and kubectl port-forward.
How it connects
Connects Kubernetes Services with Pods, Deployments, service discovery, DNS, load balancing, and Ingress.

Also explained in

Compare how 3 books explain service IP →

Related concepts

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