Code Monkey home page Code Monkey logo

Comments (3)

camilb avatar camilb commented on June 2, 2024

Hi @btfo, can you please check the prometheus logs and make sure you don't have any error similar to this:

level=error ts=2018-01-22T15:42:34.436552996Z caller=main.go:211 component=k8s_client_runtime err="github.com/prometheus/prometheus/discovery/kubernetes/kubernetes.go:178: Failed to list *v1.Service: services is forbidden: User \"system:serviceaccount:monitoring:prometheus-k8s\" cannot list services in the namespace \"nginx-ingress\""

I think that by default RBAC isn't configured to allow listing services on other namespaces than default, kube-system and monitoring

I'm using a different method to monitor the nginx-ingress by setting enable-vts-status: "true" in ingress-nginx configmap Ref: here and I can share it if the RBAC isn't the issue.

from prometheus-kubernetes.

 avatar commented on June 2, 2024

Hi @btfo, can you please check the prometheus logs and make sure you don't have any error similar to this:

I've checked the logs of the prometheus pod and was unable to find anything relevant

I'm using a different method to monitor the nginx-ingress by setting <...>

Please do share!

from prometheus-kubernetes.

camilb avatar camilb commented on June 2, 2024

@btfo Here it is:

apiVersion: v1
data:
  enable-vts-status: "true"
  use-proxy-protocol: "true"
kind: ConfigMap
metadata:
  labels:
    k8s-addon: ingress-nginx.addons.k8s.io
  name: ingress-nginx
  namespace: nginx-ingress
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    k8s-addon: ingress-nginx.addons.k8s.io
    k8s-app: nginx-ingress
  name: ingress-nginx
  namespace: nginx-ingress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ingress-nginx
      k8s-addon: ingress-nginx.addons.k8s.io
      k8s-app: nginx-ingress
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: ingress-nginx
        k8s-addon: ingress-nginx.addons.k8s.io
        k8s-app: nginx-ingress
    spec:
      containers:
      - args:
        - /nginx-ingress-controller
        - --default-backend-service=$(POD_NAMESPACE)/nginx-default-backend
        - --configmap=$(POD_NAMESPACE)/ingress-nginx
        - --publish-service=$(POD_NAMESPACE)/ingress-nginx
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 10254
            scheme: HTTP
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        name: ingress-nginx
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 443
          name: https
          protocol: TCP
        - containerPort: 10254
          name: metrics
          protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: nginx-ingress
  name: nginx-ingress
  namespace: nginx-ingress
spec:
  ports:
  - name: metrics
    port: 10254
    protocol: TCP
    targetPort: metrics
  selector:
    k8s-app: nginx-ingress
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    k8s-app: nginx-ingress
  name: nginx-ingress-monitor
  namespace: monitoring
spec:
  endpoints:
  - interval: 10s
    port: metrics
  namespaceSelector:
    matchNames:
    - nginx-ingress
  selector:
    matchLabels:
      k8s-app: nginx-ingress

from prometheus-kubernetes.

Related Issues (20)

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.