docker pull prom/prometheus:v2.10.0
kubectl label nodes <管理节点Hostname> masterselector=dls-master-node --overwrite=true
kubectl apply -f prometheus.yaml
回显如下表示启动成功。
[root@centos check_env]# kubectl apply -f promethues.yaml clusterrole.rbac.authorization.k8s.io/prometheus created serviceaccount/prometheus created clusterrolebinding.rbac.authorization.k8s.io/prometheus created service/prometheus created deployment.apps/prometheus created configmap/prometheus-config created
[root@centos check_env]# kubectl get pods --all-namespaces | grep prometheus kube-system prometheus-58c69548b4-rhxsc 1/1 Running 0 6d14h
在prometheus.yaml文件中找到nodePort字段,该字段的值为Prometheus服务的端口号,默认为30003。