云计算/大数据/区块链

kube-prometheus install

2021-01-16 18:26:25 阅读数 4795 收藏 0

## WARNING: kube-prometheus moved to [coreos/kube-prometheus](https://github.com/coreos/kube-prometheus)!

# https://sysdig.com/blog/kubernetes-monitoring-prometheus-operator-part3/
# https://github.com/coreos/kube-prometheus

# 1. package download 
wget http://10.245.254.93/linux/soft/docker/kubernetes/prometheus/kube-prometheus-0.1.0.tar.gz
tar zxpf kube-prometheus-0.1.0.tar.gz
cd kube-prometheus-0.1.0

# 2. 离线安装的情况下,manifests目录内的所有image需下载到本地registry,并修改yaml文件指向到本地
sed -i "s|quay.io/prometheus|ispcdocker.com/coreos|g" manifests/*yaml
sed -i "s|quay.io/coreos|ispcdocker.com/coreos|g" manifests/*yaml
sed -i "s|k8s.gcr.io|ispcdocker.com/coreos|g" manifests/*yaml
sed -i "s|grafana/grafana:6.0.1|ispcdocker.com/coreos/grafana:6.1.6|g" manifests/*yaml

# 3. manifests目录下yaml文件太多,使用默认方式,没法完全按照优先顺序执行。 虽然部分文件名被官方改成了数字0开头,但效果不佳。 在先后顺序错乱的情况下,只会没玩没了的报错:ServiceMonitor找不到。所以,新增一个子目录,将数字0开头的yaml文件单独存放,并先执行。
mkdir manifests/first
mv manifests/0*yaml manifests/first
kubectl create -f manifests/first/
kubectl create -f manifests/

# 4. 查询状态
# kubectl -n monitoring top pods
# kubectl -n monitoring get all
# kubectl -n monitoring get pod
# kubectl get customresourcedefinitions
# kubectl -n monitoring get svc
# kubectl -n monitoring get endpoints
# kubectl -n monitoring get servicemonitors