To reach a pod and the container running in a pod,
we need a service.
Because a service object is another object Kubernetes knows,
which is responsible for exposing pods to other pods
in the cluster, or very important to us here
to visitors outside of the cluster.
So to the entire world.
Now, pods actually already have an internal IP address
by default, you can see this here in the dashboard.
This pod, which I'm looking at here has an IP address.
But there are two problems with this internal IP address.
For one, we can't use that to access the pod
from outside the cluster, which is a problem for us here.
And the second problem is that it will change
whenever a pod is replaced.
And that happens more often than you might think,
especially if you also have scaling or something like that.
So you can't rely on a pod keeping its IP address.
And therefore the IP address is some not really a great tool
for communicating to the pod
even if it would be cluster internal.
Then you could use it because there it will be reachable,
but it will still change.
So finding pods therefore is pretty challenging,
because the IP changes all the time.
Now service, groups pods together
and gives them a shared address a shared IP address.
And this address then won't change.
So you can use a service to move multiple pods
into that service and make them reachable
on that service unchangeable IP address.
And even better than that,
you can also tell the service to expose this address
which doesn't change not just inside of the cluster,
which you also can do,
but also outside of the cluster.
So that pods can be accessed from outside of the cluster.
So from the entire world, in our case,
so did we can have a look at our web app.
And we can visit this containerized Node JS application.
The default is that it's internal only
but with a service, we can overwrite this.
So without services, pods are very hard to reach
even internally because of that changing IP address
and from outside a cluster pods
and therefore de containerized apps are not reachable at all
without these service objects.
So let's now understand how we create this service.