SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Waldemar Quevedo
Deep Dive 2020:
Building Decentralized Applications
NATS Core Maintainer
About me
● Waldemar Quevedo / @wallyqs
● Software Engineer at
● NATS Core maintainer
● Using NATS since 2012
● Author of Practical NATS (Apress, 2018)
In this talk
● Deep Dive into some of the NATS features
● Example: Building Chat App Walkthrough
● Complete application can be found at:
https://github.com/wallyqs/kubecon2020/
The Chat App :)
Quick Recap: NATS Streams & Services
Core of NATS
● Streams
○ A “flow”
○ A sequence of messages that can be consumed. Fan out.
● Service
○ A subscription that takes request messages and can respond (RPC)
○ “Do something and return a result”
○ Load Balanced
Core of NATS: Subjects
A subject is simply a string representing an interest in data.
● Simple subject: foo or weather
● Hierarchically Tokenized: foo.bar, weather.us.co.denver
● Wildcard subscriptions
✓ foo.* matches foo.bar and foo.baz.
✓ foo.*.bar matches foo.a.bar and foo.b.bar.
✓ foo.> matches any of the above
✓ > matches everything in NATS
● Unique subjects for 1:1 addressability
Core of NATS: Streams
Streams: Subscribe() <-> Publish()
Export
Import
Core of NATS: Services
Services: Subscribe() <-> Request()
Export
Import
Streams
chat.KUBECON.posts.*
chat.KUBECON.dms.*
chat.KUBECON.online
Services
NATS
Client
Chat
Access
Response
Request
SERVICE: chat.req.access
To get access to the Chat Streams, first need to request for credentials.
Accounts Isolation
● We have 3 types of users, all part of the same account KUBECON
✓ Chat Credentials Requestor
./nats-req chat.req.access <username>
✓ Credential Provisioners
./chat-access -creds chat.creds
✓ Chat Users
./chat -creds my.creds
Using NSC
● NSC is the command line tool to manage users and accounts
https://github.com/nats-io/nsc
curl https://nats-io.github.io/k8s/setup/nsc-setup.sh | sh
● nsc add account --name KUBECON
[ OK ] generated and stored account key
"ADKN46NONOAOEPWUPFB47MOEBNOXRNJFRAKVOAQA7Q4JPVSFAPVHAW4T"
[ OK ] added account "KUBECON"
Creating the account
● The chat application will exist in the KUBECON account
> nsc add account --name KUBECON
[ OK ] generated and stored account key
"ADKN46NONOAOEPWUPFB47MOEBNOXRNJFRAKVOAQA7Q4JPVSFAPVHAW4T"
[ OK ] added account "KUBECON"
Adding a signing key
● Since chat users will be created on the fly, we will use a special
signing key for that purpose: https://docs.nats.io/nats-
tools/nsc/signing_keys
> nsc generate nkey --account --store
> nsc edit account --sk
AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI
[ OK ] added signing key
"AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI"
[ OK ] edited account "KUBECON"
Adding a signing key
Public Key
Starting the NATS Server
● We will use the NATS Server Trusted Operator setup for a
decentralized setup.
● NSC can generate the server config:
> nsc generate config --mem-resolver > nats.conf
> nats-server -c nats.conf
[INF] Starting nats-server version 2.2.0-beta.20
[DBG] Go build version go1.14.4
[INF] Git commit [not set]
[INF] Using configuration file: nats.conf
[INF] Trusted Operators
Create the Creds Provisioner
● The chat-access tool will use the account JWT and the signing key to issue
new credentials to users.
> nsc add user chat-access 
-K $NKEYS_PATH/keys/A/AB/AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI.nk
> cd chat-access
> go run main.go --acc $NSC_HOME/nats/KO/accounts/KUBECON/KUBECON.jwt 
--sk $NKEYS_PATH/keys/A/AB/AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI.nk 
--creds $NKEYS_PATH/creds/KO/KUBECON/chat-access.creds
Create the Creds Provisioner
Create the Creds Provisioner
QueueSubscription
makes this a load
balanced service.
Requesting Access
● In order to request access, we need to create a special user with very
limited permissions, that can only request for access.
nsc add user chat-creds-request -K $SIGNING_KEY 
> --allow-pubsub 'chat.req.access' 
> --allow-pubsub '_INBOX.>' 
> --allow-pubsub '_R_' 
> --allow-pubsub '_R_.>'
[ OK ] generated and stored user key "UAP7HBB4U7P6NIJTSYFHLU6AXS4KRSYGTLQDSFBQKVHYXFA26LPJH6AF"
[ OK ] generated user creds file "$NKEYS_PATH/creds/KO/KUBECON/chat-creds-request.creds"
[ OK ] added user "chat-creds-request" to account "KUBECON"
Required for requests
Requesting Access
./nats-req -s localhost -creds $NKEYS_PATH/creds/KO/KUBECON/chat-creds-request.creds chat.req.access foo
Published [chat.req.access] : 'foo'
Received [_INBOX.GoMGWmwpbPnwRSSpiXFeKd.2NumbUrd] : '
-----BEGIN NATS USER JWT-----
eyJ0eXAiOiJqd3QiLCJhbGciOiJlZDI1NTE5In0.eyJleHAiOjE2Mjc3NTc2NzYsImp0aSI6Ik43VEdNM0FRVFRaQVFWUElNRDNURlRZRUVYVkNWU1hPWEFIR0U3Q0g2UFJRWlpBUkFTSFEiLCJpYXQiOjE1OTYyMjE2NzYsImlzcyI6IkFBQ
ktRVE1CTlA3NFZXS01BNjRQRVJEWUg2WllCNDVZNUpJTlFLRzVNRUtKWjVNNDVKRFY1N0tJIiwibmFtZSI6ImZvbyIsInN1YiI6IlVEN0pRTkNUSlFKVUpEVTJLNUxUNVlRSVlWSk9MTElXRVlOTUs1UUxUQ1hCMkNQQTVJTllNUEo1Ii
widHlwZSI6InVzZXIiLCJuYXRzIjp7InB1YiI6eyJhbGxvdyI6WyJjaGF0LktVQkVDT04ub25saW5lIiwiY2hhdC5LVUJFQ09OLnBvc3RzLioiLCJjaGF0LktVQkVDT04uZG1zLioiXX0sInN1YiI6eyJhbGxvdyI6WyJjaGF0LktVQkVDT04ub25saW5
lIiwiY2hhdC5LVUJFQ09OLnBvc3RzLioiLCJjaGF0LktVQkVDT04uZG1zLlVEN0pRTkNUSlFKVUpEVTJLNUxUNVlRSVlWSk9MTElXRVlOTUs1UUxUQ1hCMkNQQTVJTllNUEo1IiwiX0lOQk9YLlx1MDAzZSJdfSwicGF5bG9hZCI6MTAyN
H0sImlzc3Vlcl9hY2NvdW50IjoiQURLTjQ2Tk9OT0FPRVBXVVBGQjQ3TU9FQk5PWFJOSkZSQUtWT0FRQTdRNEpQVlNGQVBWSEFXNFQifQ.d1tr9RFHFqqLQ4Ed-
Oncuu43l843rS5FLq6MhA8ocj2qj2ZcvD_UE1SoKKnRMoJxUdZVMty8GhT8RA3Qpo85AA
------END NATS USER JWT------
************************* IMPORTANT *************************
Private NKEYs are sensitive and should be treated as secrets.
-----BEGIN USER PRIVATE KEY-----
SUAN7DPWZXEXUFAG3QEZIU6WQIUECAEHXHFBD6NA62ALPCGTVESWPGBRUQ
------END USER PRIVATE KEY------
*************************************************************
Requesting Access
DMs subscription only work
against the user public key
Entering the chat
● A user can now connect with this credentials and join a chat.
./chat -s localhost -creds foo.creds
Entering the chat
● We can use the same credentials to listen to online events.
> nats-sub -creds userA.creds 'chat.KUBECON.online'
Listening on [chat.KUBECON.online]
[#1] Received on [chat.KUBECON.online]:
'eyJ0eXAiOiJqd3QiLCJhbGciOiJlZDI1NTE5In0.eyJleHAiOjE1OTYyMjMwMTAsImp0aSI6IjNZSlpHUjROQVE3VTJJVFFFSU41WlBCRlBPV
1A3QVZDRTRISTZLRElMUzVKRkZVSFg1WlEiLCJpYXQiOjE1OTYyMjI5NTAsImlzcyI6IlVCQUNSWURRWlZUVFFONE9ITlRESEdPTDZS
V0VTWlNMM0tBR1hYSDJaWU5HTUNZRTVWVVcyNkpZIiwibmFtZSI6ImZvbyIsInN1YiI6IlVCQUNSWURRWlZUVFFONE9ITlRESEdPTDZ
SV0VTWlNMM0tBR1hYSDJaWU5HTUNZRTVWVVcyNkpZIiwidHlwZSI6Im5ncy1jaGF0LW9ubGluZSJ9.tu8Q8x88FpDmFhYQbSLiKDKiz4q
P9yy7c0S23zIRQzhBHlxBLX9wpduQaF9HOcEYivMSu538cesPDP2EVyy8Bg'
Entering the chat
● But can only subscribe to personal DMs
> nats-sub -creds userA.creds
‘chat.KUBECON.dms.UBGAWHHSU2CKNIHYWSCXA53HLYCCKRH5TB6HWW3QSJGGA652WSANDCG5'
> nats-sub -creds userA.creds 'chat.KUBECON.dms.*'
nats: Permissions Violation for Subscription to "chat.KUBECON.dms.*"
The Chat Client
The Chat Client
Done :)
● Complete application can be found at:
https://github.com/wallyqs/kubecon2020/
Thanks!
https://natsio.slack.com
github.com/nats-io / @nats_io
https://nats.io
← Join the NATS community :)
Deep Dive into Building a Secure & Multi-tenant SaaS Solution with NATS

Weitere ähnliche Inhalte

Was ist angesagt?

The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS NATS
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices NATS
 
NATS Connect Live!
NATS Connect Live!NATS Connect Live!
NATS Connect Live!NATS
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?Anton Zadorozhniy
 
Deep Dive into Kubernetes - Part 1
Deep Dive into Kubernetes - Part 1Deep Dive into Kubernetes - Part 1
Deep Dive into Kubernetes - Part 1Imesh Gunaratne
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetesrajdeep
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes ArchitectureKnoldus Inc.
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionPeng Xiao
 
Monitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheusMonitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheusChandresh Pancholi
 
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm NATS
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introductionSparkbit
 
KubeConEU - NATS Deep Dive
KubeConEU - NATS Deep DiveKubeConEU - NATS Deep Dive
KubeConEU - NATS Deep Divewallyqs
 
Implementing Microservices with NATS
Implementing Microservices with NATSImplementing Microservices with NATS
Implementing Microservices with NATSApcera
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesApcera
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive OverviewBob Killen
 
Service Discovery In Kubernetes
Service Discovery In KubernetesService Discovery In Kubernetes
Service Discovery In KubernetesKnoldus Inc.
 
Designing a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd productsDesigning a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd productsJulian Mazzitelli
 

Was ist angesagt? (20)

The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS
 
NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices NATS for Modern Messaging and Microservices
NATS for Modern Messaging and Microservices
 
NATS Connect Live!
NATS Connect Live!NATS Connect Live!
NATS Connect Live!
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?
 
Deep Dive into Kubernetes - Part 1
Deep Dive into Kubernetes - Part 1Deep Dive into Kubernetes - Part 1
Deep Dive into Kubernetes - Part 1
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes Architecture
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
Monitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheusMonitoring on Kubernetes using prometheus
Monitoring on Kubernetes using prometheus
 
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
Simple and Scalable Microservices: Using NATS with Docker Compose and Swarm
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introduction
 
KubeConEU - NATS Deep Dive
KubeConEU - NATS Deep DiveKubeConEU - NATS Deep Dive
KubeConEU - NATS Deep Dive
 
Implementing Microservices with NATS
Implementing Microservices with NATSImplementing Microservices with NATS
Implementing Microservices with NATS
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices Architectures
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview
 
Service Discovery In Kubernetes
Service Discovery In KubernetesService Discovery In Kubernetes
Service Discovery In Kubernetes
 
Designing a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd productsDesigning a complete ci cd pipeline using argo events, workflow and cd products
Designing a complete ci cd pipeline using argo events, workflow and cd products
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 

Ähnlich wie Deep Dive into Building a Secure & Multi-tenant SaaS Solution with NATS

Pdf tech deep dive 42 paris
Pdf tech deep dive 42 parisPdf tech deep dive 42 paris
Pdf tech deep dive 42 parisLaure Vergeron
 
No REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIsNo REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIsC4Media
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsAndrey Karpov
 
User authentication and authorizarion in Kubernetes
User authentication and authorizarion in KubernetesUser authentication and authorizarion in Kubernetes
User authentication and authorizarion in KubernetesNeependra Khare
 
Capture, record, clip, embed and play, search: video from newbie to ninja
Capture, record, clip, embed and play, search: video from newbie to ninjaCapture, record, clip, embed and play, search: video from newbie to ninja
Capture, record, clip, embed and play, search: video from newbie to ninjaVito Flavio Lorusso
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack apiLiang Bo
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon DrangeHåkon Eriksen Drange
 
Caching with Varnish
Caching with VarnishCaching with Varnish
Caching with Varnishschoefmax
 
LF_APIStrat17_REST API Microversions
LF_APIStrat17_REST API Microversions LF_APIStrat17_REST API Microversions
LF_APIStrat17_REST API Microversions LF_APIStrat
 
Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1KlaraOrban
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINXKevin Jones
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINXNGINX, Inc.
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetesBen Hall
 
Developer ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrial
Developer ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrialDeveloper ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrial
Developer ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrialNitu Parimi
 
Serverless Data Architecture at scale on Google Cloud Platform
Serverless Data Architecture at scale on Google Cloud PlatformServerless Data Architecture at scale on Google Cloud Platform
Serverless Data Architecture at scale on Google Cloud PlatformMeetupDataScienceRoma
 
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...NETWAYS
 

Ähnlich wie Deep Dive into Building a Secure & Multi-tenant SaaS Solution with NATS (20)

Pdf tech deep dive 42 paris
Pdf tech deep dive 42 parisPdf tech deep dive 42 paris
Pdf tech deep dive 42 paris
 
No REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIsNo REST - Architecting Real-time Bulk Async APIs
No REST - Architecting Real-time Bulk Async APIs
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
 
User authentication and authorizarion in Kubernetes
User authentication and authorizarion in KubernetesUser authentication and authorizarion in Kubernetes
User authentication and authorizarion in Kubernetes
 
Capture, record, clip, embed and play, search: video from newbie to ninja
Capture, record, clip, embed and play, search: video from newbie to ninjaCapture, record, clip, embed and play, search: video from newbie to ninja
Capture, record, clip, embed and play, search: video from newbie to ninja
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
k8s-on-azure
 k8s-on-azure k8s-on-azure
k8s-on-azure
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange
2016-02-09 - Breakfast Seminar - Redpill Linpro - Chef at Aptoma - Håkon Drange
 
Caching with Varnish
Caching with VarnishCaching with Varnish
Caching with Varnish
 
LF_APIStrat17_REST API Microversions
LF_APIStrat17_REST API Microversions LF_APIStrat17_REST API Microversions
LF_APIStrat17_REST API Microversions
 
Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Developer ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrial
Developer ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrialDeveloper ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrial
Developer ExperienceAWS_Oracle_Azure_Heroku_DigitaOceanCloudFreeTrial
 
Serverless Data Architecture at scale on Google Cloud Platform
Serverless Data Architecture at scale on Google Cloud PlatformServerless Data Architecture at scale on Google Cloud Platform
Serverless Data Architecture at scale on Google Cloud Platform
 
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
stackconf 2020 | The path to a Serverless-native era with Kubernetes by Paolo...
 

Mehr von NATS

NATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATS
NATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATSNATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATS
NATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATSNATS
 
NATS Connect Live | SwimOS & NATS
NATS Connect Live | SwimOS & NATSNATS Connect Live | SwimOS & NATS
NATS Connect Live | SwimOS & NATSNATS
 
NATS Connect Live | Pub/Sub on the Power Grid
NATS Connect Live | Pub/Sub on the Power GridNATS Connect Live | Pub/Sub on the Power Grid
NATS Connect Live | Pub/Sub on the Power GridNATS
 
NATS Connect Live | Distributed Identity & Authorization
NATS Connect Live | Distributed Identity & AuthorizationNATS Connect Live | Distributed Identity & Authorization
NATS Connect Live | Distributed Identity & AuthorizationNATS
 
NATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service MeshNATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service MeshNATS
 
NATS Connect Live | Resgate
NATS Connect Live | ResgateNATS Connect Live | Resgate
NATS Connect Live | ResgateNATS
 
NATS Connect Live | NATS & Augmented Reality
NATS Connect Live | NATS & Augmented RealityNATS Connect Live | NATS & Augmented Reality
NATS Connect Live | NATS & Augmented RealityNATS
 
KubeCon NA 2019 Keynote | NATS - Past, Present, and the Future
KubeCon NA 2019 Keynote | NATS - Past, Present, and the FutureKubeCon NA 2019 Keynote | NATS - Past, Present, and the Future
KubeCon NA 2019 Keynote | NATS - Past, Present, and the FutureNATS
 
OSCON 2019 | Time to Think Different
OSCON 2019 | Time to Think DifferentOSCON 2019 | Time to Think Different
OSCON 2019 | Time to Think DifferentNATS
 
Serverless for the Cloud Native Era with Fission
Serverless for the Cloud Native Era with FissionServerless for the Cloud Native Era with Fission
Serverless for the Cloud Native Era with FissionNATS
 
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...NATS
 
Writing Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talkWriting Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talkNATS
 
NATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice CommunicationNATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice CommunicationNATS
 
Using NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed SystemsUsing NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed SystemsNATS
 
Integration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesIntegration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesNATS
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup NATS
 
Actor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder MeetupActor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder MeetupNATS
 
Implementing Microservices with NATS
Implementing Microservices with NATSImplementing Microservices with NATS
Implementing Microservices with NATSNATS
 
How Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the Internet How Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the Internet NATS
 
How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine Learning How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine Learning NATS
 

Mehr von NATS (20)

NATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATS
NATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATSNATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATS
NATS Connect Live | Serverless on Kubernetes with OpenFaaS & NATS
 
NATS Connect Live | SwimOS & NATS
NATS Connect Live | SwimOS & NATSNATS Connect Live | SwimOS & NATS
NATS Connect Live | SwimOS & NATS
 
NATS Connect Live | Pub/Sub on the Power Grid
NATS Connect Live | Pub/Sub on the Power GridNATS Connect Live | Pub/Sub on the Power Grid
NATS Connect Live | Pub/Sub on the Power Grid
 
NATS Connect Live | Distributed Identity & Authorization
NATS Connect Live | Distributed Identity & AuthorizationNATS Connect Live | Distributed Identity & Authorization
NATS Connect Live | Distributed Identity & Authorization
 
NATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service MeshNATS Connect Live | NATS as a Service Mesh
NATS Connect Live | NATS as a Service Mesh
 
NATS Connect Live | Resgate
NATS Connect Live | ResgateNATS Connect Live | Resgate
NATS Connect Live | Resgate
 
NATS Connect Live | NATS & Augmented Reality
NATS Connect Live | NATS & Augmented RealityNATS Connect Live | NATS & Augmented Reality
NATS Connect Live | NATS & Augmented Reality
 
KubeCon NA 2019 Keynote | NATS - Past, Present, and the Future
KubeCon NA 2019 Keynote | NATS - Past, Present, and the FutureKubeCon NA 2019 Keynote | NATS - Past, Present, and the Future
KubeCon NA 2019 Keynote | NATS - Past, Present, and the Future
 
OSCON 2019 | Time to Think Different
OSCON 2019 | Time to Think DifferentOSCON 2019 | Time to Think Different
OSCON 2019 | Time to Think Different
 
Serverless for the Cloud Native Era with Fission
Serverless for the Cloud Native Era with FissionServerless for the Cloud Native Era with Fission
Serverless for the Cloud Native Era with Fission
 
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...
Simple, Secure, Scalable Messaging for the Cloud Native Era - AllThingsOpen 2...
 
Writing Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talkWriting Networking Clients in Go - GopherCon 2017 talk
Writing Networking Clients in Go - GopherCon 2017 talk
 
NATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice CommunicationNATS vs HTTP for Interservice Communication
NATS vs HTTP for Interservice Communication
 
Using NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed SystemsUsing NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed Systems
 
Integration Patterns for Microservices Architectures
Integration Patterns for Microservices ArchitecturesIntegration Patterns for Microservices Architectures
Integration Patterns for Microservices Architectures
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup
 
Actor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder MeetupActor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder Meetup
 
Implementing Microservices with NATS
Implementing Microservices with NATSImplementing Microservices with NATS
Implementing Microservices with NATS
 
How Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the Internet How Greta uses NATS to revolutionize data distribution on the Internet
How Greta uses NATS to revolutionize data distribution on the Internet
 
How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine Learning How Clarifai uses NATS and Kubernetes for Machine Learning
How Clarifai uses NATS and Kubernetes for Machine Learning
 

Kürzlich hochgeladen

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 

Kürzlich hochgeladen (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 

Deep Dive into Building a Secure & Multi-tenant SaaS Solution with NATS

  • 1. Waldemar Quevedo Deep Dive 2020: Building Decentralized Applications NATS Core Maintainer
  • 2. About me ● Waldemar Quevedo / @wallyqs ● Software Engineer at ● NATS Core maintainer ● Using NATS since 2012 ● Author of Practical NATS (Apress, 2018)
  • 3. In this talk ● Deep Dive into some of the NATS features ● Example: Building Chat App Walkthrough ● Complete application can be found at: https://github.com/wallyqs/kubecon2020/
  • 5. Quick Recap: NATS Streams & Services
  • 6. Core of NATS ● Streams ○ A “flow” ○ A sequence of messages that can be consumed. Fan out. ● Service ○ A subscription that takes request messages and can respond (RPC) ○ “Do something and return a result” ○ Load Balanced
  • 7. Core of NATS: Subjects A subject is simply a string representing an interest in data. ● Simple subject: foo or weather ● Hierarchically Tokenized: foo.bar, weather.us.co.denver ● Wildcard subscriptions ✓ foo.* matches foo.bar and foo.baz. ✓ foo.*.bar matches foo.a.bar and foo.b.bar. ✓ foo.> matches any of the above ✓ > matches everything in NATS ● Unique subjects for 1:1 addressability
  • 8. Core of NATS: Streams Streams: Subscribe() <-> Publish() Export Import
  • 9. Core of NATS: Services Services: Subscribe() <-> Request() Export Import
  • 11. Services NATS Client Chat Access Response Request SERVICE: chat.req.access To get access to the Chat Streams, first need to request for credentials.
  • 12. Accounts Isolation ● We have 3 types of users, all part of the same account KUBECON ✓ Chat Credentials Requestor ./nats-req chat.req.access <username> ✓ Credential Provisioners ./chat-access -creds chat.creds ✓ Chat Users ./chat -creds my.creds
  • 13. Using NSC ● NSC is the command line tool to manage users and accounts https://github.com/nats-io/nsc curl https://nats-io.github.io/k8s/setup/nsc-setup.sh | sh ● nsc add account --name KUBECON [ OK ] generated and stored account key "ADKN46NONOAOEPWUPFB47MOEBNOXRNJFRAKVOAQA7Q4JPVSFAPVHAW4T" [ OK ] added account "KUBECON"
  • 14. Creating the account ● The chat application will exist in the KUBECON account > nsc add account --name KUBECON [ OK ] generated and stored account key "ADKN46NONOAOEPWUPFB47MOEBNOXRNJFRAKVOAQA7Q4JPVSFAPVHAW4T" [ OK ] added account "KUBECON"
  • 15. Adding a signing key ● Since chat users will be created on the fly, we will use a special signing key for that purpose: https://docs.nats.io/nats- tools/nsc/signing_keys > nsc generate nkey --account --store > nsc edit account --sk AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI [ OK ] added signing key "AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI" [ OK ] edited account "KUBECON"
  • 16. Adding a signing key Public Key
  • 17. Starting the NATS Server ● We will use the NATS Server Trusted Operator setup for a decentralized setup. ● NSC can generate the server config: > nsc generate config --mem-resolver > nats.conf > nats-server -c nats.conf [INF] Starting nats-server version 2.2.0-beta.20 [DBG] Go build version go1.14.4 [INF] Git commit [not set] [INF] Using configuration file: nats.conf [INF] Trusted Operators
  • 18. Create the Creds Provisioner ● The chat-access tool will use the account JWT and the signing key to issue new credentials to users. > nsc add user chat-access -K $NKEYS_PATH/keys/A/AB/AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI.nk > cd chat-access > go run main.go --acc $NSC_HOME/nats/KO/accounts/KUBECON/KUBECON.jwt --sk $NKEYS_PATH/keys/A/AB/AABKQTMBNP74VWKMA64PERDYH6ZYB45Y5JINQKG5MEKJZ5M45JDV57KI.nk --creds $NKEYS_PATH/creds/KO/KUBECON/chat-access.creds
  • 19. Create the Creds Provisioner
  • 20. Create the Creds Provisioner QueueSubscription makes this a load balanced service.
  • 21. Requesting Access ● In order to request access, we need to create a special user with very limited permissions, that can only request for access. nsc add user chat-creds-request -K $SIGNING_KEY > --allow-pubsub 'chat.req.access' > --allow-pubsub '_INBOX.>' > --allow-pubsub '_R_' > --allow-pubsub '_R_.>' [ OK ] generated and stored user key "UAP7HBB4U7P6NIJTSYFHLU6AXS4KRSYGTLQDSFBQKVHYXFA26LPJH6AF" [ OK ] generated user creds file "$NKEYS_PATH/creds/KO/KUBECON/chat-creds-request.creds" [ OK ] added user "chat-creds-request" to account "KUBECON" Required for requests
  • 22. Requesting Access ./nats-req -s localhost -creds $NKEYS_PATH/creds/KO/KUBECON/chat-creds-request.creds chat.req.access foo Published [chat.req.access] : 'foo' Received [_INBOX.GoMGWmwpbPnwRSSpiXFeKd.2NumbUrd] : ' -----BEGIN NATS USER JWT----- eyJ0eXAiOiJqd3QiLCJhbGciOiJlZDI1NTE5In0.eyJleHAiOjE2Mjc3NTc2NzYsImp0aSI6Ik43VEdNM0FRVFRaQVFWUElNRDNURlRZRUVYVkNWU1hPWEFIR0U3Q0g2UFJRWlpBUkFTSFEiLCJpYXQiOjE1OTYyMjE2NzYsImlzcyI6IkFBQ ktRVE1CTlA3NFZXS01BNjRQRVJEWUg2WllCNDVZNUpJTlFLRzVNRUtKWjVNNDVKRFY1N0tJIiwibmFtZSI6ImZvbyIsInN1YiI6IlVEN0pRTkNUSlFKVUpEVTJLNUxUNVlRSVlWSk9MTElXRVlOTUs1UUxUQ1hCMkNQQTVJTllNUEo1Ii widHlwZSI6InVzZXIiLCJuYXRzIjp7InB1YiI6eyJhbGxvdyI6WyJjaGF0LktVQkVDT04ub25saW5lIiwiY2hhdC5LVUJFQ09OLnBvc3RzLioiLCJjaGF0LktVQkVDT04uZG1zLioiXX0sInN1YiI6eyJhbGxvdyI6WyJjaGF0LktVQkVDT04ub25saW5 lIiwiY2hhdC5LVUJFQ09OLnBvc3RzLioiLCJjaGF0LktVQkVDT04uZG1zLlVEN0pRTkNUSlFKVUpEVTJLNUxUNVlRSVlWSk9MTElXRVlOTUs1UUxUQ1hCMkNQQTVJTllNUEo1IiwiX0lOQk9YLlx1MDAzZSJdfSwicGF5bG9hZCI6MTAyN H0sImlzc3Vlcl9hY2NvdW50IjoiQURLTjQ2Tk9OT0FPRVBXVVBGQjQ3TU9FQk5PWFJOSkZSQUtWT0FRQTdRNEpQVlNGQVBWSEFXNFQifQ.d1tr9RFHFqqLQ4Ed- Oncuu43l843rS5FLq6MhA8ocj2qj2ZcvD_UE1SoKKnRMoJxUdZVMty8GhT8RA3Qpo85AA ------END NATS USER JWT------ ************************* IMPORTANT ************************* Private NKEYs are sensitive and should be treated as secrets. -----BEGIN USER PRIVATE KEY----- SUAN7DPWZXEXUFAG3QEZIU6WQIUECAEHXHFBD6NA62ALPCGTVESWPGBRUQ ------END USER PRIVATE KEY------ *************************************************************
  • 23. Requesting Access DMs subscription only work against the user public key
  • 24. Entering the chat ● A user can now connect with this credentials and join a chat. ./chat -s localhost -creds foo.creds
  • 25. Entering the chat ● We can use the same credentials to listen to online events. > nats-sub -creds userA.creds 'chat.KUBECON.online' Listening on [chat.KUBECON.online] [#1] Received on [chat.KUBECON.online]: 'eyJ0eXAiOiJqd3QiLCJhbGciOiJlZDI1NTE5In0.eyJleHAiOjE1OTYyMjMwMTAsImp0aSI6IjNZSlpHUjROQVE3VTJJVFFFSU41WlBCRlBPV 1A3QVZDRTRISTZLRElMUzVKRkZVSFg1WlEiLCJpYXQiOjE1OTYyMjI5NTAsImlzcyI6IlVCQUNSWURRWlZUVFFONE9ITlRESEdPTDZS V0VTWlNMM0tBR1hYSDJaWU5HTUNZRTVWVVcyNkpZIiwibmFtZSI6ImZvbyIsInN1YiI6IlVCQUNSWURRWlZUVFFONE9ITlRESEdPTDZ SV0VTWlNMM0tBR1hYSDJaWU5HTUNZRTVWVVcyNkpZIiwidHlwZSI6Im5ncy1jaGF0LW9ubGluZSJ9.tu8Q8x88FpDmFhYQbSLiKDKiz4q P9yy7c0S23zIRQzhBHlxBLX9wpduQaF9HOcEYivMSu538cesPDP2EVyy8Bg'
  • 26. Entering the chat ● But can only subscribe to personal DMs > nats-sub -creds userA.creds ‘chat.KUBECON.dms.UBGAWHHSU2CKNIHYWSCXA53HLYCCKRH5TB6HWW3QSJGGA652WSANDCG5' > nats-sub -creds userA.creds 'chat.KUBECON.dms.*' nats: Permissions Violation for Subscription to "chat.KUBECON.dms.*"
  • 29. Done :) ● Complete application can be found at: https://github.com/wallyqs/kubecon2020/