博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
k8s-部署WEB-UI(dashboard)
阅读量:4958 次
发布时间:2019-06-12

本文共 5679 字,大约阅读时间需要 18 分钟。

[root@k8s-master dashboard]# pwd

/usr/local/src/kubernetes/cluster/addons/dashboard

[root@k8s-master dashboard]# mkdir /usr/local/src/dashboard

[root@k8s-master dashboard]# cp dashboard-rbac.yaml dashboard-service.yaml dashboard-controller.yaml /usr/local/src/dashboard
[root@k8s-master dashboard]# cd /usr/local/src/dashboard/
[root@k8s-master dashboard]# ll
total 12
-rw-r--r-- 1 root root 1821 May 30 01:01 dashboard-controller.yaml
-rw-r--r-- 1 root root 1353 May 30 01:01 dashboard-rbac.yaml
-rw-r--r-- 1 root root 322 May 30 01:01 dashboard-service.yaml

 

[root@k8s-master dashboard]# pwd/usr/local/src/dashboard[root@k8s-master dashboard]# lltotal 12-rw-r--r-- 1 root root 1147 May 30 02:09 dashboard-controller.yaml-rw-r--r-- 1 root root  606 May 30 01:54 dashboard-rbac.yaml-rw-r--r-- 1 root root  338 May 30 02:10 dashboard-service.yaml[root@k8s-master dashboard]# kubectl create -f dashboard-rbac.yaml [root@k8s-master dashboard]# kubectl create -f dashboard-controller.yaml deployment "kubernetes-dashboard" created[root@k8s-master dashboard]# kubectl create -f dashboard-service.yaml service "kubernetes-dashboard" created###查看[root@k8s-master ~]# kubectl get services kubernetes-dashboard -n kube-systemNAME                   TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGEkubernetes-dashboard   NodePort   10.10.10.199   
80:45439/TCP 2m[root@k8s-master dashboard]# kubectl get pods -n kube-system #####status not runningNAME READY STATUS RESTARTS AGEkubernetes-dashboard-765c8bfdff-ddwvw 0/1 ImagePullBackOff 0 22m[root@k8s-master dashboard]# kubectl describe pod kubernetes-dashboard-765c8bfdff-ddwvw -n kube-system ####查看原因发现里面的一个image地址写错了,解决办法如下:[root@k8s-master dashboard]# kubectl delete -f dashboard-controller.yaml deployment "kubernetes-dashboard" deleted[root@k8s-master dashboard]# kubectl create -f dashboard-controller.yaml deployment "kubernetes-dashboard" created[root@k8s-master dashboard]# kubectl get podsNAME READY STATUS RESTARTS AGEnginx-64f497f8fd-jnhgm 1/1 Running 0 20hnginx-64f497f8fd-n5pst 1/1 Running 0 20hnginx-64f497f8fd-rzldm 1/1 Running 0 20h[root@k8s-master dashboard]# kubectl get pods -n kube-systemNAME READY STATUS RESTARTS AGEkubernetes-dashboard-769c9999cb-wwxsn 1/1 Running 0 21s[root@k8s-master dashboard]# kubectl get all -n kube-systemNAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGEdeploy/kubernetes-dashboard 1 1 1 1 18mNAME DESIRED CURRENT READY AGErs/kubernetes-dashboard-769c9999cb 1 1 1 18mNAME READY STATUS RESTARTS AGEpo/kubernetes-dashboard-769c9999cb-wwxsn 1/1 Running 0 18mNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEsvc/kubernetes-dashboard NodePort 10.10.10.199
80:45439/TCP 42m[root@k8s-master dashboard]# kubectl get svc -n kube-systemNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEkubernetes-dashboard NodePort 10.10.10.199
80:45439/TCP 46m
[root@k8s-master dashboard]# cat dashboard-controller.yaml apiVersion: apps/v1beta2kind: Deploymentmetadata:  name: kubernetes-dashboard  namespace: kube-system  labels:    k8s-app: kubernetes-dashboard    kubernetes.io/cluster-service: "true"    addonmanager.kubernetes.io/mode: Reconcilespec:  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.cn-hangzhou.aliyuncs.com/google_containers/kubernetes-dashboard-amd64:v1.7.1        resources:          limits:            cpu: 100m            memory: 300Mi          requests:            cpu: 100m            memory: 100Mi        ports:        - containerPort: 9090          protocol: TCP        livenessProbe:          httpGet:            scheme: HTTP            path: /            port: 9090          initialDelaySeconds: 30          timeoutSeconds: 30      tolerations:      - key: "CriticalAddonsOnly"        operator: "Exists"
[root@k8s-master dashboard]# cat dashboard-rbac.yaml apiVersion: v1kind: ServiceAccountmetadata:  labels:    k8s-app: kubernetes-dashboard    addonmanager.kubernetes.io/mode: Reconcile  name: kubernetes-dashboard  namespace: kube-system---kind: ClusterRoleBindingapiVersion: rbac.authorization.k8s.io/v1beta1metadata:  name: kubernetes-dashboard-minimal  namespace: kube-system  labels:    k8s-app: kubernetes-dashboard    addonmanager.kubernetes.io/mode: ReconcileroleRef:  apiGroup: rbac.authorization.k8s.io  kind: ClusterRole  name: cluster-adminsubjects:- kind: ServiceAccount  name: kubernetes-dashboard  namespace: kube-system
[root@k8s-master dashboard]# cat dashboard-service.yaml apiVersion: v1kind: Servicemetadata:  name: kubernetes-dashboard  namespace: kube-system  labels:    k8s-app: kubernetes-dashboard    kubernetes.io/cluster-service: "true"    addonmanager.kubernetes.io/mode: Reconcilespec:  type: NodePort  selector:    k8s-app: kubernetes-dashboard  ports:  - port: 80    targetPort: 9090

#####可以在浏览器输入其中一个节点和端口访问

 

转载于:https://www.cnblogs.com/shanhua-fu/p/10948603.html

你可能感兴趣的文章
form提交时应注意“&”符号
查看>>
oracle 常用select sql语句
查看>>
正则表达式
查看>>
python的安装和配置以及pythonIDE之Ulipad的安装配置基本操作
查看>>
Class.forName()用法详解
查看>>
编程中的一些概念
查看>>
Access中的数据类型和字段属性
查看>>
第五章:输入输出(IO)管理
查看>>
转换流--OutputStreamWriter类与InputStreamReader类
查看>>
自定义设置Ext.grid.gridPanel样式
查看>>
VBA实现表单自动编号
查看>>
[leetcode]416. Partition Equal Subset Sum 平分集合
查看>>
Linux Shell test关键字
查看>>
js foreach、map函数
查看>>
iOS开发如何判断字符串是否是整数,浮点数,纯数字
查看>>
linux常用命令:tail 命令
查看>>
java流的操作
查看>>
python安装后无法用cmd命令pip 装包
查看>>
Tomcat 搭配 Nginx 还是 Apache 呢?
查看>>
解决 VUE 微信 IOS 路由跳转问题
查看>>