本文作者:丁辉
部署Kubernetes仪表板
部署 Dashboard UI
1
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
编辑对外 svc 文件
1
vi kubernetes-dashboard-svc.yaml
内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17apiVersion: v1
kind: Service
metadata:
name: kubernetes-dashboard-40000
labels:
k8s-app: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
ports:
- name: kubernetes-dashboard
nodePort: 40000
port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
type: NodePort部署
1
kubectl apply -f kubernetes-dashboard-svc.yaml
查看状态
1
kubectl get all -n kubernetes-dashboard
获取长期令牌
1
vi kubernetes-dashboard-token.yaml
内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27apiVersion: 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
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创建
1
kubectl apply -f kubernetes-dashboard-token.yaml
查看 token
1
kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d
I'm so cute. Please give me money.
- 本文链接: https://blog.offends.cn/Kubernetes/资源部署/部署Kubernetes仪表板.html
- 版权声明: 本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。