====== 重設 Rancher admin 的密碼 ======
因為第一次安裝設定 admin 密碼錯誤, 導致無法登入. 所以找了一下如何重設 admin 密碼.
* 環境是[[tech/rke-k8s|透過 rke 先安裝好 K8s]] 然後再透過 helm 安裝 rancher 起來
* 重設密碼的語法
kubectl -n cattle-system exec $(kubectl -n cattle-system get pods -l app=rancher | grep '1/1' | head -1 | awk '{ print $1 }') -- reset-password
* 執行之後就會產生新的 admin 密碼 Exp.
$ kubectl -n cattle-system exec $(kubectl -n cattle-system get pods -l app=rancher | grep '1/1' | head -1 | awk '{ print $1 }') -- reset-password
W0825 07:19:27.737911 69 client_config.go:552] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
New password for default admin user (user-d7kdv):
NoAFWxFcb3qJ2DXjXVqC
* 可以透過 Rancher WebUI 以這個重設密碼登入後再來修改成自己的密碼
===== 參考網址 =====
* https://rancher.com/docs/rancher/v2.x/en/faq/technical/
{{tag>rancher reset_admin}}