裸金属环境中部署prometheus

裸金属环境中部署prometheus

1、下载安装包

wget -c https://github.com/prometheus/prometheus/releases/download/v2.13.0/prometheus-2.13.0.linux-amd64.tar.gz
	%首先先去官网下载对应系统的版本,这里是2.13.0版本

2、安装

[root@test ~]# tar -xf prometheus-2.13.0.linux-amd64.tar.gz -C /usr/local/bin/	%解压到指定目录
[root@test ~]# cd /usr/local/bin
[root@test bin]# ls
prometheus-2.13.0.linux-amd64
[root@test bin]# cd prometheus-2.13.0.linux-amd64/
[root@test prometheus-2.13.0.linux-amd64]# ls
console_libraries  LICENSE  prometheus      promtool
consoles           NOTICE   prometheus.yml  tsdb
[root@test prometheus-2.13.0.linux-amd64]# ln -sv /usr/local/bin/prometheus-2.13.0.linux-amd64/ /usr/local/Prometheus	%制作软连接/usr/local/Prometheus’ -> ‘/usr/local/bin/prometheus-2.13.0.linux-amd64/[root@test prometheus-2.13.0.linux-amd64]# vim prometheus.yml %修改配置文件
	static_configs:
    - targets: ['172.25.77.10:9090']	%访问ip和端口

在这里插入图片描述

[root@test prometheus-2.13.0.linux-amd64]# ./prometheus &		%打入后台运行

在这里插入图片描述

3、网页查看

访问172.25.77.10:9090,可以看到成功进入普罗米修斯
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Kubernetes(K8s)部署Prometheus可以通过以下步骤完成: 1. 创建命名空间(可选):可以选择在K8s创建一个专门用于Prometheus的命名空间,以便更好地组织和管理资源。可以使用以下命令创建一个命名空间: ``` kubectl create namespace prometheus ``` 2. 创建配置文件:创建一个Prometheus的配置文件(例如prometheus.yaml),用于定义监控目标和规则。可以参考Prometheus的官方文档(https://prometheus.io/docs/prometheus/latest/configuration/configuration/)了解更多配置选项。 3. 创建ConfigMap:将配置文件作为ConfigMap对象添加到K8s集群,以便在部署使用。可以使用以下命令创建ConfigMap: ``` kubectl create configmap prometheus-config --namespace=prometheus --from-file=prometheus.yaml ``` 4. 创建服务和部署:创建一个Service和Deployment对象来部署Prometheus。Service用于将Prometheus暴露给其他服务,Deployment用于定义Pod的副本数量和其他设置。可以使用以下示例yaml文件创建Service和Deployment: ``` apiVersion: v1 kind: Service metadata: name: prometheus namespace: prometheus spec: ports: - name: http port: 9090 targetPort: 9090 selector: app: prometheus --- apiVersion: apps/v1 kind: Deployment metadata: name: prometheus namespace: prometheus spec: replicas: 1 selector: matchLabels: app: prometheus template: metadata: labels: app: prometheus spec: containers: - name: prometheus image: prom/prometheus ports: - containerPort: 9090 volumeMounts: - name: config-volume mountPath: /etc/prometheus/prometheus.yaml subPath: prometheus.yaml volumes: - name: config-volume configMap: name: prometheus-config ``` 可以将上述内容保存为prometheus.yaml文件,并使用以下命令进行部署: ``` kubectl apply -f prometheus.yaml ``` 5. 访问Prometheus:完成部署后,可以通过Service的Cluster IP和端口(默认为9090)来访问Prometheus的Web界面。可以使用以下命令获取Service的IP地址和端口: ``` kubectl get svc prometheus -n prometheus ``` 在浏览器访问`http://<cluster_ip>:<port>`即可进入Prometheus的Web界面。 这些是在Kubernetes部署Prometheus的基本步骤。你可以根据需要进行进一步的配置和定制化,例如添加监控目标、定义告警规则
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值