本文 紧接上一篇:详细教程 Centos8.5 基于 k8s v1.30.1 部署高可用集群 kubeadm 安装 kubernetes v1.30.1 docker集群搭建 延长证书有效期-CSDN博客

1  Dashboard 从版本 7.0.0 开始,不再支持基于清单的安装。仅支持基于 Helm 的安装.

#Helm 下载安装

 https://github.com/helm/helm/releases

wget  https://get.helm.sh/helm-v3.15.0-linux-amd64.tar.gz
#解压
tar  zxvf  helm-v3.15.0-linux-amd64.tar.gz
#mv  linux-amd64/helm  /usr/bin/
#查看版本
[root@master11 soft]# helm version
version.BuildInfo{Version:"v3.15.0-rc.2", GitCommit:"c4e37b39dbb341cb3f716220df9f9d306d123a58", GitTreeState:"clean", GoVersion:"go1.22.3"}
#Tab 补全
vim /etc/profile
source <(helm completion bash)
source /etc/profile

2  安装Dashboard

helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
#查看
[root@master11 soft]# helm repo list
NAME                	URL                                    
kubernetes-dashboard	https://kubernetes.github.io/dashboard/
#查询dashboard
[root@master11 ~]# helm search repo kubernetes-dashboard
NAME                                     	CHART VERSION	APP VERSION	DESCRIPTION                                   
kubernetes-dashboard/kubernetes-dashboard	7.4.0        	           	General-purpose web UI for Kubernetes clusters
#安装
helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard

 

 #修改端口,外部可以访问

kubectl edit svc  -n kubernetes-dashboard  kubernetes-dashboard-kong-proxy
type: ClusterIP --> type: NodePort
#查看
kubectl get svc -A |grep kubernetes-dashboard

#获取Token

vi dashboard-user.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
#
kubectl  apply -f dashboard-user.yaml
#获取token
kubectl -n kubernetes-dashboard  create token admin-user

#创建正式token

vi dashboard-admin.yaml
apiVersion: v1
kind: Secret
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
  annotations:
    kubernetes.io/service-account.name: "admin-user"
type: kubernetes.io/service-account-token

#
kubectl  apply -f dashboard-admin.yaml
#获取Token
kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d

3 访问IP+端口: https://192.168.50.11:31015/

#输入之前获取的token

 

 

 

#集群概况

kubectl get node,po,svc -A -owide

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐