Not able add remote_write in Prometheus config for k8s monitoring

51 views
Skip to first unread message

Prashant Singh

unread,
Sep 18, 2023, 2:25:27 AM9/18/23
to Prometheus Users
Hello,

I am not able add remote_write detail in k8s prometheus config file. 
kubectl version: 1.27
error : 
Error from server (BadRequest): error when creating "config-map.yaml": ConfigMap in version "v1" cannot be handled as a ConfigMap: strict decoding error: unknown field "remote_write"

prometheus config file:
apiVersion: v1
kind: ConfigMap
metadata:
  name: prometheus-server-conf
  labels:
    name: prometheus-server-conf
  namespace: monitoring

remote_write:
   - url: "http://x.x.x.x:31000/api/prom/push"


Thanks,
prashant

Stuart Clark

unread,
Sep 18, 2023, 3:22:32 AM9/18/23
to Prashant Singh, Prometheus Users
Not really a Prometheus thing, but that isn't a valid ConfigMap. It is
expecting top level fields called "metatdata" and "data", with a
filename within the data section that then contains whatever data you
are wanting (which for Prometheus is a YAML config file).

--
Stuart Clark

Prashant Singh

unread,
Sep 18, 2023, 4:35:28 AM9/18/23
to Stuart Clark, Prashant Singh, Prometheus Users
Yes , got solution , below code is working for config and also working remote_write .

config file :
apiVersion: v1
kind: ConfigMap
metadata:
  name: prometheus-config
  namespace: monitoring
metadata:
    name: prometheus-server-conf
    namespace: monitoring
    labels:
        name: prometheus-server-conf 

thanks,
prashant 

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/762c7be3990926a7c2867148f68db2f0%40Jahingo.com.
Reply all
Reply to author
Forward
0 new messages