I am trying to deploy ingress controller with service monitor, i am using helm values file which looks like that:
controller:
replicaCount: 3
minAvailable: 1
config:
use-forwarded-headers: "true"
use-proxy-protocol: "true"
keep-alive: "3600"
service:
externalTrafficPolicy: Local
type: LoadBalancer
metrics:
enabled: true
serviceMonitor:
enabled: true
rbac:
create: true
serviceAccount:
create: true
name: nginx-ingress-serviceaccount
when i run helm template with my values file provided, service monitor is not visible.
helm template ingress-nginx/ingress-nginx --values values.yaml --version "4.0.5"
Does anyone had similar problem? Thanks in advance for your replies.
ServiceMonitor has 3 conditions to be populated, make sure that your cluster and configs meet these conditions: https://github.com/kubernetes/ingress-nginx/blob/6299c39842c31ff1e17d72503003ca36e2976a9a/charts/ingress-nginx/templates/controller-servicemonitor.yaml#L1
your cluster should support: monitoring.coreos.com/v1 API version
if you use an older chart version where the API condition is not there, you will be able to deploy the ServiceMonitor with your current values.yaml
Also, note that: https://helm.sh/docs/helm/helm_template/
This means if you run the command line on your machine, it will never show the
ServiceMonitorunless you have a local k8s cluster that supportsmonitoring.coreos.com/v1or you fake it too :) as below