kubespray已经默承认以安装dashboard,安装后如何进行访问?node
官方提供了几种方式 proxy,nodeport,ingressapi
ingress方式我一直没有试验成功,如今使用nodeport方式session
kubectl -n kube-system edit service kubernetes-dashboard
使用NodePort 替换ClusterIPapp
# Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: v1 ... name: kubernetes-dashboard namespace: kube-system resourceVersion: "343478" selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard-head uid: 8e48f478-993d-11e7-87e0-901b0e532516 spec: clusterIP: 10.100.124.90 externalTrafficPolicy: Cluster ports: - port: 443 protocol: TCP targetPort: 8443 selector: k8s-app: kubernetes-dashboard sessionAffinity: None type: ClusterIP status: loadBalancer: {}
$ kubectl -n kube-system get service kubernetes-dashboard NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-dashboard 10.100.124.90 <nodes> 443:31707/TCP 21h
就可使用http://master:31707 进行访问ui
新版的dashboard 有权限问题,若是想获取admin,须要本身配置,另外官方不建议这么配置,我只是为了方便查看,this
dashboard-admin.yaml 。kubectl create -f dashboard-admin.yaml 。访问dashboard后直接skip就能够了spa
apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: kubernetes-dashboard labels: k8s-app: kubernetes-dashboard roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: kubernetes-dashboard namespace: kube-system