使用自定义values.yaml安装kube-prometheus-stack无Alertmanager Pod
问题根因
你的配置存在两处不符合kube-prometheus-stack Chart规范的错误,导致资源渲染失败,AlertManager Pod无法创建:
additionalPrometheusRulesMap字段类型错误,该字段在Chart定义中为Map(字典)类型,你错误配置为了List(数组)类型,导致整个Chart模板渲染中断,所有关联资源都无法正常生成。- 配置中残留的HTML转义字符(
"、<)也会导致YAML语法校验失败,实际编写时需要替换为正常的标点符号。
修正后的完整custom_values.yaml配置
additionalPrometheusRulesMap: # 此处为自定义的Map键,可使用任意合法字符串命名 custom-prometheus-rules: groups: - name: custom_rules rules: - record: node_memory_MemFree_percent expr: 100 - (100 * node_memory_MemFree_bytes / node_memory_MemTotal_bytes) - name: alert_rules rules: - alert: InstanceDown expr: up == 0 for: 15s labels: severity: critical annotations: summary: "Instance [{{ $labels.instance }}] down" description: "[{{ $labels.instance }}] of job [{{ $labels.job }}] has been down for more than 1 minute." alertmanager: config: global: resolve_timeout: 5m route: group_by: ['alertname'] receiver: 'post-webhook' group_interval: 30s repeat_interval: 30s receivers: - name: 'post-webhook' webhook_configs: - url: "替换为你的实际回调地址"
验证方法
修改配置后,可先执行本地渲染命令验证配置合法性,无需直接部署到集群:helm template prometheus prometheus-community/kube-prometheus-stack -f custom_values.yaml
如果命令无报错输出,再执行安装命令即可正常生成AlertManager相关Pod。
内容的提问来源于stack exchange,提问作者klin
相关产品推荐
相关产品推荐

