helm安装prometheus+grafana,监控nginx

helm安装prometheus+grafana,监控nginx

Get Repo Info

helm repo add grafana https://grafana.github.io/helm-charts
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

Installing the Chart

helm install grafana -n monitor grafana/grafana
helm install prometheus -n monitor prometheus-community/prometheus

一些修改

We need to visit the UI page to see the effect, so we expose the ports of prometheus-altermanager, prometheus, and granfana. And made ingress for grafana (although it was not used much).
我们应该修改svc的type为NodePort, 接下来是grafana的ingress文件

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: grafana
  namespace: monitor
spec:
  tls:
    - hosts:
      - grafana.digiits.xzf
  rules:
  - host: grafana.digiits.xzf
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: grafana
            port:
              number: 80

k apply -f ingress.yaml

get user/password from secret

xzfa@xiongzfa:~/workfiles/yaml/monitor$ k get secrets -n monitor 
NAME                                        TYPE                                  DATA   AGE
grafana                                     Opaque                                3      10d

xzfa@xiongzfa:~/workfiles/yaml/monitor$ k edit  secrets -n monitor grafana

base64 user/password

配置nginx接入prometheus

nginx需要把自己的信息给暴露出来,需要再default.conf文件中进行配置,因为测试需要经常修改,因此我只是做了一个pvc把配置文件挂载出来。之后会用configmap的方式挂载配置文件。

因为关于vue的配置在之前的部署在部署文档中写过,这里只是做了一个修改,因此ingress、svc、vue的挂载就不再多说。下面只是对deployment的一些修改、以及nginx配置文件的挂载


apiVersion: v1
kind: PersistentVolume
metadata:
 name: nginx
spec:
 capacity:
   storage: 100m
 volumeMode: Filesystem
 accessModes:
 - ReadWriteMany
 hostPath:
   path: "/mnt/nginx/"
   type: DirectoryOrCreate
 persistentVolumeReclaimPolicy: Delete
 storageClassName: local-path

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
 name: nginx
spec:
 accessModes:
   - ReadWriteMany
 volumeMode: Filesystem
 resources:
   requests:
     storage: 100m
 storageClassName: "local-path"

apiVersion: apps/v1
kind: Deployment
metadata:
 name</
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值