-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcluster-stan.yaml
112 lines (111 loc) · 2.24 KB
/
cluster-stan.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
apiVersion: v1
kind: ConfigMap
metadata:
name: stan-config
namespace: __namespace__
data:
stan.conf: |
port: 4222
http: 8222
streaming {
ns: "nats://nats.__namespace__:4222"
id: odp-cluster
store: file
dir: /data/store
store_limits {
max_age: "24h"
}
cluster {
node_id: $POD_NAME
log_path: /data/log
peers: ["stan-0", "stan-1", "stan-2"]
}
}
---
apiVersion: v1
kind: Service
metadata:
name: stan
namespace: __namespace__
labels:
app: stan
spec:
selector:
app: stan
clusterIP: None
ports:
- name: metrics
port: 7777
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: stan
namespace: __namespace__
labels:
app: stan
spec:
selector:
matchLabels:
app: stan
serviceName: stan
replicas: 3
template:
metadata:
labels:
app: stan
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: "kubernetes.io/hostname"
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- stan
# STAN Server
containers:
- name: stan
image: nats-streaming:0.16.2
ports:
- containerPort: 7777
name: metrics
- containerPort: 8222
name: monitor
args:
- "-sc"
- "/etc/stan-config/stan.conf"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: config-volume
mountPath: /etc/stan-config
- name: nats-store
mountPath: /data
subPathExpr: $(POD_NAME)
resources:
requests:
cpu: 0
livenessProbe:
httpGet:
path: /
port: 8222
initialDelaySeconds: 10
timeoutSeconds: 5
volumes:
- name: config-volume
configMap:
name: stan-config
- name: nats-store
hostPath:
path: /tmp