集群部署
略,参考官网
Docker Rancher Server 证书更新
证书未过期
证书未过期时,Rancher Server 可以正常运行。升级到 Rancher v2.0.14+、v2.1.9+、v2.2.2+ 后会自动检查证书有效期,如果发现证书即将过期,将会自动生成新的证书。所以独立容器运行的 Rancher Server,只需在证书过期前把 Rancher 版本升级到支持自动更新 SSL 证书的版本即可,无需做其他操作。
证书已过期
如果证书已过期,那么 Rancher Server 无法正常运行。即使升级到 Rancher v2.0.14+、v2.1.9+、v2.2.2+ 也可能会提示证书错误。如果出现这种情况,可通过以下操作进行处理:
- 仅适用于 2.4+ 的版本,其他版本参考官网
1 | # exec 到 rancher server |
- 重启 Rancher Server 容器
1 | docker restart <rancher_server_id> |
Webhook 证书过期,导致 Rancher 创建角色报证书错误
参考:https://forums.rancher.cn/t/webhook-rancher2-5-1/83
问题:
报错详情:Internal error occurred: failed calling webhook "rancherauth.cattle.io": Post https://rancher-webhook.cattle-system.svc:443/v1/webhook/validation?timeout=10s: x509: certificate has expired or is not yet valid
其他:K8s 集群证书前段时间才通过界面轮换过,然后使用正常,需要新加用户和角色时添加不了,一直报上面错误
解答:
这个问题是因为 bug 导致 webhook 证书没有自动轮转,导致 webhook 证书过期。只要操作 RBAC 相关的功能就会报错。
详细的解决方案参考:https://github.com/rancher/rancher/issues/35068#issuecomment-949053479
