diff --git a/charts/kube-prometheus-stack/templates/alertmanager/service.yaml b/charts/kube-prometheus-stack/templates/alertmanager/service.yaml
index a8fb80f6f5a8..f772ec628990 100644
--- a/charts/kube-prometheus-stack/templates/alertmanager/service.yaml
+++ b/charts/kube-prometheus-stack/templates/alertmanager/service.yaml
@@ -1,3 +1,4 @@
+{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
 {{- if .Values.alertmanager.enabled }}
 apiVersion: v1
 kind: Service
@@ -44,7 +45,6 @@ spec:
     targetPort: {{ .Values.alertmanager.service.targetPort }}
     protocol: TCP
   - name: reloader-web
-    {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
     {{- if semverCompare ">=1.20.0-0" $kubeTargetVersion }}
     appProtocol: http
     {{- end }}