Kubernetes应用生产(五)Dashboard部署(网页篇)

1、Master节点执行安装Dashboard

1.1 下载配置编排文件2.5.0

如果你安装的不是 1.23版本,需要查验版本的兼容性
kubernetes/dashboard ·GitHub 点击链接查看https://github.com/kubernetes/dashboard/releases
下载
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml

kubectl apply -f recommended.yaml

1.2 大概率需要翻墙,我这里提供连接

阿里云盘地址: https://www.aliyundrive.com/s/TbaTfLpTUam
提取码: nn46
我云盘里的文件名字是:recommended-2.5.0.yaml

1.3 下载后需要修改

vim recommended.yaml
找到 kind: Service 项 添加如下字段
kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
spec:
  ports:
    - port: 443
      targetPort: 8443
#添加下面两行端口和类型
      nodePort: 30003
  type: NodePort
  selector:
    k8s-app: kubernetes-dashboard
保存退出 :wq!

1.4  部署及查看运行

kubectl apply -f recommended.yaml

# 如下显示 即为正常
[gestep@k8s-master dashboard]$ kubectl get all  -n kubernetes-dashboard
NAME                                     READY   STATUS    RESTARTS   AGE
pod/dashboard-metrics-scraper-799d786dbf-86zj7   1/1   Running   0   53m
pod/kubernetes-dashboard-546cbc58cd-9kc4l        1/1   Running   0   53m

NAME        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
service/dashboard-metrics-scraper ClusterIP 10.98.252.149 8000/TCP 53m
service/kubernetes-dashboard      NodePort 10.96.45.254 443:30003/TCP 54m

NAME              READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/dashboard-metrics-scraper   1/1     1       1      53m
deployment.apps/kubernetes-dashboard        1/1     1       1      53m

NAME                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/dashboard-metrics-scraper-799d786dbf   1    1      1   53m
replicaset.apps/kubernetes-dashboard-546cbc58cd        1    1      1   53m

1.5 访问

访问 https://192.168.2.21:30003/

 创建管理用户并获取token

kubectl create serviceaccount dashboard-admin -n kube-system
kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
kubectl describe secrets -n kube-system $(kubectl -n kube-system get secret | awk '/dashboard-admin/{print $1}')
# key
eyJhbGciOiJSUzI1NiIsImtpZCI6IkhLNWpRYmNHNGJaVkdDRm1Sb05PbDBiRzk4TzFGZE1CaHJHMTVvRFE5bkUifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tOG52OXciLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiYzFmMjczOGMtZTZkMi00YjRkLTgxZTktM2U2MmZiN2Y3OTg4Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.YqypvyKjxdg7fdj1R-sIVxDrvQVT7il9e21mcgU-XqFsb7dDnwFv6R6LHIk4M3yDSpeNd-N8NYWoWlfFva97Y8UV3GAX3KZOgAvgfcMxfyzO4VLEh5XD0Rf32xlr_5E-Kxv37HIFgcd2fLJIZnLHK0EWX6TXo7t0RAt01ZQdPMjHV4LFmEo5RMBb3bdBJdRRfcQdRQ2JYXuY8XtH29p2KtG-CAKsug0-hjcqn1xnOZ6FAJ3bYzyWCHSoNyoClPzUv-1wZVEXnpQcJatvv1nuEfFGDXWj0E5IsgreAqKh9rQmQu9n8yhDCwjCMnacfa9NzPhl48qrMzii4SRQIr3NaQ

复制 token: 后的一长串,填入页面token项中 ,登录即可

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值