apache / rocketmq-operator

Apache RocketMQ Operator
https://rocketmq.apache.org/
Apache License 2.0
310 stars 126 forks source link

How to use tolerations , nodeSelector and nodeAffinity features #122

Closed 0x032c closed 1 year ago

0x032c commented 2 years ago

In our scenario, rocketmq needs to use a unique node,How to use tolerations , nodeSelector and nodeAffinity features , like this is invalid.

apiVersion: rocketmq.apache.org/v1alpha1
kind: Broker
metadata:
  name: broker
spec:
  size: 1
  nameServers: ""
  replicaPerGroup: 1
  brokerImage: rocketmq-broker:4.5.0-alpine-operator-0.3.0
  imagePullPolicy: Always
  tolerations:
    - key: "key"
      value: "value"
      operator: "Equal"
      effect: "NoSchedule"
  nodeSelector:
    key: "value"
...
caigy commented 1 year ago

@se7vet Pls provide detailed error messages.

caigy commented 1 year ago

@se7vet If you want to deploy only one broker in one host, you may define podAntiAffinity policy like this:

    affinity:
      podAntiAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchLabels:
                app: broker
            topologyKey: kubernetes.io/hostname
caigy commented 1 year ago

@se7vet Has your question been resolved?

caigy commented 1 year ago

I'll close this issue, if problem still exists, please feel free to reopen it. Thank you.

0x032c commented 1 year ago

@caigy These affinity nodes have taint ,how to toleration ?

0x032c commented 1 year ago

when I use these configurations, they are not passed to statefulset ,

apiVersion: rocketmq.apache.org/v1alpha1
kind: Broker
metadata:
  name: broker
spec:
  size: 1
  nameServers: ""
  replicaPerGroup: 1
  brokerImage: rocketmq-broker:4.5.0-alpine-operator-0.3.0
  imagePullPolicy: Always
  affinity:
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        - labelSelector:
            matchLabels:
              app: broker
          topologyKey: kubernetes.io/hostname