Overview
Overview
Service
s are agents which connect Pod
s together or provide access outside of the cluster. The Pod
serves the expected resource using an Endpoint
object.
Each Service
can be exposed internally or externally to the cluster. A Service
can also connect internal resources to external resources.
The kube-proxy
agent watches the Kubernetes API for new services and endpoints being created on each node. It opens random ports and listens for traffic to the ClusterIP:Port
, and redirects the traffic to the randomly generated service endpoints.
Service
s provide automatic load-balancing, matching a label query. While there is no configuration of this option, there is the possibility of session affinity via IP. Also, a headless service, one without a fixed IP nor load-balancing, can be configured. Labels are used to determine which Pods should receive traffic from a service (Service Update Pattern).
Unique IP addresses are assigned and configured via the etcd
database, so that Service
s implement iptables
to route traffic, but could leverage other technologies to provide access to resources in the future.