https://youtu.be/cmc4f4TyHaU

Services


Why do we need services?

Each pod gets its own IP address. However, pods in Kubernetes are ephemeral; meaning, they come and go very quickly.

Every time a new pod is started, it gets its new IP address.

With a service, you get consistent, stable IP address.

What is a Service?

With every object and agent decoupled we need a flexible and scalable agent which connects resources together and will reconnect, should something die and a replacement is spawned.

Each service is a microservice that handles a particular bit of traffic. Cluster-internal traffic is handled through cluster IP, we can also have NodeIPs and Loadbalancer.

Services are a good alternative for loose coupling components within the cluster and with outside resources.

Type of Services

By default Cluster IP is used for the service.

Each pod gets a range of IP addresses.

In the case of a replica, the second pod, would have the same internal IP addresses but a different external.