Prometheus operator 使用 additionalScrapeConfigs 之后创建失败

详情:在使用 additionalScrapeConfigs 字段之后更新 yaml 文件一直没有创建 pod 以及 StatefulSet。yaml 文件如下

apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  name: inst
  namespace: monitoring
spec:
  serviceAccountName: prometheus
  serviceMonitorSelector:
    matchLabels:
      team: frontend
  ruleSelector:
    matchLabels:
      role: alert-rules
      prometheus: example
  alerting:
    alertmanagers:
    - name: alertmanager-example
      namespace: monitoring
      port: web
  additionalScrapeConfigs:
    name: additional-scrape-configs
    key: prometheus-additional.yaml
  resources:
    requests:
      memory: 400Mi

随后查看 prometheus operator 发现错误日志

level=error ts=2021-01-05T14:43:55.626242695Z caller=klog.go:96 component=k8s_client_runtime func=ErrorDepth msg="Sync \"monitoring/inst\" failed: creating config failed: generating config failed: unmarshalling additional scrape configs failed: yaml: unmarshal errors:\n  line 1: cannot unmarshal !!map into []yaml.MapSlice"

确认问题之后发现,是我的 prometheus-additional.yaml 最上方多写了一行…很尴尬。
删除之后重新创建 Secret 修复。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值