# Error in setting Prometheus datasource in Grafana on Kubernetes

**URL:** <https://community.grafana.com/t/error-in-setting-prometheus-datasource-in-grafana-on-kubernetes/34390>\
**Category:** Grafana\
**Created:** [July 29, 2020, 11:15pm UTC](https://community.grafana.com/t/error-in-setting-prometheus-datasource-in-grafana-on-kubernetes/34390 "2020-07-29T23:15:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sisuser1987](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@sisuser1987](https://community.grafana.com/u/sisuser1987)\
**Post date:** [July 29, 2020, 11:15pm UTC](https://community.grafana.com/t/error-in-setting-prometheus-datasource-in-grafana-on-kubernetes/34390/1 "2020-07-29T23:15:52Z")

</div>

I am setting up Grafana on Kubernetes with some custom dashboards and Prometheus as default data source.

All services are running behind Traefik. Prometheus is running at [https://myapp.dev/svc/prometheus/](https://myapp.dev/svc/prometheus/) and Grafana is running at [https://myapp.dev/svc/grafana/](https://myapp.dev/svc/grafana/)

I can login to both grafana(also able to see dashboards that were added to config) and prometheus, however when I test the Prometheus datasource, I see the following error in grafana logs:

[![enter image description here](https://i.stack.imgur.com/XCAuQ.png)](https://i.stack.imgur.com/XCAuQ.png)

```auto
lvl=eror msg="Data proxy error" logger=data-proxy-log userId=1 orgId=1 uname=xxx path=/api/datasources/proxy/1/api/v1/query remote_addr=192.168.64.1 referer=https://myapp.dev/svc/grafana/datasources/edit/1/ error="http: proxy error: dial tcp: lookup prometheus on 10.96.0.10:53: no such host"

```

**Grafana deployment**

```auto
kind: Deployment
apiVersion: apps/v1
metadata:
  namespace: default
  name: grafana-deployment
  labels:
    app: grafana
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
      - name: grafana
        image: grafana/grafana:latest
        ports:
        - containerPort: 3000
        volumeMounts:
          - mountPath: /etc/grafana/provisioning/datasources/
            name: datasource-volume
          - mountPath: /etc/grafana/provisioning/dashboards/
            name: dashboard-volume
          - mountPath: /var/lib/grafana
            name: grafana-storage
      volumes:
        - name: grafana-storage
          emptyDir: {}
        - configMap:
            defaultMode: 420
            name: grafana-datasource-cm
          name: datasource-volume
        - configMap:
            defaultMode: 420
            name: grafana-dashboard-cm
          name: dashboard-volume

```

**Configmap**

```auto
kind: ConfigMap
apiVersion: v1
metadata:
  name: grafana-datasource-cm
data:
  datasource.yml: |-
    apiVersion: 1
    datasources:
    - name: Prometheus
      type: prometheus
      orgId: 1
      access: proxy
      url: http://prometheus:9090/svc/prometheus/
      basicAuth: false

```

I am not sure on how to fix this error and test Prometheus datasource.
