Can I schedule workloads based on namespace in Kubernetes?

7/17/2018

The question says everything really - is it possible to schedule a Pod based on the namespace it is assigned to?

-- dippynark
kubernetes

1 Answer

7/17/2018

It's not built in as far as I know, but there's a couple of ways you could do it:

Create a mutating webhook that modifies the pod affinity rules if the namespace == something. Using something like this: https://github.com/slok/kubewebhook

Using the PodNodeSelector admission controller: https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/

Using the PodPreset admission controller: https://kubernetes.io/docs/tasks/inject-data-application/podpreset/

-- jaxxstorm
Source: StackOverflow