1. 程式人生 > >Kubernetes v1.10----部署kubernetes-dashboard v1.83

Kubernetes v1.10----部署kubernetes-dashboard v1.83

https rec 編輯 技術分享 proxy version create command ces

Kubernetes v1.10----部署kubernetes-dashboard v1.83

1.下載 kubernetes-dashboard yaml文件

#因為文件中的image指定的是谷歌,所以不能直接使用apply進行部署

wget https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

修改iamge

kubernetes-dashboard.yaml

....
    spec:
      serviceAccountName: kubernetes-dashboard
      containers:
      - name: kubernetes-dashboard
        image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/kubernetes-dashboard-amd64:v1.8.3 
....

wq保存

2.編輯 kubernetes-rbac.yaml 文件用於之後的用戶認證

apiVersion: v1
kind: ServiceAccount
metadata:
  name: kubernetes-dashboard
  namespace: kube-system

---

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: kubernetes-dashboard
subjects:
  - kind: ServiceAccount
    name: kubernetes-dashboard
    namespace: kube-system
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io

3.添加用戶

vim /etc/kubernetes/pki/basic_auth_file

技術分享圖片

4.修改kube-apiserver配置

vim /etc/kubernetes/manifests/kube-apiserver.yaml

spec:
  containers:
  - command:
    - kube-apiserver
    ...
    - --anonymous-auth=false
    - --insecure-bind-address=127.0.0.1
    - --insecure-port=8080
    - --basic-auth-file=/etc/kubernetes/pki/basic_auth_file
... livenessProbe: failureThreshold: 8 httpGet: host: 127.0.0.1 path: /healthz port: 8080 scheme: HTTP

  

5.重啟服務

systemctl restart kubelet

驗證服務是否正常

技術分享圖片

6.安裝dashboard

分別執行

kubectl apply -f kubernetes-dashboard.yaml
kubectl apply -f kubernetes-rbac.yaml
kubectl create clusterrolebinding login-dashboard-admin --clusterrole=cluster-admin --user=admin

7.查看服務是否運行

技術分享圖片

8.訪問

https://master:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

技術分享圖片

10.登陸驗證

輸入剛才我們在文件當中的用戶名:admin 密碼:admin 點擊登陸,成功。

Kubernetes v1.10----部署kubernetes-dashboard v1.83