kubernets-dashboard顾名思义是操作面板安装,也就是可视化管理机器,同意我们用镜像结合配置文件部署。
1、下载镜像:
docker pull registry.docker-cn.com/kubernetesdashboarddev/kubernetes-dashboard-amd64:head
如图:
2、新增部署配置文件
需要2个文件。
文件一dashboard.yaml:
apiVersion: v1 kind: ServiceAccount metadata: name: kubernetes-dashboard namespace: kube-system --- 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 --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: kubernetes-dashboard namespace: kube-system labels: k8s-app: kubernetes-dashboard kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile spec: selector: matchLabels: k8s-app: kubernetes-dashboard template: metadata: labels: k8s-app: kubernetes-dashboard annotations: scheduler.alpha.kubernetes.io/critical-pod: ‘‘ spec: serviceAccountName: kubernetes-dashboard containers: - name: kubernetes-dashboard image: registry.docker-cn.com/kubernetesdashboarddev/kubernetes-dashboard-amd64:head resources: limits: cpu: 100m memory: 300Mi requests: cpu: 100m memory: 100Mi ports: - containerPort: 9090 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30 tolerations: - key: "CriticalAddonsOnly" operator: "Exists"
文件二:
dashboard-svc.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: 9090 targetPort: 9090 nodePort: 32017
3、分别执行2个部署文件
kubectl create -f dashboard.yaml kubectl create -f dashboard-svc.yaml
4、查询服务
跟上一届一样,替换一下关机子即可。
5、如何访问?
细心的人应该改法我们的yaml文件中有个ports定义,我们定义个nodeport的方式,端口为32017,这样
32017就监听在宿主机了,我们可以使用宿主机ip+32017,也就是10.10.90.105:32017访问了,如图:
此时已经可以使用面板进行管理集群了,只不过面板目前少了不展示node节点的一定负载情况,比如cpu、内存等,我们下一节中可以按照另外一个heapster插件进行展示,下一个教程再见!
原文地址:https://www.cnblogs.com/netsa/p/8376526.html
时间: 2024-11-05 19:29:36