Skip to content

Commit b55687a

Browse files
committed
Adding another example of leafnodes
Signed-off-by: Waldemar Quevedo <[email protected]>
1 parent ed8bf8b commit b55687a

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

Diff for: nats-server/leafnodes/stan-server.yaml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: stan-config
6+
data:
7+
stan.conf: |
8+
port: 4222
9+
http: 8222
10+
11+
streaming {
12+
ns: "nats://nats:4222"
13+
id: stan
14+
store: file
15+
dir: /data/stan/store
16+
}
17+
---
18+
apiVersion: v1
19+
kind: Service
20+
metadata:
21+
name: stan
22+
labels:
23+
app: stan
24+
spec:
25+
selector:
26+
app: stan
27+
clusterIP: None
28+
ports:
29+
- name: metrics
30+
port: 7777
31+
---
32+
apiVersion: apps/v1
33+
kind: StatefulSet
34+
metadata:
35+
name: stan
36+
labels:
37+
app: stan
38+
spec:
39+
selector:
40+
matchLabels:
41+
app: stan
42+
serviceName: stan
43+
replicas: 1
44+
volumeClaimTemplates:
45+
- metadata:
46+
name: stan-sts-vol
47+
spec:
48+
accessModes:
49+
- ReadWriteOnce
50+
volumeMode: "Filesystem"
51+
resources:
52+
requests:
53+
storage: 1Gi
54+
template:
55+
metadata:
56+
labels:
57+
app: stan
58+
spec:
59+
# Prevent NATS Streaming pods running in same host.
60+
affinity:
61+
podAntiAffinity:
62+
requiredDuringSchedulingIgnoredDuringExecution:
63+
- topologyKey: "kubernetes.io/hostname"
64+
labelSelector:
65+
matchExpressions:
66+
- key: app
67+
operator: In
68+
values:
69+
- stan
70+
# STAN Server
71+
containers:
72+
- name: stan
73+
image: nats-streaming:0.19.0-alpine
74+
ports:
75+
- containerPort: 8222
76+
name: monitor
77+
- containerPort: 7777
78+
name: metrics
79+
args:
80+
- "-sc"
81+
- "/etc/stan-config/stan.conf"
82+
83+
# Required to be able to define an environment variable
84+
# that refers to other environment variables. This env var
85+
# is later used as part of the configuration file.
86+
env:
87+
- name: POD_NAME
88+
valueFrom:
89+
fieldRef:
90+
fieldPath: metadata.name
91+
- name: POD_NAMESPACE
92+
valueFrom:
93+
fieldRef:
94+
fieldPath: metadata.namespace
95+
volumeMounts:
96+
- name: config-volume
97+
mountPath: /etc/stan-config
98+
- name: stan-sts-vol
99+
mountPath: /data/stan
100+
101+
# Disable CPU limits.
102+
resources:
103+
requests:
104+
cpu: 0
105+
106+
livenessProbe:
107+
httpGet:
108+
path: /
109+
port: 8222
110+
initialDelaySeconds: 10
111+
timeoutSeconds: 5
112+
volumes:
113+
- name: config-volume
114+
configMap:
115+
name: stan-config

0 commit comments

Comments
 (0)