Kubernetes 101 : How do services get "assigned" to pods



How do services relate to pods:

Below is a diagram that illustrates the relationship between services, deployments and pods through selectors and labels:


The selector of the ClusterIP service "connects" to the label of the deployment, and the deployment's selector connects to the label of the pods.

Below is the Yaml files representing the deployment with one replica of the "nginx" pod.
We can also see the label and the selector for the deployment and the label of the pod:


The below file represents the Yaml configuration file of the ClusterIP service and its selector:


Comments

Leave as a comment:

Archive