Skip to content

Ingress DaemonSet deployment fails with metrics enabled #325

@ronnybremer

Description

@ronnybremer

I was able to successfully deploy the helm chart with this config:

controller:
  kind: DaemonSet
  service:
    daemonset:
      useHostPort: true
    nodePorts:
      http: 30000
      https: 30001
      stat: 30002
      admin: 30003
    ipFamilyPolicy: RequireDualStack

All nodes receive their HAProxy and its exposed to the outside on the specified ports.

Later I tried to enable Prometheus metrics support. According to the documentation, this has to be added:

controller:
...
  stats:
    enabled: true
  metrics:
    enabled: true
  serviceMonitor:
    enabled: true
    labels:
      release: prometheus
    metrics:
      relabelings:
      - replacement: cl1
        targetLabel: cluster
      - sourceLabels: [__meta_kubernetes_pod_node_name]
        targetLabel: hostname
    ctrlMetrics:
      relabelings:
      - replacement: cl1
        targetLabel: cluster
      - sourceLabels: [__meta_kubernetes_pod_node_name]
        targetLabel: hostname

However, helm generated a service ingress yaml, which fails to deploy:

# Source: kubernetes-ingress/templates/controller-service-metrics.yaml
apiVersion: v1
kind: Service
metadata:
  name: haproxy-kubernetes-ingress-metrics
  namespace: haproxy-controller
  labels:
    app.kubernetes.io/name: kubernetes-ingress
    app.kubernetes.io/instance: haproxy-kubernetes-ingress
    helm.sh/chart: kubernetes-ingress-1.46.1
    app.kubernetes.io/version: "3.1.14"
    app.kubernetes.io/managed-by: Helm
  annotations:
spec:
  type: ClusterIP
  ports:
    - name: stat
      port: 1024
      protocol: TCP
      targetPort: stat
      nodePort: 30002
  selector:
    app.kubernetes.io/name: kubernetes-ingress
    app.kubernetes.io/instance: haproxy-kubernetes-ingress

Its type is set to ClusterIP but it lists the nodePort, which is invalid. Also, the targetPort is stat, which should be admin.

Is this an error on my end?

Furthermore, according to the documentation of the Prometheus helm chart, the ServiceMonitor should be deployed into the namespace of Prometheus (in my case: monitoring), not in the haproxy namespace.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions