prometheus-operator / kube-prometheus

Use Prometheus to monitor Kubernetes and applications running on Kubernetes
https://prometheus-operator.dev/
Apache License 2.0
6.76k stars 1.93k forks source link

level=warn ts=2023-06-21T05:55:13.450305925Z caller=shipper.go:239 msg="reading meta file failed, will override it" err="failed to read /prometheus/thanos.shipper.json: open /prometheus/thanos.shipper.json: no such file or directory" #2144

Open huisebug opened 1 year ago

huisebug commented 1 year ago

This is the yaml I use:

apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  labels:
    app.kubernetes.io/component: prometheus
    app.kubernetes.io/instance: k8s
    app.kubernetes.io/name: prometheus
    app.kubernetes.io/part-of: kube-prometheus
    app.kubernetes.io/version: 2.44.0
  name: k8s
  namespace: monitoring
spec:
  alerting:
    alertmanagers:
    - apiVersion: v2
      name: alertmanager-main
      namespace: monitoring
      port: web
  enableFeatures: []
  externalLabels: {}
  image: quay.io/prometheus/prometheus:v2.44.0
  nodeSelector:
    kubernetes.io/os: linux
  podMetadata:
    labels:
      app.kubernetes.io/component: prometheus
      app.kubernetes.io/instance: k8s
      app.kubernetes.io/name: prometheus
      app.kubernetes.io/part-of: kube-prometheus
      app.kubernetes.io/version: 2.44.0
  podMonitorNamespaceSelector: {}
  podMonitorSelector: {}
  probeNamespaceSelector: {}
  probeSelector: {}
  replicas: 1
  resources:
    requests:
      memory: 400Mi
  ruleNamespaceSelector: {}
  ruleSelector: {}

  serviceAccountName: prometheus-k8s
  serviceMonitorNamespaceSelector: {}
  serviceMonitorSelector: {}
  version: 2.44.0
  logLevel: info
  volumes: 
  - name: localtime
    hostPath:
      path: /etc/localtime
  volumeMounts:
  - mountPath: "/etc/localtime"
    name: localtime
  retention: 10d

  storage:
    volumeClaimTemplate:
      metadata:
        annotations:
          volume.beta.kubernetes.io/storage-class: "nfs-storageclass"
      spec:
        storageClassName: nfs-storageclass
        accessModes: [ "ReadWriteMany" ]
        resources:
          requests:
            storage: 10Gi

  thanos:
    image: quay.io/thanos/thanos:v0.31.0
    objectStorageConfig:
      key: objectstorage.yaml
      name: thanos-objectstorage  
huisebug commented 1 year ago

After starting according to this configuration, the log prompt from thanos sidecar level=warn ts=2023-06-21T05:55:13.450305925Z caller=shipper.go:239 msg="reading meta file failed, will override it" err="failed to read /prometheus/thanos.shipper.json: open /prometheus/thanos.shipper.json: no such file or directory" I checked the /prometheus directory, and this file exists. After I gave 777 permissions to the persistent directory, the sidecar log did not prompt this error. Obviously this is a file permission problem. When the thanos.shipper.json file is generated, Does not take into account that sidecar containers are unreadable

jmtt89 commented 1 year ago

hi, does anyone know any fix or workaround for this?

houshym commented 11 months ago

I have the same issue