Skip to content

Commit 069fc09

Browse files
author
pptfz
committed
更新kube-prometheus-stack笔记
1 parent c243fab commit 069fc09

3 files changed

Lines changed: 435 additions & 8 deletions

File tree

docs/Linux/监控/prometheus/kube-prometheus-stack/kube-prometheus-stack安装.md

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ tar xf kube-prometheus-stack-79.7.1.tgz
6565

6666
### 编辑 `values.yaml`
6767

68+
- 配置ingress
69+
- 配置sc
6870

69-
70-
71-
72-
71+
- 配置其他项
7372

7473

7574

@@ -85,7 +84,7 @@ helm upgrade --install kube-prometheus-stack -n kube-prometheus-stack --create-n
8584

8685

8786

88-
87+
### 一个小插曲
8988

9089
安装完成后发现没有 `prometheus` pod
9190

@@ -120,7 +119,7 @@ ts=2025-12-03T02:04:33.649291967Z level=error caller=/workspace/pkg/operator/res
120119

121120

122121

123-
`values.yaml` 中,sc默认是 `gluster`
122+
`values.yaml` 中,sc默认是 `gluster` ,修改sc为当前集群可用的sc即可
124123

125124
```yaml
126125
prometheus:
@@ -144,3 +143,59 @@ prometheus:
144143
145144
146145
146+
### 报错
147+
148+
prometheus pod一直为 `Pending` 状态
149+
150+
```shell
151+
$ k get pod
152+
NAME READY STATUS RESTARTS AGE
153+
prometheus-kube-prometheus-stack-prometheus-0 0/2 Pending 0 2m21s
154+
```
155+
156+
157+
158+
159+
160+
发现是pvc一直 `pending`
161+
162+
```shell
163+
$ k get pvc
164+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
165+
prometheus-kube-prometheus-stack-prometheus-db-prometheus-kube-prometheus-stack-prometheus-0 Pending openebs-hostpath <unset> 13m
166+
```
167+
168+
169+
170+
`Events` 报错`failed to provision volume with StorageClass "openebs-hostpath": claim.Spec.Selector is not supported`
171+
172+
```shell
173+
Events:
174+
Type Reason Age From Message
175+
---- ------ ---- ---- -------
176+
Normal WaitForFirstConsumer 10m persistentvolume-controller waiting for first consumer to be created before binding
177+
Normal Provisioning 2m58s (x7 over 10m) openebs.io/local_openebs-localpv-provisioner-6fc86fd79-nlvlk_1c2e3965-f0a4-412c-9950-bfbe15b7e670 External provisioner is provisioning volume for claim "kube-prometheus-stack/prometheus-kube-prometheus-stack-prometheus-db-prometheus-kube-prometheus-stack-prometheus-0"
178+
Warning ProvisioningFailed 2m58s (x7 over 10m) openebs.io/local_openebs-localpv-provisioner-6fc86fd79-nlvlk_1c2e3965-f0a4-412c-9950-bfbe15b7e670 failed to provision volume with StorageClass "openebs-hostpath": claim.Spec.Selector is not supported
179+
```
180+
181+
182+
183+
184+
185+
解决方法是在 `prometheus` 配置持久化的 `volumeClaimTemplate` 下把 `selector: {}` 注释
186+
187+
```yaml
188+
storageSpec:
189+
## Using PersistentVolumeClaim
190+
##
191+
volumeClaimTemplate:
192+
spec:
193+
storageClassName: openebs-hostpath
194+
accessModes: ["ReadWriteOnce"]
195+
resources:
196+
requests:
197+
storage: 50Gi
198+
#selector: {} # 注释这一行
199+
```
200+
201+
![iShot_2026-01-29_21.13.39](https://raw.githubusercontent.com/pptfz/picgo-images/master/img/iShot_2026-01-29_21.13.39.png)

0 commit comments

Comments
 (0)