HA NATS Configuration for Deployment
NATS Repo: https://nats-io.github.io/k8s/helm/charts/
Chart Version: 0.11.0
Values File:
cluster:
enabled: true
noAdvertise: true
natsbox:
enabled: true
nats:
jetstream:
enabled: true
memStorage:
enabled: true
size: 1Gi
fileStorage:
enabled: true
size: 1Gi
storageDirectory: /data/
auth:
enabled: true
basic:
accounts:
A:
users:
- user: a
password: a
B:
jetstream: true // if you want to enable jetstream for this user. This is required for the user used by the notifier
users:
- user: b
password: b
We additionally use the ClusterIP service so that the load-balancing aspect is working well. We did not find proper documentation to show that the service that the chart already uses works well in that aspect.
apiVersion: v1
kind: Service
metadata:
name: nats-svc
namespace: thub
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: nats
ports:
- protocol: TCP
port: 4222
targetPort: 4222
name: nats
- protocol: TCP
port: 8222
targetPort: 8222
name: monitoring
This allows us to use the DNS from Kubernetes to access the cluster with the service URL. We are additionally exposing port 8222
to obtain the monitoring information.