A service IP, or ClusterIP, is the internal virtual address assigned to a Kubernetes Service. Use it as the host value when connecting to that Service from within the cluster. section 8.4.3
Connect to a database Service
After entering a running Pod with kubectl exec and installing the psql client, run kubectl get service postgres-svc. Read the Cluster-IP value, such as 10.128.189.63, and use it to connect to the PostgreSQL Service from inside the cluster. section 8.4.3
Use a service IP with these practical limitations:
- Treat the address as internal; a ClusterIP-type Service does not accept traffic from outside the cluster. section 8.6
- Do not hard-code the address for durable configuration: Kubernetes provisions it dynamically, so its value is unpredictable. section 8.4.3
- Prefer the Kubernetes built-in DNS Service when predictable Service addressing is needed. section 8.4.3
Figure 8.13 kubectl get service output
Inspect the Cluster-IP value returned by kubectl get service. section 8.4.3


