29.Kubernetes(十一)-----监控(helm可视化 web图形)
作者:互联网
helm可视化 web图形
一、镜像
1.下载镜像
[root@foundation15 ~]# lftp 172.25.254.250
lftp 172.25.254.250:~> cd pub/docs/k8s/
lftp 172.25.254.250:/pub/docs/k8s> get kubeapps-2.3.3.tar
529802752 bytes transferred in 32 seconds (15.89 MiB/s)
lftp 172.25.254.250:/pub/docs/k8s> exit
[root@foundation15 ~]# ls
3.0.115 manifests rht-ks-post.log
compose metallb-v0.10.2.tar rht-ks-pre.log
daemon.json metallb.yaml root@172.25.15.1
deploy.yaml metrics-server.tar root@172.25.15.4
get-docker.sh nfs-provisioner-v4.0.2.tar stress.tar
ingress-nginx-v0.48.1.tar Pictures tls.crt
k8s-1.21.3.tar recommended.yaml tls.key
kubeapps-2.3.3.tar 'rhel6 lanmp.pdf' zabbix.api
kube-flannel.yml rhel-server-7.6-x86_64-dvd.iso
[root@foundation15 ~]# scp kubeapps-2.3.3.tar 172.25.15.1:
root@172.25.15.1's password:
kubeapps-2.3.3.tar 100% 505MB 81.6MB/s 00:06
[root@foundation15 ~]#
[root@server1 ~]# docker load -i kubeapps-2.3.3.tar
....
Loaded image: reg.westos.org/bitnami/nginx:1.21.1-debian-10-r4
....
Loaded image: reg.westos.org/bitnami/kubeapps-asset-syncer:2.3.3-scratch-r0
.....
Loaded image: reg.westos.org/bitnami/kubeapps-assetsvc:2.3.3-scratch-r0
......
Loaded image: reg.westos.org/bitnami/nginx:1.21.1-debian-10-r0
......
Loaded image: reg.westos.org/bitnami/postgresql:11.12.0-debian-10-r44
....
Loaded image: reg.westos.org/bitnami/kubeapps-dashboard:2.3.3-debian-10-r2
.....
Loaded image: reg.westos.org/bitnami/kubeapps-apprepository-controller:2.3.3-scratch-r0
....
Loaded image: reg.westos.org/bitnami/kubeapps-kubeops:2.3.3-scratch-r0
.....
Loaded image: reg.westos.org/bitnami/nginx-exporter:0.9.0-debian-10-r93
2.上传镜像到仓库
[root@server1 ~]# docker push reg.westos.org/bitnami/nginx:1.21.1-debian-10-r4
[root@server1 ~]# docker push reg.westos.org/bitnami/kubeapps-asset-syncer:2.3.3-scratch-r0
[root@server1 ~]# docker push reg.westos.org/bitnami/kubeapps-assetsvc:2.3.3-scratch-r0
[root@server1 ~]# docker push reg.westos.org/bitnami/nginx:1.21.1-debian-10-r0
[root@server1 ~]# docker push reg.westos.org/bitnami/postgresql:11.12.0-debian-10-r44
[root@server1 ~]# docker push reg.westos.org/bitnami/kubeapps-dashboard:2.3.3-debian-10-r2
[root@server1 ~]# docker push reg.westos.org/bitnami/kubeapps-apprepository-controller:2.3.3-scratch-r0
[root@server1 ~]# docker push reg.westos.org/bitnami/kubeapps-kubeops:2.3.3-scratch-r0
[root@server1 ~]# docker push reg.westos.org/bitnami/nginx-exporter:0.9.0-debian-10-r93
二、编写配置文件
[root@server4 helm]# helm search repo kubeapps
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/kubeapps 7.2.0 2.3.3 Kubeapps is a dashboard for your Kubernetes clu...
[root@server4 helm]# helm pull bitnami/kubeapps
[root@server4 helm]# ls
helm-push_0.9.0_linux_amd64.tar.gz mychart-0.2.0.tgz
kubeapps-7.2.0.tgz nfs-subdir-external-provisioner
metrics-server nfs-subdir-external-provisioner-4.0.13.tgz
metrics-server-5.9.2.tgz redis-cluster
mychart redis-cluster-6.3.2.tgz
mychart-0.1.0.tgz
[root@server4 helm]# tar zxf kubeapps-7.2.0.tgz
[root@server4 helm]# cd kubeapps/
[root@server4 kubeapps]# ls
Chart.lock Chart.yaml README.md values.schema.json
charts crds templates values.yaml
[root@server4 kubeapps]# vim values.yaml
11 imageRegistry: "reg.westos.org"
51 enabled: true
57 hostname: kubeapps.westos.org
[root@server4 kubeapps]# cd charts/
[root@server4 charts]# ls
common postgresql
[root@server4 charts]# cd postgresql/
[root@server4 postgresql]# ls
Chart.lock Chart.yaml files templates values.yaml
charts ci README.md values.schema.json
[root@server4 postgresql]# vim values.yaml
7 imageRegistry: reg.westos.org
三、安装部署
[root@server4 kubeapps]# ls
Chart.lock charts Chart.yaml crds README.md templates values.schema.json values.yaml
[root@server4 kubeapps]# kubectl create namespace kubeapps
namespace/kubeapps created
[root@server4 kubeapps]# helm install kubeapps . -n kubeapps
[root@server4 kubeapps]# kubectl -n kubeapps get pod
[root@server4 kubeapps]# kubectl -n kubeapps get svc
[root@server4 kubeapps]# kubectl -n kubeapps get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
kubeapps <none> kubeapps.westos.org 172.25.15.2 80 3m38s
[root@server4 kubeapps]# kubectl -n kubeapps describe ingress kubeapps
1.真机解析
[root@server4 kubeapps]# kubectl -n ingress-nginx get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer 10.99.121.194 172.25.15.10 80:30148/TCP,443:32730/TCP 8d
ingress-nginx-controller-admission ClusterIP 10.108.189.151 <none> 443/TCP 8d
[root@foundation15 ~]# vim /etc/hosts
[root@foundation15 ~]# tail -n1 /etc/hosts
172.25.15.10 www1.westos.org www2.westos.org kubeapps.westos.org
[root@foundation15 ~]#
2.添加用户,赋予管理权限
[root@server4 kubeapps]# kubectl create serviceaccount kubeapps-operator -n kubeapps #创建sa
[root@server4 kubeapps]# kubectl -n kubeapps get sa
serviceaccount/kubeapps-operator created
[root@server4 kubeapps]# kubectl create clusterrolebinding kubeapps-operator --clusterrole=cluster-admin --serviceaccount=kubeapps:kubeapps-operator
clusterrolebinding.rbac.authorization.k8s.io/kubeapps-operator created
[root@server4 kubeapps]# kubectl get clusterrolebindings.rbac.authorization.k8s.io kubeapps-operator
[root@server4 kubeapps]# kubectl get clusterrolebindings.rbac.authorization.k8s.io kubeapps-operator -o yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: "2021-08-06T02:52:47Z"
name: kubeapps-operator
resourceVersion: "576004"
uid: 70c5732e-e037-4516-a26e-b40e01d97311
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubeapps-operator
namespace: kubeapps
[root@server4 kubeapps]#
3.真机访问
http://kubeapps.westos.org
## 浏览器可能会存在问题
我安装了个360
[root@foundation15 ~]# rpm -ivh browser360-cn-stable-10.4.1015.1-1.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:browser360-cn-stable-10.4.1015.1-################################# [100%]
Created launcher on /home/kiosk/Desktop
4.访问成功
5.Token登陆
## 查看token
[root@server4 kubeapps]# kubectl -n kubeapps get secrets
NAME TYPE DATA AGE
default-token-txsz8 kubernetes.io/service-account-token 3 29m
kubeapps-internal-apprepository-controller-token-vdc25 kubernetes.io/service-account-token 3 29m
kubeapps-internal-kubeops-token-4x4sr kubernetes.io/service-account-token 3 29m
kubeapps-operator-token-tqxcb kubernetes.io/service-account-token 3 31s
kubeapps-postgresql Opaque 2 29m
sh.helm.release.v1.kubeapps.v1 helm.sh/release.v1 1 29m
[root@server4 kubeapps]# kubectl -n kubeapps describe secrets kubeapps-operator-token-tqxcb
四、图形操作
1.添加仓库
编写仓库解析
[root@server4 kubeapps]# kubectl -n kube-system edit cm coredns
configmap/coredns edited
添加
成功
2.图形创建mychart
搜索mychart
名称
命令查看
标签:web,Kubernetes,server4,29,kubeapps,westos,org,bitnami,root 来源: https://blog.csdn.net/qq_44060147/article/details/119419638