K8s YAML: labels & selectors
1 June 2025 (Updated 1 June 2025)
What are labels & selectors?
In a K8s YAML file, you use labels & selectors to reference different resources. For example, your Deployment config will need to reference a Pod config or a Service config will need to reference a Deployment config.
Let’s take a closer look.
Example 1: Connecting a Deployment config to a Pod config

Example 2: Connecting a Service config to a Deployment config
