Skip to content

Setup a local k8s cluster using k3d and install NATS via Helm

Notifications You must be signed in to change notification settings

ConnectEverything/k3d-nats-helm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

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'

About

Setup a local k8s cluster using k3d and install NATS via Helm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published