NATS
We have deployed NATS on our infrastructure as a message broker to communicate between our different services.
Its deployment configuration is located in the nats-deploy repository on GitHub and details about the deployment are described there.
Connecting to NATS
NATS is exposed to the rest of the cluster via a service object simply called nats
inside its namespace.
This means that connections are possible via the hostname associated to that service, e.g. nats.nats-dev.svc.cluster.local
.
NATS Hostname
nats.nats-dev.svc.cluster.local
but dev
can also be stage
or prod
to use that NATS instance instead.
Interactive Session from inside the Cluster
kubectl supports running one-off pods in the cluster. We use this capability to run a nats-box pod and use the installed tools there.
You can now verify the server connection by running:
Port-Forwarding to local computer
kubectl supports port-forwarding arbitrary services to your local computer.
The following command port-forwards the port named nats-client on the service named nats inside the namespace nats-dev.
You can now verify the server connection by running: