Before you begin
Create JWT secret key and tokens
We can use thepulsarctl to create the secret key and issue jwt tokens.
-
Create a secret key
-
Issue the tokens for
broker-adminandproxy-adminsubjects. -
Issue the tokens for
clientsubject
Create Kubernetes Secrets for secret key and tokens
-
Create the secret key Secret
-
Create the
broker-admintoken Secret -
Create the
proxy-admintoken Secret
Enable JWT authentication for Pulsar cluster
To enable JWT authentication on the Pulsar cluster, we need to add configurations onPulsarBroker object:
- [1]
config.clientAuth: Added for using the toolset. - [2]
config.custom: add Pulsar configurations for authentication and authorization. - [3]
pod.secretRefs: mount the Secret resources. - [4]
pod.vars: use environment variables to render Pulsar configurations
PulsarProxy object, we need to add configurations:
- [1]
config.custom: add Pulsar configurations for authentication and authorization. - [2]
pod.secretRefs: mount the Secret resources. - [3]
pod.vars: use environment variables to render Pulsar configurations
Clients connect to Pulsar with JWT token
-
Create authorization for the client subject with
broker-admintoken -
Produce messages with client token