Istio: Missing App and Version Label
If you are seeing the error in Istio’s Kialia that says that the app and version label are missing from the deployment then this post will help you. Istio needs an app and version labels to produce accurate telemetry related to your applications. By adding these two labels you will also have your app show up under the Applications tab of Kiali.
Pod Selectors are immutable.
Pods with app and version labels: We recommend adding an explicit app
label and version
label to the specification of the pods deployed using a Kubernetes Deployment
. The app
and version
labels add contextual information to the metrics and telemetry that Istio collects. (https://istio.io/latest/docs/ops/deployment/requirements/)
Solution: Creating App and Version Labels on the Pods
The easiest way to do this is to modify the values.yaml
file to include 2 variables for the pod app
and version
label. Then map those values into the pod via the deployment.yaml
file in the helm charts.
Modifying the values.yaml to for “Pod Labels”
values.yaml
1 2 3 |
podLabels: app: "ms-app-api" version: "1.0.0" |
Templating
Next, you will want to modify the _helpers.tpl
template file to add this snippet below.
_helpers.tpl
1 2 3 4 5 6 7 8 9 10 11 12 |
{{/* Pod labels */}} {{- define "ms-app-api.podlabels" -}} {{- if .Values.podLabels.app }} app: {{ .Values.podLabels.app }} {{- end }} {{- if .Values.podLabels.version }} version: {{ .Values.podLabels.version }} {{- end }} {{- end }} |
Modifying the Deployment Manifest
Modifying the deployment manifest will make mapping the pod labels in easily.
deployment.yaml
1 2 3 4 5 |
spec: template: metadata: labels: {{- include "ms-app-api.podlabels" . | nindent 8 }} |