Simple, Secure and Reliable:
Building Cloud Native Applications
with NATS
● Waldemar Quevedo / @wallyqs
● Software Engineer at
● NATS core maintainer
● Author of Practical NATS (Apress, 2018)
About me
Practical NATS on O’Reilly Safari
https://www.oreilly.com/library/view/practical-nats-from/9781484
235706/
Agenda
● Overview of NATS Messaging
● Setting up NATS on a hybrid Kubernetes cluster
● Show of new NATS v2.0 decentralized auth features
What is NATS?
NATS is a simple,
production proven,
cloud-native
messaging system.
CNCF Landscape
Joined CNCF as an
incubation project
in 2018
https://landscape.cncf.io
CNCF Landscape
Joined CNCF as an
incubation project
in 2018
https://landscape.cncf.io
CNCF Landscape
About NATS
● Created by Derek Collison in 2011 for CloudFoundry
● DNA: Simplicity, performance, security, and availability
● TCP/IP based with a very simple plain text protocol
| PUB | SUB | UNSUB | CONNECT | INFO | MSG | -ERR | +OK | PING | PONG |
What if all it took to
connect all your
services was a single URL?
An always available dial-tone
An always available dial-tone
An always available dial-tone
An always available dial-tone
An always available dial-tone
An always available dial-tone
❌
❌
An always available dial-tone
❌
❌
Performance
NATS Go client performance
Delivery modes
Delivery modes
At most once (Core)
● No guarantee of delivery
● Messages can be lost
● Applications must detect and handle lost messages
https://github.com/nats-io/nats-server
Delivery modes
At least once (Streaming)
● Ensure message delivery
● Messages are persisted
● Messages may be delivered more than once
https://github.com/nats-io/nats-streaming-server
+30 client languages available
+30 client languages available
Core of NATS:
3 Simple Patterns
Messaging Patterns
● Publish/Subscribe (1:N)
● Request/Reply (1:1)
● Load Balanced Queue Subscribers (1:1)
Messaging Patterns
● Publish/Subscribe (Streams)
● Request/Reply (Services)
● Load Balanced Queue Subscribers (Streams or Services)
Publish/Subscribe (1:N)
NATS
Client
SUB foo
PUB foo
NATS
Client
NATS
Client
NATS
Client
Publish/Subscribe (1:N)
Request/Response (1:1)
NATS
Client
NATS
Client
Request/Response (1:1)
Request/Response (1:1)
Request/Response (1:1)
Request/Response (1:1)
PUB help
NATS
Client
SUB help
NATS
Client
NATS
Client
NATS
Client
Request/Response (1:1)
PUB help
NATS
Client
First message would be lowest latency response
NATS
Client
NATS
Client
NATS
Client
SUB help
Request/Response (1:N)
PUB help
NATS
Client
NATS
Client
NATS
Client
NATS
Client
Scatter & Gather multiple replies
SUB help
Request/Response (1:N)
PUB help
NATS
Client
Scatter & Gather multiple replies
NATS
Client
NATS
Client
NATS
Client
SUB help
Request/Response (1:N)
Request/Response (1:N)
Load Balanced Queues
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
Randomly distributed
Load Balanced Queues
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
Randomly distributed
Load Balanced Queues
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
Randomly distributed
Load Balanced Queues
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
Randomly distributed
Load Balanced Queues
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
Randomly distributed
Load Balanced Queues
Wildcards
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
Wildcards
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
Wildcards
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
Wildcards
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
Wildcards
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
Wildcards
SUB foo workers
PUB foo
NATS
Client
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
Wildcards
SUB foo.bar workers
PUB foo.bar
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
NATS
Client
SUB foo.*
Wildcards
SUB foo.bar workers
PUB foo.bar
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
NATS
Client
SUB foo.*
Wildcards
SUB foo.bar workers
PUB foo.bar
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
NATS
Client
SUB foo.*
Wildcards
SUB foo.bar workers
PUB foo.bar
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
NATS
Client
SUB foo.*
Wildcards
SUB foo.bar workers
PUB foo.bar
NATS
Client
NATS
Client
NATS
Client
NATS
Client
SUB >
NATS
Client
SUB foo.*
Messages replay with
NATS Streaming (STAN)
Message replay with STAN
NATS
Streaming
Client
NATS
Streaming
Server
● A NATS Streaming Server can be attached to the NATS
network and provide persistence of messages.
Message replay with STAN
Message replay with STAN
Running NATS on Kubernetes
Running NATS on Kubernetes
How to deploy NATS with 1000 lines of YAML*
*Note: NATS itself is platform agnostic
Running NATS on Kubernetes
● Recommended minimum version is Kubernetes v1.12
● Using StatefulSets with headless service
or NATS Operator suggested
Global NATS Cluster Topology
sgp1 (DOKS / Digital Ocean)
eu-west-1 (EKS / AWS)
us-west2 (GKE / Google)
Global NATS Cluster Topology
● Clients: 4222
● Routes: 6222
● Monitoring: 8222
● Leafnode: 7422
● Gateways: 7522
● Exporter: 7777 → 30900, 30901 (NodePort)
NATS Server Exposed Ports
NATS Docker Images
Creating a NATS Cluster
Configuration Reload
Connecting multiple
NATS Clusters using gateways
Decentralized Auth
with NKEYS & JWTs
Subject Isolation via Accounts
● Global account $G is the default subject namespace
● Multiple accounts and import/export services amongs them
● System account: special account to manage NATS itself
NKEYS + JWTs
NATS Streaming as a Leafnode
from a Super Cluster
Securing the cluster with TLS
Using cert-manager
https://github.com/jetstack/cert-manager
Monitoring via Prometheus
OSCON:  Building Cloud Native Apps with NATS
Done! Globally available and secure
NATS super cluster is now ready!
Questions?
Thanks!
https://natsio.slack.com
github.com/nats-io / @nats_io
https://nats.io
← Join the NATS community :)
Rate today’s session
Session page on conference website O’Reilly Events App

More Related Content

PDF
GoSF: Decoupling Services from IP networks with NATS
PPTX
Connect Everything with NATS - Cloud Expo Europe
PDF
KubeCon NA 2018 - NATS Deep Dive: The Evolution of NATS
PDF
KubeConEU - NATS Deep Dive
PDF
SF Python Meetup - Introduction to NATS Messaging with Python3
PDF
NATS for Rubyists - Tokyo Rubyist Meetup
PDF
Easy, Secure, and Fast: Using NATS.io for Streams and Services
PDF
Deploy Secure and Scalable Services Across Kubernetes Clusters with NATS
GoSF: Decoupling Services from IP networks with NATS
Connect Everything with NATS - Cloud Expo Europe
KubeCon NA 2018 - NATS Deep Dive: The Evolution of NATS
KubeConEU - NATS Deep Dive
SF Python Meetup - Introduction to NATS Messaging with Python3
NATS for Rubyists - Tokyo Rubyist Meetup
Easy, Secure, and Fast: Using NATS.io for Streams and Services
Deploy Secure and Scalable Services Across Kubernetes Clusters with NATS

What's hot (16)

PDF
NATS Connect Live!
PPTX
Deep Dive into Building a Secure & Multi-tenant SaaS Solution with NATS
PDF
NATS Connect Live | NATS as a Service Mesh
PDF
KubeCon NA 2019 Keynote | NATS - Past, Present, and the Future
PDF
A New Way of Thinking | NATS 2.0 & Connectivity
PDF
Implementing Microservices with NATS
PDF
KubeCon + CloudNative Con NA 2021 | A New Generation of NATS
PPTX
NATS for Modern Messaging and Microservices
PDF
Microservices Meetup San Francisco - August 2017 Talk on NATS
PDF
Network Security Best Practice (BCP38 & 140)
PDF
NATS + Docker meetup talk Oct - 2016
PDF
The Zen of High Performance Messaging with NATS (Strange Loop 2016)
PDF
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Era
PDF
Simple Solutions for Complex Problems - Boulder Meetup
PDF
What’s New in NGINX Plus R15? - EMEA
PDF
How Clarifai uses NATS and Kubernetes for Machine Learning
NATS Connect Live!
Deep Dive into Building a Secure & Multi-tenant SaaS Solution with NATS
NATS Connect Live | NATS as a Service Mesh
KubeCon NA 2019 Keynote | NATS - Past, Present, and the Future
A New Way of Thinking | NATS 2.0 & Connectivity
Implementing Microservices with NATS
KubeCon + CloudNative Con NA 2021 | A New Generation of NATS
NATS for Modern Messaging and Microservices
Microservices Meetup San Francisco - August 2017 Talk on NATS
Network Security Best Practice (BCP38 & 140)
NATS + Docker meetup talk Oct - 2016
The Zen of High Performance Messaging with NATS (Strange Loop 2016)
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Era
Simple Solutions for Complex Problems - Boulder Meetup
What’s New in NGINX Plus R15? - EMEA
How Clarifai uses NATS and Kubernetes for Machine Learning

Similar to OSCON: Building Cloud Native Apps with NATS (20)

PDF
ContainerDayVietnam2016: Kubernetes State-of-the-art Container Management Pla...
PDF
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...
PDF
NATS: Simple, Secure, and Scalable Messaging for the Cloud Native Era
PDF
Deploying OpenStack Services with Linux Containers - Brisbane OpenStack Meetu...
PDF
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
PDF
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
PDF
RethinkConn 2022!
PDF
NATS Connector Framework - Boulder Meetup
PDF
Osacon 2021 hello hydrate! from stream to clickhouse with apache pulsar and...
PPTX
9 ways to consume kubernetes on open stack in 15 mins (k8s meetup)
PDF
NATS Internals, Strengths and Challenges
PDF
Lunar Way and the Cloud Native "stack"
PDF
The Zen of High Performance Messaging with NATS
PDF
The Zen of High Performance Messaging with NATS
PPTX
Dragonflow Austin Summit Talk
PDF
Towards a Lightweight Multi-Cloud DSL for Elastic and Transferable Cloud-nati...
PDF
Cloud Native Applications on Kubernetes: a DevOps Approach
PDF
Apache hadoop 3.x state of the union and upgrade guidance - Strata 2019 NY
PPTX
OpenEBS Technical Workshop - KubeCon San Diego 2019
PDF
Get your instance by name integration of nova, neutron and designate
ContainerDayVietnam2016: Kubernetes State-of-the-art Container Management Pla...
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...
NATS: Simple, Secure, and Scalable Messaging for the Cloud Native Era
Deploying OpenStack Services with Linux Containers - Brisbane OpenStack Meetu...
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
RethinkConn 2022!
NATS Connector Framework - Boulder Meetup
Osacon 2021 hello hydrate! from stream to clickhouse with apache pulsar and...
9 ways to consume kubernetes on open stack in 15 mins (k8s meetup)
NATS Internals, Strengths and Challenges
Lunar Way and the Cloud Native "stack"
The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS
Dragonflow Austin Summit Talk
Towards a Lightweight Multi-Cloud DSL for Elastic and Transferable Cloud-nati...
Cloud Native Applications on Kubernetes: a DevOps Approach
Apache hadoop 3.x state of the union and upgrade guidance - Strata 2019 NY
OpenEBS Technical Workshop - KubeCon San Diego 2019
Get your instance by name integration of nova, neutron and designate

Recently uploaded (20)

PDF
Decision Optimization - From Theory to Practice
PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
PDF
The AI Revolution in Customer Service - 2025
PPTX
Presentation - Principles of Instructional Design.pptx
PPTX
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
PPTX
How to use fields_get method in Odoo 18
PDF
Human Computer Interaction Miterm Lesson
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PPTX
Blending method and technology for hydrogen.pptx
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Build Real-Time ML Apps with Python, Feast & NoSQL
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PPTX
Information-Technology-in-Human-Society.pptx
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PDF
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
Decision Optimization - From Theory to Practice
A symptom-driven medical diagnosis support model based on machine learning te...
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
The AI Revolution in Customer Service - 2025
Presentation - Principles of Instructional Design.pptx
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
How to use fields_get method in Odoo 18
Human Computer Interaction Miterm Lesson
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
Blending method and technology for hydrogen.pptx
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Build Real-Time ML Apps with Python, Feast & NoSQL
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Information-Technology-in-Human-Society.pptx
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
Early detection and classification of bone marrow changes in lumbar vertebrae...

OSCON: Building Cloud Native Apps with NATS