nerdswords / yet-another-cloudwatch-exporter

Prometheus exporter for AWS CloudWatch - Discovers services through AWS tags, gets CloudWatch metrics data and provides them as Prometheus metrics with AWS tags as labels
Apache License 2.0
953 stars 328 forks source link

Config file syntax error complaining about 'missing apiVersion' #1455

Closed danilomattoscamossi closed 1 month ago

danilomattoscamossi commented 1 month ago

Hello,

I have deployed YACE into my Kubernetes Cluster, however it is complaining about 'missing apiVersion' in pod log.

{"caller":"config.go:534","err":"missing apiVersion","level":"warn","msg":"config file syntax error","ts":"2024-07-01T14:21:29.685150462Z","version":"v0.61.2"} {"caller":"config.go:536","level":"warn","msg":"Config file error(s) detected: Yace might not work as expected. Future versions of Yace might fail to run with an invalid config file.","ts":"2024-07-01T14:21:29.685170549Z","version":"v0.61.2"}

My Config Map already have the apiVersion attribute as shown below:

apiVersion: v1 kind: ConfigMap metadata: name: yace-config namespace: yace data: config.yml: |

As well the Deployment yaml file:

apiVersion: apps/v1 kind: Deployment metadata: name: yace namespace: yace

Can you help identify where it is missing the apiVersion attribute?

cristiangreco commented 1 month ago

Hi @danilomattoscamossi,

the yace config file needs and apiVersion: v1alpha1 field, like in this example https://github.com/nerdswords/yet-another-cloudwatch-exporter/blob/master/examples/ec2.yml

Please doublecheck the configmap you pasted above:

apiVersion: v1
kind: ConfigMap
metadata:
name: yace-config
namespace: yace
data:
config.yml: |

what is the actual content of config.yml?

danilomattoscamossi commented 1 month ago

Hi @cristiangreco, thanks.

Yes, this is my current yace config.

Then I tried your suggestion and got this issue:

"no matches for kind "ConfigMap" in version "v1alpha1""

Below this is how my config looks like:

yace_config
cristiangreco commented 1 month ago

The apiVersion field you changed belongs to the ConfigMap definition, so it's the wrong one. Overall it should look like:

apiVersion: v1
kind: ConfigMap
metadata:
  name: yace-config
  namespace: yace
data:
  config.yml: |
    apiVersion: v1alpha1
    discovery:
      ...
danilomattoscamossi commented 1 month ago

Thank you @cristiangreco, it worked.