Services
A Service is an abstraction that defines a stable network endpoint for a set of Pods.
Since Pods are ephemeral (they can die, restart, or be rescheduled on another node), their IPs change. If other applications want to talk to those Pods, they’d have to constantly track changing Pod IPs — which is not practical.
A Service solves this by:
Giving a stable DNS name and ClusterIP.
Acting as a load balancer across the set of Pods that match its label selector.
Allowing communication between different parts of the application or from outside the cluster.
A Service focus in Networking & Access.
Types of Services
Commands
To apply and run Service consigurations:
To list the Services:
To describe a Service:
To delete a Service:
To forward port for external access:
Where "3000" is the external port and "80" is the service port.
Example
myapp-tcp will be resolved to the generated cluster IP, so you my use the "name" when accessing the cluster.
If targetPort is not specified, it will assume to be the same as port.
Last updated