Kubernetes v1.10----部署kubernetes-dashboard v1.83
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 点击登陆,成功。