NATS and Kubernetes
In this section, you can find several examples of how to deploy NATS and other tools from the NATS ecosystem on Kubernetes.
helm repo add nats https://nats-io.github.io/k8s/helm/charts/
helm install my-nats nats/nats
This will install NATS Server in basic setup with NATS box utility container that can be used as a simple way to interact with the server using
nscCLI tools preinstalled.
To check if NATS is reacheable from within the cluster connect to NATS box
kubectl exec -n default -it deployment/my-nats-box -- /bin/sh -l
and try subscribing and publishing
nats-box:~# nats sub test &
nats-box:~# nats pub test hi
If you're seeing the messages, all went well and you have successfully installed NATS.
Now, let's discover some more advanced options.
To setup your cluster in HA manner, you need to customize NATS Helm charts. Fortunately,
values.yamlhave most of the features available as easy values customization and there should be no need to manually tweak the templates.
One way to do it is to create your own
.yamlfile with changed only values:
helm install nats nats/nats --values ha.yaml
Similarly to HA, enabling JetStream requires changing few values: