export ETCDCTL_API=3
ENDPOINTS=localhost:2379

etcdctl --endpoints=${ENDPOINTS} role add root
etcdctl --endpoints=${ENDPOINTS} role grant-permission root readwrite foo
etcdctl --endpoints=${ENDPOINTS} role get root

etcdctl --endpoints=${ENDPOINTS} user add root
etcdctl --endpoints=${ENDPOINTS} user grant-role root root
etcdctl --endpoints=${ENDPOINTS} user get root

etcdctl --endpoints=${ENDPOINTS} auth enable
# now all client requests go through auth

etcdctl --endpoints=${ENDPOINTS} --user=root:123 put foo bar
etcdctl --endpoints=${ENDPOINTS} get foo
etcdctl --endpoints=${ENDPOINTS} --user=root:123 get foo
etcdctl --endpoints=${ENDPOINTS} --user=root:123 get foo1

相关文章:

  • 2021-12-03
  • 2021-11-03
  • 2021-11-03
  • 2021-11-03
  • 2021-08-14
  • 2021-11-14
  • 2021-12-20
猜你喜欢
  • 2022-12-23
  • 2021-11-03
  • 2021-10-03
  • 2021-06-09
  • 2021-08-26
  • 2021-10-14
相关资源
相似解决方案