Prometheus unable to scrap Traefik

I have Traefik deployed with following config

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> traefik.toml: |
## static configuration
[global]
checkNewVersion = true
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
[providers]
[providers.kubernetesCRD]
[providers.file]
directory = "/etc/traefik/providers/"
watch = true
[providers.kubernetesIngress]
ingressClass = "traefik-cert-manager"
[log]
level = "INFO"
[accessLog]
[api]
insecure = true
dashboard = true
debug = true
[metrics]
[metrics.prometheus]
buckets = [0.1,0.3,1.2,5.0]
addEntryPointsLabels = true
addServicesLabels = true
</code>
<code> traefik.toml: | ## static configuration [global] checkNewVersion = true [entryPoints] [entryPoints.web] address = ":80" [entryPoints.websecure] address = ":443" [providers] [providers.kubernetesCRD] [providers.file] directory = "/etc/traefik/providers/" watch = true [providers.kubernetesIngress] ingressClass = "traefik-cert-manager" [log] level = "INFO" [accessLog] [api] insecure = true dashboard = true debug = true [metrics] [metrics.prometheus] buckets = [0.1,0.3,1.2,5.0] addEntryPointsLabels = true addServicesLabels = true </code>
  traefik.toml: |
    ## static configuration
    [global]
      checkNewVersion = true

    [entryPoints]
      [entryPoints.web]
        address = ":80"
      [entryPoints.websecure]
        address = ":443"

    [providers]
      [providers.kubernetesCRD]
      [providers.file]
        directory = "/etc/traefik/providers/"
        watch = true
      [providers.kubernetesIngress]
        ingressClass = "traefik-cert-manager"

    [log]
      level = "INFO"

    [accessLog]

    [api]
      insecure = true
      dashboard = true
      debug = true

    [metrics]
      [metrics.prometheus]
        buckets = [0.1,0.3,1.2,5.0]
        addEntryPointsLabels = true
        addServicesLabels = true

and Deployment Manifest

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: traefik
namespace: kube-system
labels:
app: traefik
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
spec:
selector:
matchLabels:
app: traefik
minReadySeconds: 5
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
template:
metadata:
labels:
app: traefik
spec:
serviceAccountName: traefik-ingress-controller
terminationGracePeriodSeconds: 30
hostNetwork: true
containers:
- name: traefik
image: traefik:2.9.6
ports:
- name: web
containerPort: 80
- name: websecure
containerPort: 443
- name: internal
containerPort: 4080
- name: internalsecure
containerPort: 4043
- name: admin
containerPort: 8080
readinessProbe:
failureThreshold: 1
httpGet:
path: /ping
port: 8080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
httpGet:
path: /ping
port: 8080
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 2
securityContext:
privileged: true
env:
- name: AWS_REGION
valueFrom:
configMapKeyRef:
name: aws-config
key: aws_region
- name: AWS_HOSTED_ZONE_ID
valueFrom:
configMapKeyRef:
name: aws-config
key: aws_hosted_zone_id
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: aws-secret
key: access_key
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: aws-secret
key: secret_key
volumeMounts:
- name: traefik-config
mountPath: /etc/traefik/traefik.toml
subPath: traefik.toml
- name: traefik-config
mountPath: /etc/traefik/providers/dynamic.toml
subPath: dynamic.toml
- name: traefik-storage
mountPath: /etc/traefik/storage/
volumes:
- name: traefik-config
configMap:
name: traefik-conf
- name: traefik-storage
hostPath:
path: /tmp/traefik
type: DirectoryOrCreate
</code>
<code> kind: DaemonSet apiVersion: apps/v1 metadata: name: traefik namespace: kube-system labels: app: traefik annotations: prometheus.io/scrape: "true" prometheus.io/port: "8080" spec: selector: matchLabels: app: traefik minReadySeconds: 5 updateStrategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 template: metadata: labels: app: traefik spec: serviceAccountName: traefik-ingress-controller terminationGracePeriodSeconds: 30 hostNetwork: true containers: - name: traefik image: traefik:2.9.6 ports: - name: web containerPort: 80 - name: websecure containerPort: 443 - name: internal containerPort: 4080 - name: internalsecure containerPort: 4043 - name: admin containerPort: 8080 readinessProbe: failureThreshold: 1 httpGet: path: /ping port: 8080 scheme: HTTP initialDelaySeconds: 10 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 2 livenessProbe: httpGet: path: /ping port: 8080 failureThreshold: 5 initialDelaySeconds: 10 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 2 securityContext: privileged: true env: - name: AWS_REGION valueFrom: configMapKeyRef: name: aws-config key: aws_region - name: AWS_HOSTED_ZONE_ID valueFrom: configMapKeyRef: name: aws-config key: aws_hosted_zone_id - name: AWS_ACCESS_KEY_ID valueFrom: secretKeyRef: name: aws-secret key: access_key - name: AWS_SECRET_ACCESS_KEY valueFrom: secretKeyRef: name: aws-secret key: secret_key volumeMounts: - name: traefik-config mountPath: /etc/traefik/traefik.toml subPath: traefik.toml - name: traefik-config mountPath: /etc/traefik/providers/dynamic.toml subPath: dynamic.toml - name: traefik-storage mountPath: /etc/traefik/storage/ volumes: - name: traefik-config configMap: name: traefik-conf - name: traefik-storage hostPath: path: /tmp/traefik type: DirectoryOrCreate </code>

kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: traefik
  namespace: kube-system
  labels:
    app: traefik
  annotations:
     prometheus.io/scrape: "true"
     prometheus.io/port: "8080"
spec:
  selector:
    matchLabels:
      app: traefik
  minReadySeconds: 5
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
  template:
    metadata:
      labels:
        app: traefik
    spec:
      serviceAccountName: traefik-ingress-controller
      terminationGracePeriodSeconds: 30
      hostNetwork: true
      containers:
      - name: traefik
        image: traefik:2.9.6
        ports:
          - name: web
            containerPort: 80
          - name: websecure
            containerPort: 443
          - name: internal
            containerPort: 4080
          - name: internalsecure
            containerPort: 4043
          - name: admin
            containerPort: 8080
        readinessProbe:
          failureThreshold: 1
          httpGet:
            path: /ping
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 2
        livenessProbe: 
          httpGet: 
            path: /ping 
            port: 8080 
          failureThreshold: 5 
          initialDelaySeconds: 10 
          periodSeconds: 10 
          successThreshold: 1 
          timeoutSeconds: 2 
        securityContext:
          privileged: true
        env:
          - name: AWS_REGION
            valueFrom:
              configMapKeyRef:
                name: aws-config
                key: aws_region
          - name: AWS_HOSTED_ZONE_ID
            valueFrom:
              configMapKeyRef:
                name: aws-config
                key: aws_hosted_zone_id
          - name: AWS_ACCESS_KEY_ID
            valueFrom:
              secretKeyRef:
                name: aws-secret
                key: access_key
          - name: AWS_SECRET_ACCESS_KEY
            valueFrom:
              secretKeyRef:
                name: aws-secret
                key: secret_key
        volumeMounts:
          - name: traefik-config
            mountPath: /etc/traefik/traefik.toml
            subPath: traefik.toml
          - name: traefik-config
            mountPath: /etc/traefik/providers/dynamic.toml
            subPath: dynamic.toml
          - name: traefik-storage
            mountPath: /etc/traefik/storage/
      volumes:
      - name: traefik-config
        configMap:
          name: traefik-conf
      - name: traefik-storage
        hostPath:
          path: /tmp/traefik
          type: DirectoryOrCreate

With this I can see metrics at /metrics for Traefik.

But unable to get it into Prometheus with following scrap job

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> - job_name: 'traefik'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_label_app]
action: keep
regex: traefik
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [__address__]
action: replace
target_label: __address__
regex: ([^:]+)(?::d+)?;(d+)
replacement: $1:9100
</code>
<code> - job_name: 'traefik' kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__meta_kubernetes_pod_label_app] action: keep regex: traefik - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] action: keep regex: true - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] action: replace target_label: __metrics_path__ regex: (.+) - source_labels: [__address__] action: replace target_label: __address__ regex: ([^:]+)(?::d+)?;(d+) replacement: $1:9100 </code>
      - job_name: 'traefik'
        kubernetes_sd_configs:
          - role: pod
        relabel_configs:
          - source_labels: [__meta_kubernetes_pod_label_app]
            action: keep
            regex: traefik
          - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
            action: keep
            regex: true
          - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
            action: replace
            target_label: __metrics_path__
            regex: (.+)
          - source_labels: [__address__]
            action: replace
            target_label: __address__
            regex: ([^:]+)(?::d+)?;(d+)
            replacement: $1:9100

What I am missing here ?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật