github.com/argoproj/argo-events@v1.9.1/docs/dr_ha_recommendations.md (about) 1 # HA/DR Recommendations 2 3 ## EventBus 4 5 A simple EventBus used for non-prod deployment or testing purpose could be: 6 7 ```yaml 8 apiVersion: argoproj.io/v1alpha1 9 kind: EventBus 10 metadata: 11 name: default 12 spec: 13 nats: 14 native: 15 auth: token 16 ``` 17 18 However this is not good enough to run your production deployment, following 19 settings are recommended to make it more reliable, and achieve high 20 availability. 21 22 ### Persistent Volumes 23 24 Even though the EventBus PODs already have data sync mechanism between them, 25 persistent volumes are still recommended to be used to avoid any events data 26 lost when the PODs crash. 27 28 An EventBus with persistent volumes looks like below: 29 30 ```yaml 31 spec: 32 nats: 33 native: 34 auth: token 35 persistence: 36 storageClassName: standard 37 accessMode: ReadWriteOnce 38 volumeSize: 20Gi 39 ``` 40 41 ### Anti-Affinity 42 43 You can run the EventBus PODs with anti-affinity, to avoid the situation that 44 all PODs are gone when a disaster happens. 45 46 An EventBus with best effort node anti-affinity: 47 48 ```yaml 49 spec: 50 nats: 51 native: 52 auth: token 53 affinity: 54 podAntiAffinity: 55 preferredDuringSchedulingIgnoredDuringExecution: 56 - podAffinityTerm: 57 labelSelector: 58 matchLabels: 59 controller: eventbus-controller 60 eventbus-name: default 61 topologyKey: kubernetes.io/hostname 62 weight: 100 63 ``` 64 65 An EventBus with hard requirement node anti-affinity: 66 67 ```yaml 68 spec: 69 nats: 70 native: 71 auth: token 72 affinity: 73 podAntiAffinity: 74 requiredDuringSchedulingIgnoredDuringExecution: 75 - labelSelector: 76 matchLabels: 77 controller: eventbus-controller 78 eventbus-name: default 79 topologyKey: kubernetes.io/hostname 80 ``` 81 82 To do AZ (Availability Zone) anti-affinity, change the value of `topologyKey` 83 from `kubernetes.io/hostname` to `topology.kubernetes.io/zone`. 84 85 Besides `affinity`, 86 [nodeSelector](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) 87 and 88 [tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) 89 also could be set through `spec.nats.native.nodeSelector` and 90 `spec.nats.native.tolerations`. 91 92 ### POD Priority 93 94 Setting 95 [POD Priority](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/) 96 could reduce the chance of PODs being evicted. 97 98 Priority could be set through `spec.nats.native.priorityClassName` or 99 `spec.nats.native.priority`. 100 101 ### PDB 102 103 EventBus service is essential to EventSource and Sensor Pods, it would be better to have a `PodDisruptionBudget` to prevent it from [Pod Disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/). The following PDB object states `maxUnavailable` is 1, which is suitable for a 3 replica EventBus object. 104 105 If your EventBus has a name other than `default`, change it accordingly in the yaml. 106 107 ```yaml 108 apiVersion: policy/v1beta1 109 kind: PodDisruptionBudget 110 metadata: 111 name: eventbus-default-pdb 112 spec: 113 maxUnavailable: 1 114 selector: 115 matchLabels: 116 controller: eventbus-controller 117 eventbus-name: default 118 ``` 119 120 ## EventSources 121 122 ### Replicas 123 124 EventSources can run with HA by setting `spec.replicas` to a number `>1`, see 125 more detail [here](eventsources/ha.md). 126 127 ### EventSource POD Node Selection 128 129 EventSource POD `affinity`, `nodeSelector` and `tolerations` could be set 130 through `spec.template.affinity`, `spec.template.nodeSelector` and 131 `spec.template.tolerations`. 132 133 ### EventSource POD Priority 134 135 Priority could be set through `spec.template.priorityClassName` or 136 `spec.template.priority`. 137 138 ## Sensors 139 140 ### Replicas 141 142 Sensors can run with HA by setting `spec.replicas` to a number `>1`, see more 143 detail [here](sensors/ha.md). 144 145 ### Sensor POD Node Selection 146 147 Sensor POD `affinity`, `nodeSelector` and `tolerations` could also be set 148 through `spec.template.affinity`, `spec.template.nodeSelector` and 149 `spec.template.tolerations`. 150 151 ### Sensor POD Priority 152 153 Priority could be set through `spec.template.priorityClassName` or 154 `spec.template.priority`.