Can a kubernetes pod belong to more than 1 kubernetes workload?

6/21/2021

I am trying to figure out if two workloads can share a pod i.e. can a pod belong to more than 1 workload at the same time?

I would think so no because a pod should never have more than 1 owner if you think in terms of ownership references.

-- Mr Matrix
google-kubernetes-engine
kubernetes

1 Answer

6/22/2021

The answer is no. You should not use same pod label-selector from two different workloads. As far the k8s official doc:

Note: You must specify an appropriate selector and Pod template labels in a Deployment (in this case, app: nginx). Do not overlap labels or selectors with other controllers (including other Deployments and StatefulSets). Kubernetes doesn't stop you from overlapping, and if multiple controllers have overlapping selectors those controllers might conflict and behave unexpectedly.

-- Sahadat Hossain
Source: StackOverflow