How to handle multiple environments with Google Cloud Build and Kubernetes

3/19/2019

I'successfully set up a CICD pipeline following this tutorial.

It shows clearly how to make Google Cloud Build and Kubernetes work with one environment: production.

For simplicity, this tutorial uses a single environment —production— in the env repository, but you can extend it to deploy to multiple environments if needed.

Right, but some details are missing: is there one kubernetes.yaml file by environment? What about kubernetes namespaces?...

More precisely, what would be the way to handle multiple environments (staging...)?

-- Neko
devops
google-kubernetes-engine
kubernetes

1 Answer

3/19/2019

There could be a bizillion ways of doing environments , but what I understand from this line:

env repository: contains the manifests for the Kubernetes Deployment

That the default master/production branch maps to the production environment , then you can create for example testing , and staging branches , where you test and stage your things , and later on port the change to master branch.

Infact if you keep reading that document , it will tell you something:

The env repository can have several branches that each map to a specific environment (you only use production in this tutorial) and reference a specific container image, whereas the app repository does not.

One more thing , if you have access to gitlab and kubernetes , you can implement it without google GKE and clud build.

-- Ijaz Ahmad Khan
Source: StackOverflow