[关闭]
@zhangyy 2021-09-06T19:32:28.000000Z 字数 1377 阅读 159

helm v3 部署prometheus 与 grafana

kubernetes系列



一: k8s 的环境简介

  1. 系统: CentOS7.9x64
  2. k8s 的版本: k8s 1.18.20

image_1fdcbjog118la14d69gk1v595s5m.png-43.7kB

image_1fdcbj68n17aietg1s7710rpv19.png-69.8kB

二: helm 3.4.2 部署

  1. # helm3 下载地址
  2. https://github.com/helm/helm/releases
  3. # 下载后解压获取二进制文件即可使用
  4. tar -zxvf helm-v3.4.2-linux-amd64.tar.gz
  5. cd linux-amd64/
  6. mv helm /usr/bin/
  7. chmod +x /usr/bin/helm
  8. helm version

image_1fdcbnopojobi9k1ggm1h041jca13.png-152.3kB


三:添加promethues 的阿里云helm 仓库

  1. helm repo add aliyuncs https://apphub.aliyuncs.com
  2. helm repo list

image_1fdcbrfi8135f14or1fiegfstl21g.png-79.5kB

四:安装promtheus

  1. 建一个namespaces:
  2. kubectl create ns monitoring
  3. helm install prometheus aliyuncs/prometheus-operator \
  4. --set prometheus.service.type=NodePort \
  5. --set prometheus.service.nodePort=30090 \
  6. --namespace monitoring

image_1fdcbvj99iisd4q1il09d61i8i1t.png-184.9kB

  1. kubectl get pod -n monitoring

image_1fdcc05og1sj2vmbfv9jo0sl2a.png-137.5kB

  1. kubectl get svc -n monitoring

image_1fdcc2e0bfrm1fckhbr1c821bfo34.png-145.6kB

  1. 打开web
  2. http://192.168.100.11:30090

image_1fdcc41tv1abd1kc21n653o17bm3h.png-318.3kB

image_1fdcc5qg61nhhef21q1s12112k03u.png-437.5kB

五: 关于内置grafana 的升级与端口暴露:

  1. kubectl get pod -n monitoring

image_1fdh036v421lgo2m8t14aif1e9.png-40.1kB

  1. kubeclt get deploy -n monitoring

image_1fdh05tbf1df71itr96j1f5mam3m.png-21kB

  1. kubectl edit deploy prometheus-grafana -n monitoring
  2. ---
  3. grafana的镜像调整为最新版本:
  4. image: grafana/grafana6.5.2
  5. 改为 image: grafana/grafana
  6. ---

image_1fdh094ln1lbi9611it7deu4bb13.png-13.3kB

  1. 会从新初始化grafana pod

image_1fdh0cpv8i1212p6124q1t3j1prc1g.png-42.4kB

image_1fdh0f048top59d120p177vl831t.png-43.6kB

image_1fdh0fknm1qgot6nfm94431usf2a.png-37.5kB

  1. 关于grafana svc 的端口暴露
  2. kubectl get svc -n monitoring
  3. kubectl edit svc prometheus-grafana -n monitoring

image_1fdh328ttir4b8s7m6qbt12hd2n.png-45.3kB

image_1fdh32o2r148eb3m1j8a1ok7u3a34.png-35.6kB

  1. kubectl edit svc prometheus-grafana -n monitoring
  2. type: ClusterIP 改为:
  3. type: NodePort

image_1fdh33c1a19c21hrg1hglm2h15dr3h.png-21kB

  1. kubectl get svc -n monitoring

image_1fdhaeu2lk48kg140851419on3u.png-45.5kB

image_1fdhahdaf1nj38071qhg3utvr44b.png-147.3kB

  1. 这个地方的用户名密码:
  2. kubectl get secret -n monitoring

image_1fdhaj9ka1a3f97a1n34dii314o.png-67.6kB

  1. kubectl edit secret prometheus-grafana -n monitoring
  2. ---
  3. admin-password: cHJvbS1vcGVyYXRvcg==
  4. admin-user: YWRtaW4=
  5. ---
  6. base64 位的转码:
  7. echo -n YWRtaW4= | base64 --decode
  8. echo -n cHJvbS1vcGVyYXRvcg== | base64 --decode

image_1fdhapakt1olf19deicf1oo612pt55.png-40.5kB

image_1fdhatp1g1kcr1ek977m1q851j4b5i.png-25.2kB

  1. 用户名:admin
  2. 密码: prom-operator

image_1fdhc665s1uhq1ih31u2e10se17qk6p.png-114.5kB

image_1fdhb03ve1k641l9e1bd01muj176r5v.png-101.4kB

image_1fdhb0rpv1ujurk5pju174c1a2p6c.png-121.2kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注