<p>We are developing a CI/CD pipeline leveraging Docker/Kubernetes in AWS. This topic is touched in <a href="https://stackoverflow.com/questions/46036853/kubernetes-ci-cd-pipeline">Kubernetes CI/CD pipeline</a>.</p>

<p>We want to create (and destroy) a new environment for each SCM branch, since a Git pull request until merge.</p>

<p>We will have a Kubernetes cluster available for that.</p>

<p>During prototyping by the dev team, we came up to Kubernetes namespaces. It looks quite suitable: For each branch, we create a namespace <code>ns-&lt;issue-id&gt;</code>.</p>

<p>But that idea was dismissed by dev-ops prototyper, without much explanation, just stating that "we are not doing that because it's complicated due to RBAC". And it's quite hard to get some detailed reasons.</p>

<p>However, for the CI/CD purposes, we need no RBAC - all can run with unlimited privileges and no quotas, we just need a separated network for each environment.</p>

<p>Is using namespaces for such purposes a good idea? I am still not sure after reading <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/" rel="noreferrer">Kubernetes docs on namespaces</a>.</p>

<p>If not, is there a better way? Ideally, we would like to avoid using Helm as it a level of complexity we probably don't need.</p>

<p>We're working on an open source project called <a href="https://jenkins-x.io/" rel="nofollow noreferrer">Jenkins X</a> which is a proposed sub project of the Jenkins foundation aimed at automating CI/CD on Kubernetes using Jenkins and GitOps for promotion.</p>

<p>When you submit a Pull Request we automatically create a <em>Preview Environment</em> which is exactly what you describe - a temporary environment which is used to deploy the pull request for validation, testing &amp; approval before the pull request is approved. </p>

<p>We now use Preview Environments all the time for many reasons and are big fans of them! Each Preview Environment is in a separate namespace so you get all the usual RBAC features from Kubernetes with them.</p>

<p>If you're interested here's <a href="https://jenkins-x.io/demos/devoxx-uk-2018/" rel="nofollow noreferrer">a demo of how to automate CI/CD with multiple environments on Kubernetes using GitOps</a> for promotion between environments and Preview Environments on Pull Requests - using Spring Boot and nodejs apps (but we support many languages + frameworks).</p>
