Postgres-operator: Specifying a nodeSelector for Postgres Pods

Created on 20 Nov 2018  路  5Comments  路  Source: zalando/postgres-operator

Hi,

Its entirely possible that I missed something when I looked through the documentation; if so, sorry in advance.

I'm trying to setup postgres-operator so that it only schedules Postgres pods on specific nodes; our cluster has several different types of nodes, including a mix of CPU architectures. In a 'normal' StatefulSet I would do this by setting nodeSelector - is there an equivalent field I can set on the postgresql object to achieve the same effect?

Thanks

Most helpful comment

So this means if I'd want to have separate node pools for separate postgres clusters, I would have to deploy multiple postgres-operator instances? Or how do you guys do it?

I'm asking because we mostly likely want to configure different node types per environment (staging/production).

All 5 comments

Seems like per cluster node selector is not yet supported, I thought differently but all we seem to have is the global readiness label.

I agree this is def. something to look into and support.

Can confirm that having nodeSelector support is something that would be great to see!

For those finding this in the future; currently (operator v1.1.0) it isn't possible to do this on a per-postgres-cluster level, but you can do it globally using the node_readiness_label config option.

  • Label the nodes that you want to have Postgres pods on them: kubectl label node <node name> should_have_pgdb_pods=true
  • Update the operator config map:
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-operator
data:  
  node_readiness_label: 'should_have_pgdb_pods:true'

I had to restart the operator pod for it pick up the config change, but once I did it automatically updated the existing StatefulSets and moved the pods onto the labeled nodes

As pointed out, there is the node_readiness_label and you can use node taints (as described in #547). If we would implement a node affinity then we should better use the more flexible NodeAffinity instead of the rather simple NodeSelector.

Closing this for now as there are existing workarounds. Feel free to reopen if there are new questions regarding this topic.

So this means if I'd want to have separate node pools for separate postgres clusters, I would have to deploy multiple postgres-operator instances? Or how do you guys do it?

I'm asking because we mostly likely want to configure different node types per environment (staging/production).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

avaczi picture avaczi  路  3Comments

sergeyshaykhullin picture sergeyshaykhullin  路  5Comments

RichieSams picture RichieSams  路  6Comments

michailbrynard picture michailbrynard  路  6Comments

jaroslav-muller picture jaroslav-muller  路  5Comments