Is there a way to deploy different sets of pods based on context?

4/3/2019

For example, I have three apps that I want to deploy, and a database as well. When running on a dev machine (docker-for-desktop context) or in an integration or test cluster, I would want to run 2 replicas of each app, plus have a SQL container that they all connect to. In staging or production, I want to be able to set the replicas as per traffic needs, and I want to connect to a different (external) SQL server.

I would then want those yaml files to be kept in source control, so depending on your env it uses the correct context and "creates" all of the yaml files.

Is this possible with contexts? Or is this a namespace problem? Or do I just need to have yaml files in separate folders (a local folder, a staging folder, a production folder) and have copies of the yaml files in each folder. Or maybe some other option?

-- mherzig
kubernetes

1 Answer

4/3/2019

There are multiple options to maintain the same set of YAML files for different configurations, for example:

Helm

Kustomize

ksonnet

You can use these tools to keep only per environment configurations in a different files in git.

-- almalki
Source: StackOverflow