k8s安装dashboard
原创小于 1 分钟
安装kubernetes - dashboard
本实践将在 Ubuntu 22.04.3LTS 系统上进行安装测试
docker版本 24.0.6
kubeadm版本v1.28.2
版本
操作步骤
参考资料
https://github.com/kubernetes/dashboard/releases/tag/v3.0.0-alpha0
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.1/cert-manager.yaml
# 等上面初始化完成
# kubectl get pods,svc,ingress -A -o wide
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v3.0.0-alpha0/charts/kubernetes-dashboard.yaml
# 直接用 portainer 修改 ingress host -> k8s.example.com
# https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md
kubectl apply -f dashboard-adminuser.yaml
kubectl apply -f dashboard-ClusterRoleBinding.yaml
kubectl apply -f dashboard-Secret.yaml
# 获取token
kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d
eyJhbGciOiJSUzIxxxxxxxxxxxxxxxxxlciJ9.Sa8JxxxxxxxxxxxxxxxxxxxxxxxxxxxYA7xOA
增加超时时间,避免频繁退出切换
kubectl edit -n kubernetes-dashboard deploy/kubernetes-dashboard-api
spec:
containers:
- args:
- --enable-insecure-login
- --namespace=kubernetes-dashboard
- --token-ttl=172800