Angad
Angad

Reputation: 2823

Staging and Production on Kubernetes

I'm sharing the same cluster for 2 namespaces: staging and production. The only differences among the two namespaces are:

  1. Volumes mounted to certain pods (separate persistence between staging and production, obviously!)
  2. A couple of web-URLs for relative addressing
  3. A couple of IPs to databases used for sophisticated persistence

I have managed to address (2) and (3) as follows, so as to maintain a single YAML file for all ReplicationControllers:

However, I'm unable to find a satisfactory way to have a reference for a gcePersistentDisk's pdName - I can't seem to use a ConfigMap, hence a little stumped. What would be the appropriate way to go about this? The best alternative seems to be to maintain 2 separate YAML files with different strings, but this has a code-smell as it is violating DRY.

Also, any constructive commentary on the rest of my setup as mentioned above is highly appreciated :-)

Upvotes: 7

Views: 1904

Answers (1)

jayme
jayme

Reputation: 1316

You could probably create one PersistentVolumeClaim in each namespace. Take a look at Can a PVC be bound to a specific PV? on how to "pre-bind" PersistentVolumes to PersistentVolumeClaims.

Might not be an ideal solution but it probably works 'till PVCs support label selectors.

Upvotes: 2

Related Questions