Skip to content

Instantly share code, notes, and snippets.

@wallyqs
Created March 18, 2022 16:16
Show Gist options
  • Save wallyqs/8a6370345ce7786ca8abe0555759d671 to your computer and use it in GitHub Desktop.
Save wallyqs/8a6370345ce7786ca8abe0555759d671 to your computer and use it in GitHub Desktop.
Example System Account in Helm
nats:
image: nats:alpine
jetstream:
enabled: true
memStorage:
enabled: true
size: "2Gi"
fileStorage:
enabled: true
size: "8Gi"
storageDirectory: /data/
storageClassName: gp2
cluster:
enabled: true
# Can set a custom cluster name
# name: "nats"
replicas: 3
auth:
enabled: true
systemAccount: sys
basic:
accounts:
sys:
users:
- user: sys
pass: sys
notjs:
js:
jetstream: true
users:
- user: foo
pass: foo
- user: bar
pass: bar
notjs:
users:
- user: quux
pass: quux
@wallyqs
Copy link
Author

wallyqs commented Mar 18, 2022

# system user
$ nats -s 'sys:sys@localhost' server request routes
{"server":{"name":"nats-auth-0","host":"0.0.0.0","id":"NAA764BOQBR7CDOMM2FLSLHHSPHRPFH4J6FF37CBLULPZVBATAUBJS5U","cluster":"nats","ver":"2.7.3","seq":109,"jetstream":true,"time":"2022-03-18T16:15:35.082724676Z"},"data":{"server_id":"NAA764BOQBR7CDOMM2FLSLHHSPHRPFH4J6FF37CBLULPZVBATAUBJS5U","now":"2022-03-18T16:15:35.082643217Z","num_routes":2,"routes":[{"rid":8,"remote_id":"NAR7BS47CEYYQN23G4LWNCI7PUKIUSSECROUGYBLMKIMGKFXTQU7O7S2","did_solicit":true,"is_configured":true,"ip":"192.168.4.211","port":6222,"pending_size":0,"rtt":"7.320843ms","in_msgs":205,"out_msgs":233,"in_bytes":22367,"out_bytes":33834,"subscriptions":41},{"rid":10,"remote_id":"NDNG7JPTV5H6M2VXWXFLWIE73TUF4TSMMDMYN5YA6A5RTQYVFTST2BKH","did_solicit":true,"is_configured":true,"ip":"192.168.93.113","port":6222,"pending_size":0,"rtt":"1.029443ms","in_msgs":732,"out_msgs":751,"in_bytes":45061,"out_bytes":42299,"subscriptions":47}]}}

# JetStream user
$  nats -s 'foo:foo@localhost' stream report
Obtaining Stream stats

No Streams defined

# Regular user
$ nats -s 'quux:quux@localhost' stream report
Obtaining Stream stats

nats: error: JetStream not enabled for account (10039), try --help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment