benefits of running k8s pods in non default namespace

1/14/2019


Pardon me for my limited knowledge of k8s. As per k8s best practices we need to run pods in non default namespace. few reasons for this approach is to.

  • create logical isolation and creating uat, sit,dev environment on same k8s cluster
  • default namespace is ok when we are having less than 10 micro services running in same PODs.

do we have any other benefits in terms of security, performance and maintenance point of view?

-- Ganesh Pol
kubernetes

1 Answer

1/14/2019

I would say the best practice is to think about how you will use your cluster and take namespaces into account. So thinking about what you'll run in the cluster, how much resource you want to dedicate to it and who can do what. Namespaces can help with controlling all of these things.

In terms of what you run, it's important that kubernetes object names have to be unique within a namespace. So if you want to run two instances of the same app, then you either install them in different namespaces or distinguish the resource names - helm charts for example default to adding prefixes to ensure uniqueness.

Also role-based access control permissions can be set as namespace-specific and resource usage quotas can be applied to namespaces. So if you had adev namespace on the same cluster as UAT then you could ensure that permissions are more restricted on UAT and that it has more resource availability guaranteed for it.

For more on these points see https://dzone.com/articles/kubernetes-namespaces-explained and https://kubernetes.io/blog/2016/08/kubernetes-namespaces-use-cases-insights/

-- Ryan Dawson
Source: StackOverflow