canonical / microk8s

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.

Home Page:https://microk8s.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to fetch etcd prometheus metrics with multi node microk8s cluster

developer1622 opened this issue · comments

Summary

I have created multi node microk8s cluster and etcd enabled in the cluster, however, I am not able to metrics on port 2379 and 12379, or any other port

What Should Happen Instead?

User should be able to fetch etcd Prometheus metrics

Reproduction Steps

Create 3 node cluster, one is control plane and other 2 worker nodes, enable etcd
And then I have Prometheus pod which has access to host resources, mainly control plane and also hostNetwork also true for this pod, here is the mounting that I am following, attached curl image, but it would be same for Prometheus also.

    - name: etcd-pki
      hostPath:
        path: /var/snap/microk8s/current/certs/
        type: Directory
  nodeName: microk8s-1-28-control01
  containers:
    - command:
        - sh
        - -c
        - sleep infinity
      image: curlimages/curl:latest
      volumeMounts:
        # - name: etcd-certs
        #   mountPath: /etc/etcd/certs
        - mountPath: /etc/etcd
          name: etcd-pki
      imagePullPolicy: Always
      name: curl
      securityContext:
        runAsUser: 0
        runAsGroup: 0
        capabilities:
          add:
            - NET_ADMIN

I have tried to build scrape config like below in Prometheus

            - job_name: etcd
              scrape_interval: 2m
              scrape_timeout: 59s
              metrics_path: /metrics
              scheme: https
              tls_config:
                insecure_skip_verify: true
                # ca_file: /etc/etcd/ca.crt, now it runs in insecure mode
                cert_file: /etc/etcd/server.crt
                key_file: /etc/etcd/server.key
              static_configs:
                - targets: ["127.0.0.1:12379"]

I have tried to use ss and netstat commands, I do not find 12379 or 2379 port. Thank you

Introspection Report

I am sorry, i am not allowed to copy this kind of data from the cluster

Can you suggest a fix?

I am not sure, like other distros, I should be able to fetch etcd Prometheus metrics on designated port

Are you interested in contributing with a fix?

I do not have skills much