<p>I would like to deploy my projects (api rest, webapp, backoffice etc...) in several environments (dev, staging and production) with gitlab-ci, Kubernetes and Google Kubernetes Engine.</p>

<p>All projects are separated in gitlab repositories</p>

<p>I have 2 branch on gitlab : master and develop.
Master must be deploy in staging and production environment
Develop must be deploy in dev environment</p>

<p>I read multiple tutorials and blogs since 2 days but I didn't found what is the best approach to manage several environments with kubernetes.</p>

<p>I have to create 3 clusters in GKE (dev, staging, production) ? 
or I have to create just 1 cluster and use namespace to manage my environments ? or others solutions ?</p>

<p>1 / Create 3 clusters
In gitlab-ci (free account), how can I deploy dev branch on dev cluster, master branch on staging/production cluster ? what will be the config to do it ?
Can I set a specific cluster in gitlab-ci.yml ? How ? (kubectl config use-context  ?  </p>

<p>2 / Create 1 cluster and 3 namespace (dev,staging, production)
I don't think that is the best approach for security and performance reason, right ? </p>

<p>Thanks</p>

mikael
<p>Q. I have to create 3 clusters in GKE (dev, staging, production) ? or I have to create just 1 cluster and use namespace to manage my environments ? or others solutions ?</p>

<p>Ans: Use one cluster and name namesapce them like dev, staging, production and it will be easy to manage .</p>
