dashborad安装部署,并使用nginx反向代理
安装
首先需要下载对应的yaml,github下载地址选择对应的版本的代码
修改配置
进入对应目录:
cd dashboard/aio/deploy
找到recommended.yaml文件,修改内容:
添加以下参数,防止使用nginx反向代理时出现400错误
--enable-insecure-login --insecure-port=8443
我在此处使用了NodePort的暴露方式nginx参考配置
生成登陆使用的token
# 创建用户
# kubectl create serviceaccount dashboard-admin -n kube-system
# 用户授权
# kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
# 获取用户token
# kubectl describe secrets -n kube-system $(kubectl -n kube-system get secret | awk '/dashboard-admin/{print $1}')
Name: dashboard-admin-token-lflm9
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: dashboard-admin
kubernetes.io/service-account.uid: f73d4dd5-6a0d-4917-a2ce-54dba6a1882c
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1066 bytes
namespace: 11 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImdXS2ZwaHV2WVZwREhQenZyZUw5SWRYV3VReHhObVZKMXZyX1hUWm1mZTQifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tbGZsbTkiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiZjczZDRkZDUtNmEwZC00OTE3LWEyY2UtNTRkYmE2YTE4ODJjIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.mMF7dO0QdOlC-ff7W7pCCMJ4YMtAC-X3kMdGEK7IHFxOiA78qJF9e8IQ8fRAje4cJjF33AmBKkeieJdz-KE_Wm7Wj_6u_A9_csm3hfpWLV3mN5VeKbvQ1G7fXFkN1aFpBw7Gr7kxtXmXewOb9XR05YblwVg2omoAnJlGfHlnkASJ4d0CwyCn9CiiTJs_611jqCyrkf9dhik9vtmLtqZxCVzDtdsA0CMH4Gny0f27OHnN9q_QDOr5Hg6gBzaimgS1n_NXu60up_M_7Yi9_Cg3FtlKNZr0Eav27uStsGU_Jneg_DVvPu51c3k3lNpQBUUiwjsltP2r3trQRFAkTtEWpA