- 试错次数超限被限制登录
目前kubesphere 版本中没有提供邮箱找回密码的功能,所以经常会有忘记密码,重试次数过多导致账户被锁定的问题。
可以通过调整 kubesphere-system
项目下 ks-account
的参数auth-rate-limit
来调整试错次数,默认策略为30分钟内不超过5次失败登录。
kubectl -n kubespehre-system edit deploy ks-account
containers:
- command:
- ks-iam
- --logtostderr=true
- --jwt-secret=$(JWT_SECRET)
- --admin-password=$(ADMIN_PASSWORD)
- --enable-multi-login=False
- --token-idle-timeout=40m
- --auth-rate-limit=5/30m
- --redis-url=redis://redis.kubesphere-system.svc:6379
参数说明:
–auth-rate-limit=5/30m specifies the maximum number of authentication attempts permitted and time interval,valid time units are “s”,“m”,“h”.
- 忘记管理员密码
方法1: 如果还有可以登录的管理员账号的话,可以到 平台管理->账号管理->用户列表->用户详情页->更多操作->修改密码。
方法2: 没有其他可以登录的管理员账号,需要通过进入到 容器中通过API 将admin
的密码重置为P@88word
packet='PUT /kapis/iam.kubesphere.io/v1alpha2/users/admin HTTP/1.1\r\nHost: ks-account.kubesphere-system.svc:9090\r\nUser-Agent: curl/7.54.0\r\nAccept: */*\r\nContent-Type: application/json\r\nContent-Length: 105\r\n\r\n{"username": "admin","email":"admin@kubesphere.io","cluster_role": "cluster-admin","password":"P@88w0rd"}'; echo -ne $packet | nc ks-account.kubesphere-system.svc 80
- 修改自动登出超时时间
默认配置下会话会在限制40分钟后自动登出,可以通过调整 ks-account 组件中token-idle-timeout
参数调整这个时间间隔。