原网址:https://www.jianshu.com/p/41a262b875f3

git拉取kube-prometheus.git

 git clone -b release-0.10 https://github.com/prometheus-operator/kube-prometheus.git

cd kube-prometheus/manifests

sed -i "s#quay.io/prometheus/#registry.cn-hangzhou.aliyuncs.com/chenby/#g" *.yaml
sed -i "s#quay.io/brancz/#registry.cn-hangzhou.aliyuncs.com/chenby/#g" *.yaml
sed -i "s#k8s.gcr.io/prometheus-adapter/#registry.cn-hangzhou.aliyuncs.com/chenby/#g" *.yaml
sed -i "s#quay.io/prometheus-operator/#registry.cn-hangzhou.aliyuncs.com/chenby/#g" *.yaml
sed -i "s#k8s.gcr.io/kube-state-metrics/#registry.cn-hangzhou.aliyuncs.com/chenby/#g" *.yaml

(grafana)修改svc为NodePort

sed -i  "/ports:/i\  type: NodePort" grafana-service.yaml
sed -i  "/targetPort: http/i\    nodePort: 31100" grafana-service.yaml

(prometheus)修改svc为NodePort

sed -i  "/ports:/i\  type: NodePort" prometheus-service.yaml
sed -i  "/targetPort: web/i\    nodePort: 31200" prometheus-service.yaml
sed -i  "/targetPort: reloader-web/i\    nodePort: 31300" prometheus-service.yaml

(alertmanager)修改svc为NodePort

sed -i  "/ports:/i\  type: NodePort" alertmanager-service.yaml 
sed -i  "/targetPort: web/i\    nodePort: 31400" alertmanager-service.yaml 
sed -i  "/targetPort: reloader-web/i\    nodePort: 31500" alertmanager-service.yaml 

执行部署

kubectl create -f /root/kube-prometheus/manifests/setup
kubectl create -f /root/kube-prometheus/manifests/
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐