Giter Club home page Giter Club logo

metrics-server-exporter's Introduction

Hi, I'm Thomas ๐Ÿ‘‹

metrics-server-exporter's People

Contributors

ghouscht avatar

Stargazers

 avatar

Watchers

 avatar  avatar

metrics-server-exporter's Issues

Prometheus should collect metrics from nodes and not Metrics Server

Project description:

Metrics Server collects resource metrics from Kubelets and exposes them in Kubernetes apiserver through Metrics API for use by Horizontal Pod Autoscaler and Vertical Pod Autoscaler.

But why not use these metrics to create alerts with alertmanager or to visualize resource usage with grafana?

is based on Metrics Server description but skips the next paragraph:

Metrics Server is not meant for non-autoscaling purposes. For example, don't use it to forward metrics to monitoring solutions, or as a source of monitoring solution metrics.

Kubelets in version 1.18+ have endpoint /metrics/resource which exposes same resource usage metrics as exposed by Metrics Server, but with improvement of being cumulative metrics instead of average load from last 15s. This means that you can collect them at higher resolution and calculate more accurate usage.

How to expose to NodePort service

I'm trying to expose to NodePort, so I can scrape outside k8s cluster, I try this service but NodePort url not working

apiVersion: v1
kind: Service
metadata:
name: metrics-server-exporter
labels:
app: metrics-server-exporter
spec:
type: NodePort
ports:

  • port: 80
    protocol: TCP
    targetPort: 8080
    nodePort: 31003
    selector:
    app: metrics-server-exporter

Access from external computer with the loadbalancer (ClusterIP)

Good morning

I did deploy the node-exporter inside the AKS Cluster with the Cluster IP configuration for my load balancer.
If I test from another pod, the result is ok, example:

curl http://metrics-server-exporter.kube-system.svc.cluster.local:8080/metrics

HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.

TYPE go_gc_duration_seconds summary

go_gc_duration_seconds{quantile="0"} 8.279e-06
go_gc_duration_seconds{quantile="0.25"} 1.005e-05
go_gc_duration_seconds{quantile="0.5"} 3.6797e-05
go_gc_duration_seconds{quantile="0.75"} 7.3091e-05
go_gc_duration_seconds{quantile="1"} 0.000105625

But, I I test from my computer with curl command, I receveid 404

(I change URI for metrics-k8s in backend conf for create the isolation)

curl -v http://jd-stg-k8s.aws.acesso.intra/metrics-k8s

  • Trying 10.190.11.63:80...
  • Connected to jd-stg-k8s.aws.acesso.intra (10.190.11.63) port 80 (#0)

GET /metrics-k8s HTTP/1.1
Host: jd-stg-k8s.aws.acesso.intra
User-Agent: curl/7.74.0
Accept: /

  • Mark bundle as not supporting multiuse
    < HTTP/1.1 404 Not Found
    < Content-Type: text/plain; charset=utf-8
    < Content-Length: 19
    < Connection: keep-alive
    < X-Content-Type-Options: nosniff
    < Date: Tue, 06 Apr 2021 13:30:37 GMT
    < X-Kong-Upstream-Latency: 2
    < X-Kong-Proxy-Latency: 0
    < Via: kong/2.2.2
    <
    404 page not found
  • Connection #0 to host jd-stg-k8s.aws.acesso.intra left intact

=== My yaml

apiVersion: v1
kind: List
items:

  • apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: metrics-server-exporter
    namespace: kube-system
    labels:
    app: metrics-server-exporter
    spec:
    replicas: 1
    strategy:
    type: RollingUpdate
    rollingUpdate:
    maxSurge: 2
    maxUnavailable: 0
    selector:
    matchLabels:
    app: metrics-server-exporter
    template:
    metadata:
    labels:
    app: metrics-server-exporter
    annotations:
    prometheus.io/path: "/metrics"
    prometheus.io/port: "8080"
    prometheus.io/scheme: "http"
    prometheus.io/scrape: "true"
    spec:
    containers:
    - name: metrics-server-exporter
    image: ghouscht/metrics-server-exporter:0.0.1
    imagePullPolicy: Always
    ports:
    - containerPort: 8080
    serviceAccountName: metrics-server-exporter
    dnsPolicy: ClusterFirst
    restartPolicy: Always
    terminationGracePeriodSeconds: 30
  • kind: Service
    apiVersion: v1
    metadata:
    name: metrics-server-exporter
    namespace: kube-system
    annotations:
    spec:
    selector:
    app: metrics-server-exporter
    ports:
    - name: mainport
    port: 8080
    protocol: TCP
    targetPort: 8080
    type: ClusterIP
  • apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    name: metrics-server-exporter
    namespace: kube-system
    annotations:
    kubernetes.io/ingress.class: kong
    konghq.com/strip-path: "true"
    spec:
    rules:
    - host: jd-stg-k8s.aws.acesso.intra
    http:
    paths:
    - path: /metrics-k8s
    backend:
    serviceName: metrics-server-exporter
    servicePort: 8080
  • kind: ServiceAccount
    apiVersion: v1
    metadata:
    name: metrics-server-exporter
    namespace: kube-system
  • kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: metrics-server-exporter
    rules:
    • apiGroups:
      • metrics.k8s.io
        resources:
        • nodes
        • pods
          verbs:
        • list
        • get
    • apiGroups:
      • ""
        resources:
        • nodes
          verbs:
        • list
        • get
  • kind: ClusterRoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: metrics-server-exporter
    roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: metrics-server-exporter
    subjects:
    - kind: ServiceAccount
    name: metrics-server-exporter
    namespace: kube-system

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.