ubuntu下prometheus部署part2

韵味老鸟 2024-07-03 01:59:50

ubuntu下prometheus部署 part2

docker network create monitor

#执行docker-compose

docker compose up -d

指定文件

cd /data/monitor/dockerConf

docker compose -f docker_prometheus.yaml up -d

#查看服务

docker-compose ps

#ui访问

http://192.168.10.14:9090/

账号:admin

密码:meng@2022

####prometheus 联邦集群 即k8s集群所在master节点

部署helm v3

# download helm packagewget https://get.helm.sh/helm-v3.10.3-linux-amd64.tar.gz# decompress packagetar -xzf helm-v3.10.3-linux-amd64.tar.gz# mv linux-amd64/helm /usr/bin/helm

##删除kubesphere自带的监控

kubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/alertmanager/ 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/devops/ 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/etcd/ 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/grafana/ 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/kube-state-metrics/ 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/node-exporter/ 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/upgrade/ 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/prometheus-rules-v1.16\+.yaml 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/prometheus-rules.yaml 2>/dev/nullkubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/prometheus 2>/dev/null# Uncomment this line if you don't have Prometheus managed by Prometheus Operator in other namespaces.kubectl -n kubesphere-system exec $(kubectl get pod -n kubesphere-system -l app=ks-installer -o jsonpath='{.items[0].metadata.name}') -- kubectl delete -f /kubesphere/kubesphere/prometheus/init/ 2>/dev/null# 删除prometheus使用的pvckubectl -n kubesphere-monitoring-system delete pvc `kubectl -n kubesphere-monitoring-system get pvc | grep -v VOLUME | awk '{print $1}' | tr '\n' ' '`# 删除deployment,prometheus-operator、notification-manager-operator、notification-manager-deploymentkubectl -n kubesphere-monitoring-system scale --replicas=0 deployment/notification-manager-deployment deployment/notification-manager-operator deployment/prometheus-operator

#登录kubesphere控制台检查自带监控是否已经停止

http://192.168.10.18:30880/

账号:admin

密码:Meng@2022

0 阅读:0