<p>I'm implementing a kubernetes cluster for a django-based app and I didn't found what's the best practice for namespaces.</p>
<p>My app will need various services like a postgresql cluster, a reverse proxy (traefik), an Elastic Search / Kibana cluster and argoCD &amp; argo workflow for CD.</p>
<p>Is it better to pull all those services into an unique namespace called production? Or do I need to separate them by services?</p>
<p>I began to separate them by services but I face some problem. For example an argo workflow launched on argo namespace can't use a secret stored from postgresql namespace.</p>
<p>Thank you for your help,
Tux Craft</p>

TuxCraft
<p>Your question is slightly opinion-based. However, I will try to figure out the topic somehow by presenting both solutions. First, an excerpt from <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/" rel="nofollow noreferrer">the documentation</a>. There you can find a paragraph <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#when-to-use-multiple-namespaces" rel="nofollow noreferrer">when to use multiple namespaces</a>:</p>
<blockquote>
<p>Namespaces are intended for use in environments with many users spread across multiple teams, or projects. For clusters with a few to tens of users, you should not need to create or think about namespaces at all. Start using namespaces when you need the features they provide.
Namespaces provide a scope for names. Names of resources need to be unique within a namespace, but not across namespaces. Namespaces cannot be nested inside one another and each Kubernetes resource can only be in one namespace.
Namespaces are a way to divide cluster resources between multiple users (via  <a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/" rel="nofollow noreferrer">resource quota</a>).
It is not necessary to use multiple namespaces to separate slightly different resources, such as different versions of the same software: use  <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels" rel="nofollow noreferrer">labels</a>  to distinguish resources within the same namespace.</p>
</blockquote>
<p>Based on this documentation, in your case, the best solution will be to create one namespace and many deployments. This will allow you to avoid problems like this:</p>
<blockquote>
<p>For example an argo workflow launched on argo namespace can't use a secret stored from postgresql namespace.</p>
</blockquote>
<p>Technically, you can create the same thing using multiple namespaces. However, the point of namespaces is to isolate, so it doesn't seem like a good idea in your situation. You can read very good topic about <a href="https://stackoverflow.com/questions/37221483/service-located-in-another-namespace">Service located in another namespace</a>.</p>
