DELAPARRA
Index
Color
NL
Category: Kubernetes

selector

Explained by Updated

What is selector?

selector: A query over labels. Services, Deployments, and NetworkPolicies use selectors to find the Pods they apply to. A selector in Kubernetes is a query over labels that picks a set of objects. selector: matchLabels: app: web matches every pod labelled app=web. Selectors are how Kubernetes objects find each other. A Service sends traffic to pods matching its selector, a Deployment manages pods matching its selector, and a NetworkPolicy applies to the pods it selects.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about selector

What should you keep in mind with selector?

Most confusing Kubernetes problems involving "no endpoints" or "traffic goes nowhere" come down to a selector that does not match the labels on the pods, often because of a typo or a label changed in one place only. Compare them with kubectl get pods --show-labels and kubectl describe service. Remember that a Deployment's selector cannot be changed after creation, so choose stable labels from the start.

What does an example of selector look like?

selector: matchLabels: app: web

At a glance

CategoryKubernetes
Explained by
Updated

More Kubernetes terms

All terms starting with S

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.