千家信息网

部署kubernetes-dashboard

发表于:2024-10-24 作者:千家信息网编辑
千家信息网最后更新 2024年10月24日,在线部署kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/
千家信息网最后更新 2024年10月24日部署kubernetes-dashboard

在线部署
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

为了方便使用,修改Service 类型为NodePort
kubectl edit service/kubernetes-dashboard -n kubernetes-dashboard
添加 type: NodePort
修改 nodePort: 30001
并保存

apiVersion: v1kind: Servicemetadata:  annotations:    kubectl.kubernetes.io/last-applied-configuration: |      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"k8s-app":"kubernetes-dashboard"},"name":"kubernetes-dashboard","namespace":"kubernetes-dashboard"},"spec":{"ports":[{"port":443,"targetPort":8443}],"selector":{"k8s-app":"kubernetes-dashboard"}}}  creationTimestamp: "2020-01-07T16:31:17Z"  labels:    k8s-app: kubernetes-dashboard  name: kubernetes-dashboard  namespace: kubernetes-dashboard  resourceVersion: "13889"  selfLink: /api/v1/namespaces/kubernetes-dashboard/services/kubernetes-dashboard  uid: 26fbfe40-bace-40e5-9a59-efdbb38cca4fspec:  clusterIP: 10.110.70.158  externalTrafficPolicy: Cluster  ports:  - nodePort: 30001    port: 443    protocol: TCP    targetPort: 8443  selector:    k8s-app: kubernetes-dashboard  sessionAffinity: None  type: NodePortstatus:  loadBalancer: {}

之后,应用dashboard-adminuser.yaml:

apiVersion: v1kind: ServiceAccountmetadata:  name: admin-user  namespace: kubernetes-dashboard---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata:  name: admin-userroleRef:  apiGroup: rbac.authorization.k8s.io  kind: ClusterRole  name: cluster-adminsubjects:- kind: ServiceAccount  name: admin-user  namespace: kubernetes-dashboard
0