码迷,mamicode.com
首页 > 其他好文 > 详细

k8s安装之dashboard

时间:2019-10-27 01:23:04      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:nod   配置文件   count   clust   com   create   manage   get   asi   

dashboard
wget https://storage.googleapis.com/kubernetes-release/release/v1.11.0/kubernetes-server-linux-amd64.tar.gz
tar -xzvf kubernetes-server-linux-amd64.tar.gz
cd kubernetes
tar -zxf kubernetes-src.tar.gz
cd cluster/addons/dashboard
cp *.yaml ~/dashboard/
#####修改配置文件

cat dashboard-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: kubernetes-dashboard
  namespace: kube-system
  labels:
    k8s-app: kubernetes-dashboard
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
spec:
  selector:
    k8s-app: kubernetes-dashboard
  type: NodePort ###此处为添加
  ports:
  - port: 443
    targetPort: 8443
#####修改kube-apiserver.service

--anonymous-auth=false \ # 不接受匿名访问,若为true,则表示接受,此处设置为false,便于dashboard访问
--basic-auth-file=/etc/kubernetes/basic_auth_file 新建/etc/kubernetes/basic_auth_file文件,并在其中添加:

admin,admin,1002
#####启动

kubectl apply -f .
#####权限

kubectl create clusterrolebinding login-dashboard-admin --clusterrole=cluster-admin --user=admin

#####获取token

kubectl -n kube-system create sa dashboard
kubectl create clusterrolebinding dashboard --clusterrole cluster-admin --serviceaccount=kube-system:dashboard
SECRET=$(kubectl -n kube-system get sa dashboard -o yaml | awk ‘/dashboard-token/ {print $3}‘)
kubectl -n kube-system describe secrets ${SECRET} | awk ‘/token:/{print $2}‘
测试
https://172.16.20.206:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

k8s安装之dashboard

标签:nod   配置文件   count   clust   com   create   manage   get   asi   

原文地址:https://blog.51cto.com/phospherus/2445751

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!