Kubernetes1.5 整合dashboard

來源:互聯網
上載者:User

標籤:tin   meta   raw   manually   alt   line   toc   and   dns   

Kubernetes1.5 整合dashboard

 

配置kubernetes的dashboard相對簡單。同樣的,只需要從源碼中擷取到dashboard-controller.yaml及dashboard-service.yaml檔案,稍加修改即可:

wget https://rawgit.com/kubernetes/kubernetes/master/cluster/addons/dashboard/dashboard-controller.yamlwget https://rawgit.com/kubernetes/kubernetes/master/cluster/addons/dashboard/dashboard-service.yaml

修改dashboard-controller.yaml如下:

kind: DeploymentapiVersion: extensions/v1beta1metadata:  labels:    app: kubernetes-dashboard  name: kubernetes-dashboard  namespace: kube-systemspec:  replicas: 1  revisionHistoryLimit: 10  selector:    matchLabels:      app: kubernetes-dashboard  template:    metadata:      labels:        app: kubernetes-dashboard      # Comment the following annotation if Dashboard must not be deployed on master      annotations:        scheduler.alpha.kubernetes.io/tolerations: |          [            {              "key": "dedicated",              "operator": "Equal",              "value": "master",              "effect": "NoSchedule"            }          ]    spec:      containers:      - name: kubernetes-dashboard        image: myhub.fdccloud.com/library/kubernetes-dashboard-amd64:v1.5.1        imagePullPolicy: Always        ports:        - containerPort: 9090          protocol: TCP        args:          # Uncomment the following line to manually specify Kubernetes API server Host          # If not specified, Dashboard will attempt to auto discover the API server and connect          # to it. Uncomment only if the default does not work.
     #額外增加 - --apiserver-host=http://10.5.10.116:8080 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30

dashboard-service.yaml不需要修改,這裡直接給出源碼中的樣本檔案:

kind: ServiceapiVersion: v1metadata:  labels:    app: kubernetes-dashboard  name: kubernetes-dashboard  namespace: kube-systemspec:  type: NodePort  ports:  - port: 80    targetPort: 9090  selector:    app: kubernetes-dashboard

執行啟動即可:

kubectl create -f dashboard-controller.yamlkubectl create -f dashboard-service.yaml

啟動後,可以通過如下指令查看映射的nodeport:

[[email protected] kubernetes]# kubectl get svc --namespace=kube-systemNAME                   CLUSTER-IP     EXTERNAL-IP   PORT(S)         AGEkube-dns               10.254.0.100   <none>        53/UDP,53/TCP   5hkubernetes-dashboard   10.254.68.60   <nodes>       80:30097/TCP    1d

以下訪問地址皆可用於訪問:

http://10.5.10.116:8080/uihttp://10.5.10.116:30097

dashboard介面

 

錯誤說明:

在實際的配置過程中,發現dashboard無法啟動,通過kubectl logs 查看pod日誌,如下:

# kubectl logs --namespace=kube-system <容器名>
Using HTTP port: 9090Error while initializing connection to Kubernetes apiserver. This most likely means that the cluster is misconfigurhas invalid apiserver certificates or service accounts configuration) or the --apiserver-host param points to a ser not exist. Reason: invalid configuration: no configuration has been providedRefer to the troubleshooting guide for more information: https://github.com/kubernetes/dashboard/blob/master/docs/uubleshooting.md

這個錯誤,就是因為需要在dashboard啟動的args參數裡加上如下參數:

--apiserver-host=http://10.5.10.116:8080

 

另外,我們發現這個dashboard的訪問沒有任何的認證與授權機制,後續會專門對kubernetes的認證機製做相關說明。

 

Kubernetes1.5 整合dashboard

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.