月度归档:2020年11月

etcdctl 操作

用户操作

列出用户

$ etcdctl user list

添加用户

$ etcdctl user add devuser (input password)
Password of devuser:
Type password of devuser again for confirmation:
User devuser created

修改密码

$ etcdctl user passwd devuser

角色操作

添加role,名为 devteam

$ etcdctl role add devteam
Role devteam created

给用户 devuser 添加 role: devteam

$ etcdctl user grant-role devuser devteam
Role devteam is granted to user devuser

查看用户的信息

$ etcdctl user get devuser
User: devuser
Roles: devteam

赋予 role 相应的权限

$ etcdctl role grant-permission devteam --prefix=true readwrite
Role devteam updated

确保存在 root 用户,作为管理者

$ etcdctl user add root
Password of root:
Type password of root again for confirmation:
User root created

激活认证功能

$ etcdctl auth enable
Authentication Enabled

取消认证功能

$ etcdctl --user root:mypass auth disable
Authentication Disabled

重新激活认证功能

$ etcdctl auth enable
Authentication Enabled

查看已有的所有 role

$ etcdctl --user root:mypass role list
$ etcdctl --user root:mypassrole get devteam
Role devteam
KV Read:
KV Write:

取消dev的权限

$ etcdctl --user root:mypass role revoke-permission devteam --prefix=true