How to publish services
Kubernetes employs Services to enable access to a set of pods that share a common label selector. This allows communication between applications within the cluster and makes it possible to expose applications running in the cluster to external entities, as depicted in the following figure:
Figure 4.16 – K8s service exposure types
Kubernetes offers different service types that allow you to specify how a service should be exposed. Here are the three main types:
- ClusterIP: ClusterIP is the default service type that restricts access to a Service to within the cluster only. This is useful for applications that need to communicate with each other within the cluster but do not need to be accessed from outside the cluster.
- NodePort: By using this configuration, the Service becomes accessible from external sources outside of the cluster. To achieve this, a specific port is opened on all nodes to forward traffic to the...