lang2
lang2

Reputation: 11986

kubernetes: is it possible to add labels to individual containers?

In kubernetes, Deployments can have labels. But in my situation, I need the actual containers in a pod to have certain labels that triggers some action to be carried out by an agent on the node.

Is there a way to add specific labels to containers in Kubernetes?

Upvotes: 6

Views: 2350

Answers (1)

Michael Hausenblas
Michael Hausenblas

Reputation: 14011

You can't add a label to individual containers, only to the pod in which they are running. I'd suggest rather than using labels (which is for identifying info) to leverage pod annotations, potentially along with the downward API for triggering actions.

Upvotes: 2

Related Questions