Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nginx] help with setting up metrics collection with Prometheus #464

Closed
dannyk81 opened this issue Mar 17, 2017 · 2 comments · Fixed by #471
Closed

[nginx] help with setting up metrics collection with Prometheus #464

dannyk81 opened this issue Mar 17, 2017 · 2 comments · Fixed by #471

Comments

@dannyk81
Copy link

Version: 0.9.0-beta.3

I deployed nginx ingress controller (as a DaemonSet) and configued a customer ConfigMap with enable-vts-status: true

In the controller log, I can see the following message:

2017-03-17T21:18:44.557253546Z I0317 21:18:44.557029       7 metrics.go:34] changing prometheus collector from  to vts

But at this point I'm not sure how to proceed, how should the Controller be configured to provide a scrape target for Prometheus ? I understand that this is implemented internally, but I don't understand how to configure it.

Here's my DaemonSet yaml:

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  labels:
    name: nginx-ingress-lb
  name: nginx-ingress-lb
  namespace: kube-system
spec:
  selector:
    matchLabels:
      name: nginx-ingress-lb
  template:
    metadata:
      labels:
        name: nginx-ingress-lb
    spec:
      containers:
      - args:
        - /nginx-ingress-controller
        - --default-backend-service=$(POD_NAMESPACE)/default-http-backend
        - --udp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-lb-udp-cm
        - --tcp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-lb-tcp-cm
        - --configmap=$(POD_NAMESPACE)/nginx-ingress-lb-conf
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        image: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.3
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 10254
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        name: nginx-ingress-lb
        ports:
        - containerPort: 80
          hostPort: 80
          protocol: TCP
        - containerPort: 443
          hostPort: 443
          protocol: TCP
        - containerPort: 5353
          hostPort: 55353
          protocol: UDP
        - containerPort: 5353
          hostPort: 55353
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 10254
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources: {}
        terminationMessagePath: /dev/termination-log
      dnsPolicy: ClusterFirst
      nodeSelector:
        node_type: worker
      restartPolicy: Always
      securityContext: {}
      terminationGracePeriodSeconds: 60

and here's my ConfigMap:

apiVersion: v1
data:
  enable-vts-status: "true"
kind: ConfigMap
metadata:
  name: nginx-ingress-lb-conf
  namespace: kube-system
@aledbf
Copy link
Member

aledbf commented Mar 17, 2017

@dannyk81 the prometheus metrics are exposed in port 10254 and path /metrics

@dannyk81
Copy link
Author

Perfect! exactly what I was missing 👍 Thanks.

I added the following to my DaemonSet metadata and it works:

      annotations:
        prometheus.io/port: "10254"
        prometheus.io/scrape: "true"

Perhaps a quick note about this in the documentation ?

dannyk81 pushed a commit to dannyk81/ingress that referenced this issue Mar 20, 2017
Allow Prometheus automatic discovery of nginx metrics endpoint

Fixed kubernetes#464
dannyk81 pushed a commit to dannyk81/ingress that referenced this issue Mar 20, 2017
Allow Prometheus automatic discovery of nginx metrics endpoint

Fixed kubernetes#464
dannyk81 pushed a commit to dannyk81/ingress that referenced this issue Mar 20, 2017
* Adding Prometheus metrics scrape annotations

Allow Prometheus automatic discovery of nginx metrics endpoint

Fixed kubernetes#464

* Adding Prometheus metrics scrape annotations

Allow Prometheus automatic discovery of nginx metrics endpoint

Fixed kubernetes#464
dannyk81 pushed a commit to dannyk81/ingress that referenced this issue Mar 21, 2017
Allow Prometheus automatic discovery of nginx metrics endpoint

Fixed kubernetes#464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants