安装Kubernetes-Dashboard插件
為什么80%的碼農都做不了架構師?>>> ??
關于如何搭建基于docker的Kubernetes環境,請看筆者另一片博客: https://my.oschina.net/u/3559870/blog/1031428
插件說明
完成使用Kubeadm搭建Kubernetes(docker)之后,Kubernetes實際已經搭建成功~但是頻繁操作命令行界面是會崩潰的好嗎!!所以在Kubernetes 1.2版本后新增了Kube Dashboard,我們就可以在瀏覽器愉快的通過點 點 點操作啦。 ##功能說明 ## create:上傳json或者yaml的方式新建resource,同kubectl create -f delete:刪除副本(Replication Controllers) modify:修改副本數(replicas) query:查詢相關信息,同kubectl get 通過web-ui+上述功能,我們就能基本脫離命令行界面了!
安裝步驟
此時已經完成kubernetes的搭建。 我們將dashboard以靜態Pod的方式運行在Master Node上。
cd /etc/kubernetes/manifests此目錄是已有的靜態Pod的yaml文件,我們創建kubernetes-dashboard.yaml文件
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.# Configuration to deploy release version of the Dashboard UI compatible with # Kubernetes 1.6 (RBAC enabled). # # Example usage: kubectl create -f <this_file>apiVersion: v1 kind: ServiceAccount metadata:labels:app: kubernetes-dashboardname: kubernetes-dashboardnamespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata:name: kubernetes-dashboardlabels:app: kubernetes-dashboard roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: cluster-admin subjects: - kind: ServiceAccountname: kubernetes-dashboardnamespace: kube-system --- kind: Deployment apiVersion: extensions/v1beta1 metadata:labels:app: kubernetes-dashboardname: kubernetes-dashboardnamespace: kube-system spec:replicas: 1revisionHistoryLimit: 10selector:matchLabels:app: kubernetes-dashboardtemplate:metadata:labels:app: kubernetes-dashboardspec:containers:- name: kubernetes-dashboardimage: registry.cn-beijing.aliyuncs.com/bbt_k8s/kubernetes-dashboard-amd64:v1.6.0imagePullPolicy: Alwaysports:- containerPort: 9090protocol: TCPargs:# 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://my-address:portlivenessProbe:httpGet:path: /port: 9090initialDelaySeconds: 30timeoutSeconds: 30serviceAccountName: kubernetes-dashboard# Comment the following tolerations if Dashboard must not be deployed on mastertolerations:- key: node-role.kubernetes.io/mastereffect: NoSchedule --- kind: Service apiVersion: v1 metadata:labels:app: kubernetes-dashboardname: kubernetes-dashboardnamespace: kube-system spec:type: NodePortports:- port: 80targetPort: 9090selector:app: kubernetes-dashboard創建文件kubernetes-dashboard-rbac.yaml文件
kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1beta1 metadata:name: dashboard-admin roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: cluster-admin subjects: - kind: ServiceAccountname: defaultnamespace: kube-system創建dashboard、dashboard-rbac resource
kubectl create -f kubernetes-dashboard-rbac.yml kubectl create -f kubernetes-dashboard.yaml創建成功結果如下所示
[root@kube-master manifests]# kubectl create -f dashboard-rbac.yaml clusterrolebinding "dashboard-admin" created [root@kube-master manifests]# kubectl create -f dashboard.yaml serviceaccount "kubernetes-dashboard" created clusterrolebinding "kubernetes-dashboard" created deployment "kubernetes-dashboard" created service "kubernetes-dashboard" created查詢dashboard運行的端口
kubectl describe --namespace kube-system service kubernetes-dashboard [root@kube-master manifests]# kubectl describe --namespace kube-system service kubernetes-dashboard Name: kubernetes-dashboard Namespace: kube-system Labels: app=kubernetes-dashboard Annotations: <none> Selector: app=kubernetes-dashboard Type: NodePort IP: 10.110.236.54 Port: <unset> 80/TCP NodePort: <unset> 30989/TCP Endpoints: 10.244.0.16:9090 Session Affinity: None Events: <none>NodePort就是我們要訪問的端口啦!快快打開瀏覽器輸入{master-ip}:{node-port}吧!
轉載于:https://my.oschina.net/zili/blog/1031430
總結
以上是生活随笔為你收集整理的安装Kubernetes-Dashboard插件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用 Webix 创建 Email 客户
- 下一篇: 实现主从模式