首页 > 其他分享 >@prometheus容器化使用

@prometheus容器化使用

时间:2022-10-09 21:07:38浏览次数:76  
标签:容器 ingress 01 prometheus master 使用 k8s root


文章目录

prometheus容器化

prometheus容器化,就是在kubernetes中安装

一、下载prometheus配置清单

1、查看集群状态

[root@k8s-master-01 ~]# kubectl get nodes 
NAME STATUS ROLES AGE VERSION
k8s-master-01 Ready control-plane,master 16d v1.20.5
k8s-node-01 Ready <none> 16d v1.20.5
k8s-node-02 Ready <none>

2、代码下载

[root@k8s-master-01 ~]# git clone -b release-0.7 --single-branch https://github.com/prometheus-operator/kube-prometheus.git




# 或者
[root@k8s-master-01 ~]# wget https://github.com/prometheus-operator/kube-prometheus/archive/refs/tags/v0.7.0.tar.gz

3、解压使用

[root@k8s-master-01 ~]# tar xf kube-prometheus-0.7.0.tar.gz

4、部署prometheus

[root@k8s-master-01 ~]# cd kube-prometheus-0.7.0/manifests/setup
[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests/setup]# kubectl apply -f ./




# 部署普罗米修斯
[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests/setup]# cd ..
[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests]# kubectl apply -f ./

5、创建ingress域名

[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests]# mkdir ingress
[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests]# cd ingress/
[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests/ingress]# cat ingress.yaml
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: prom-ingress
namespace: monitoring
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: linux.alert.com
http:
paths:
- backend:
serviceName: alertmanager-main
servicePort: 9093
path: /
- host: linux.grafana.com
http:
paths:
- backend:
serviceName: grafana
servicePort: 3000
path: /
- host: linux.prometheus.com
http:
paths:
- backend:
serviceName: prometheus-k8s
servicePort: 9090
path: /






# 启动
[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests/ingress]# kubectl apply -f ingress.yaml

6、查看映射到本机的端口

[root@k8s-master-01 ~/kube-prometheus-0.7.0/manifests/ingress]# kubectl get svc -n ingress-nginx 
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller NodePort 10.108.202.150 <none> 80:31197/TCP,443:30826/TCP 12d
ingress-nginx-controller-admission ClusterIP 10.97.217.170 <none> 443/TCP 12d

7、配置本地的host解析

192.168.15.31 linux.alert.com linux.grafana.com linux.prometheus.com

8、访问测试

linux.alert.com:31197
linux.grafana.com:31197
linux.prometheus.com:31197

@prometheus容器化使用_linux

@prometheus容器化使用_kubernetes_02

@prometheus容器化使用_grafana_03

二、查看grafana

1、登录使用grafana

@prometheus容器化使用_linux_04

2、检查测试

@prometheus容器化使用_linux_05


@prometheus容器化使用_prometheus_06

@prometheus容器化使用_linux_07


标签:容器,ingress,01,prometheus,master,使用,k8s,root
From: https://blog.51cto.com/u_15166421/5741543

相关文章