跳到主要内容

(4)部署kube-prometheus

安装官方地址:

https://github.com/prometheus-operator/kube-prometheus

wget https://github.com/prometheus-operator/kube-prometheus/archive/refs/tags/v0.14.0.tar.gz

tar -zxvf kube-prometheus-0.14.0.tar.gz

部署

# Create the namespace and CRDs, and then wait for them to be available before creating the remaining resources
# Note that due to some CRD size we are using kubectl server-side apply feature which is generally available since kubernetes 1.22.
# If you are using previous kubernetes versions this feature may not be available and you would need to use kubectl create instead.
kubectl apply --server-side -f manifests/setup
kubectl wait \
--for condition=Established \
--all CustomResourceDefinition \
--namespace=monitoring
kubectl apply -f manifests/

卸载

kubectl delete --ignore-not-found=true -f manifests/ -f manifests/setup

有俩个镜像需要手动拉下

swr.cn-north-4.myhuaweicloud.com/ddn-k8s/

docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.13.0

然后改名

docker tag <镜像 ID> registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.13.0

kubectl wait \
--for condition=Established \
--all CustomResourceDefinition \
--namespace=monitoring
kubectl apply -f manifests/

docker tag myapp:latest myapp:v1