当前位置:   article > 正文

redis-exporter监控部署(k8s内)tensuns专用_tensuns监控

tensuns监控

reidis-exporter服务需要用到configmap、service、deployment服务

创建存放yaml目录

mkdir /opt/redis-exporter && cd /opt/redis-exporter

编辑yaml配置文件

vi configmap.yaml

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: redis-conf
  5. namespace: monitor
  6. labels:
  7. app: redis-exporter
  8. data:
  9. redis_passwd.json: |- #填写各redis节点地址端口和密码
  10. {
  11. "redis://10.1.60.17:6379":"12345678",
  12. "redis://10.1.60.18:6379":"12345678",
  13. "redis://10.1.60.19:6379":"12345678"
  14. }

vi deployment.yaml

  1. kind: Deployment
  2. apiVersion: apps/v1
  3. metadata:
  4. labels:
  5. app: redis-exporter
  6. name: redis-exporter
  7. namespace: monitor
  8. spec:
  9. replicas: 1
  10. revisionHistoryLimit: 10
  11. selector:
  12. matchLabels:
  13. app: redis-exporter
  14. template:
  15. metadata:
  16. labels:
  17. app: redis-exporter
  18. spec:
  19. containers:
  20. - name: redis-exporter
  21. image: oliver006/redis_exporter
  22. imagePullPolicy: IfNotPresent
  23. args:
  24. - --redis.password-file=/redis_passwd.json
  25. volumeMounts:
  26. - mountPath: /etc/localtime
  27. name: tz-config
  28. - mountPath: /redis_passwd.json
  29. name: redis-conf-volume
  30. subPath: redis_passwd.json #使用subPath方式挂载配置文件
  31. ports:
  32. - containerPort: 9121
  33. protocol: TCP
  34. volumes:
  35. - name: tz-config #挂载时间配置,与宿主机配置时间同步
  36. hostPath:
  37. path: /usr/share/zoneinfo/PRC
  38. - name: redis-conf-volume #通过configmap挂载prometheus配置
  39. configMap:
  40. name: redis-conf

vi service.yaml

  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. labels:
  5. app: redis-exporter
  6. name: redis-exporter
  7. namespace: monitor
  8. spec:
  9. type: NodePort
  10. ports:
  11. - name: http
  12. port: 9121
  13. targetPort: 9121
  14. nodePort: 30012
  15. selector:
  16. app: redis-exporter

创建各yaml服务

kubectl apply -f configmap.yaml

kubectl apply -f deployment.yaml

kubectl apply -f service.yaml

查看redis-exporter pod是否正常运行

kubectl get pod -n monitor

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/624764
推荐阅读
相关标签
  

闽ICP备14008679号