Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.22 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.22 KB

k3d + NATS Helm

Run the k3d install script. For example:

curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash

Create a cluster with the specific ports we want to expose out of the Docker network. 4222 is the client port, 7422 is the leafnode port, and 8443 is the websocket port.

k3d cluster create nats \
    --port 4222:4222@loadbalancer \
    --port 7422:7422@loadbalancer \
    --port 8443:8443@loadbalancer \
    --servers 3

Install Helm, then add the NATS chart:

helm repo add nats https://nats-io.github.io/k8s/helm/charts/

Or if you already had installed, ensure it is up-to-date:

helm repo update nats

Now install the chart in the new cluster using the provided values.yaml as a starting point. See the full set of options here

helm install nats nats/nats -f values.yaml

Install a load balancer service:

kubectl apply -f lb.yaml

Get the external IP addresses by running kubectl get svc nats-lb. Using any of those IP addresses you can now use the NATS CLI, for example:

nats -s 172.18.0.2:4222 pub test 'hello'