k8s集群dashboard服务部署
k8s集群dashboard服务部署拉取镜像生成yml,映射端口yaml运行等命令token令牌认证参考链接:https://cloud.tencent.com/developer/article/1487532拉取镜像docker pull registry.cn-hangzhou.aliyuncs.com/rsqlh/kubernetes-dashboard:v1.10.1docker...
k8s集群dashboard服务部署
参考链接:https://cloud.tencent.com/developer/article/1487532
拉取镜像
docker pull registry.cn-hangzhou.aliyuncs.com/rsqlh/kubernetes-dashboard:v1.10.1
docker tag registry.cn-hangzhou.aliyuncs.com/rsqlh/kubernetes-dashboard:v1.10.1 k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
生成yml,映射端口
wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
sed -i '/targetPort:/a\ \ \ \ \ \ nodePort: 32500\n\ \ type: NodePort' kubernetes-dashboard.yaml
yaml运行等命令
- 安装服务
kubectl create -f kubernetes-dashboard.yaml - 删除服务
kubectl delete -f kubernetes-dashboard.yaml - 查看服务
kubectl get pods -n kube-system - 其他命令
kubectl get service --namespace=kube-system
kubectl describe service kubernetes-dashboard --namespace=kube-system
kubectl get pods --namespace=kube-system -o wide - 访问https:/masterNodeIP:32500/
token令牌认证
-
kubectl create serviceaccount dashboard-admin -n kube-system
-
把serviceaccount绑定在clusteradmin,授权serviceaccount用户具有整个集群的访问管理权限
kubectl create clusterrolebinding dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin -
获取serviceaccount的secret信息,可得到token(令牌)的信息
kubectl get secret -n kube-system
#dashboard-admin-token-slfcr 通过上边命令获取到的 -
kubectl describe secret dashboard-admin-token-slfcr -n kube-system
-
快速查看token
kubectl describe secrets -n kube-system $(kubectl -n kube-system get secret | awk ‘/admin/{print $1}’)
更多推荐
所有评论(0)