kubernetes dashboard 訪問問題

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
相關文章
相關標籤/搜索