Syntax for passing podAnnotations map to Istioctl installer

12/3/2021

I'm trying to add some additional annotations to the pods that are created by the istiod deployment.

I'm using the istioctl install documentation, which suggests that I can use the podAnnotations field from the istio operator documentation, but I can't see how to structure the argument correctly.

The docs say it is of type map<string, string>. How do you express that?

I've tried a few variations, e.g

./istioctl install --set profile=minimal --set components.pilot.k8s.hpaSpec.minReplicas=2 --set components.pilot.k8s.podAnnotations={"foo":"bar"} -y
-- Scottm
istio
kubernetes

1 Answer

12/7/2021

I ended up solving this using an IstioOperator resource, which matches what Chris suggested in his comment.

To achieve the desired effect I used a resource which looks like this:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  profile: minimal
  components:
    pilot:
      k8s:
        podAnnotations:
          co.elastic.logs/enabled : "true"
          co.elastic.logs/processors.dissect.field: "message"
          co.elastic.logs/processors.dissect.tokenizer: "%{@timestamp}	%{level}	%{message}"
          co.elastic.logs/processors.dissect.overwrite_keys: "true"
          co.elastic.logs/processors.dissect.target_prefix: ""
        hpaSpec:
          minReplicas : 2

This file is passed to the installer on the command line:

istioctl install -f ${path.root}/k8s/istio/istioctl-config.yaml -y

This seems to be the way to provide podAnnotations. It also matches the recommendation made in the docs themselves to avoid using --set arguments on the install command in production.

-- Scottm
Source: StackOverflow