部署 Dashboard
Dashboard 是基于网页的 Kubernetes 用户界面。 你可以使用 Dashboard 将容器应用部署到 Kubernetes 集群中,也可以对容器应用排错,还能管理集群资源。 你可以使用 Dashboard 获取运行在集群中的应用的概览信息,也可以创建或者修改 Kubernetes 资源 (如 Deployment、Job、DaemonSet 等等)。 例如,你可以对 Deployment 实现弹性伸缩、发起滚动升级、重启 Pod 或者使用向导创建新的应用。
Dashboard 同时展示了 Kubernetes 集群中的资源状态信息和所有报错信息。
部署版本
Dashboard: v2.7.0
Chart version: 6.0.8
添加 chart 仓库
Bash # Add kubernetes-dashboard repository helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
helm repo ls helm search repo kubernetes-dashboard -l
|
下载 helm chart
Bash helm pull kubernetes-dashboard/kubernetes-dashboard --version=6.0.8
|
解压 chart 包
Bash tar xvf kubernetes-dashboard-6.0.8.tgz
|
修改 Values
YAML image: ## Repository for container repository: kubernetesui/dashboard tag: "" # If not defined, uses appVersion of Chart.yaml pullPolicy: IfNotPresent pullSecrets: []
## Number of replicas replicaCount: 1
## Pod resource requests & limits resources: requests: cpu: 100m memory: 200Mi limits: cpu: 2 memory: 200Mi
|
部署
Bash helm upgrade --install kubernetes-dashboard -f kubernetes-dashboard/dashboard-values.yaml ./kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard
|
修改 SVC 为NodePort
Bash kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard
|
更新
YAML [root@master-01 18-dashboard]# helm upgrade -n kubernetes-dashboard -f kubernetes-dashboard/dashboard-values.yaml kubernetes-dashboard ./kubernetes-dashboard Release "kubernetes-dashboard" has been upgraded. Happy Helming! NAME: kubernetes-dashboard LAST DEPLOYED: Sun Nov 19 13:03:09 2023 NAMESPACE: kubernetes-dashboard STATUS: deployed REVISION: 2 TEST SUITE: None
|
获取访问地址
Bash kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard
[root@master-01 18-dashboard]# kubectl -n kubernetes-dashboard get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-dashboard NodePort 10.110.44.158 <none> 443:31268/TCP 165m
|
访问
创建 用户
Bash kubectl apply -f 01-admin-user-sa.yaml kubectl apply -f 02-admin-user-bind.yaml kubectl apply -f 03-sa-secret.yaml kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d
|
启用 ingress
修改 values.yaml
YAML ingress: ## If true, Kubernetes Dashboard Ingress will be created. ## enabled: true
## Kubernetes Dashboard Ingress labels # labels: # key: value
## Kubernetes Dashboard Ingress annotations annotations: kubernetes.io/ingress.class: nginx kubernetes.io/tls-acme: 'true'
## Kubernetes Dashboard Ingress Class className: "nginx"
## Kubernetes Dashboard Ingress hostnames ## Must be provided if Ingress is enabled ## hosts: - ui.xinxianghf.cloud ## Kubernetes Dashboard Ingress TLS configuration ## Secrets must be manually created in the namespace ## tls: - secretName: dashboard-secret hosts: - ui.xinxianghf.cloud
|
创建 tls 证书
Bash kubectl -n kubernetes-dashboard \ create secret tls dashboard-secret \ --cert=ui.xinxianghf.cloud_bundle.crt \ --key=ui.xinxianghf.cloud.key
|
更新部署
YAML helm upgrade --install kubernetes-dashboard -f kubernetes-dashboard/dashboard-values.yaml ./kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard
|
参考:
https://github.com/kubernetes/dashboard
https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
评论(0)