Istio node affinity setup with istioctl or overlay file

Hello,

I am installing istio version 1.4.6 into our k8s cluster. I would like for all of the istio components to run on specific nodes within the cluster. Is there a way (via overlay file or flag option) to do this? Was thinking with overlay it may look something like:

apiVersion: install.istio.io/v1alpha2
kind: IstioControlPlane
metadata:
namespace: istio-operator
name: istiocontrolplane
spec:
profile: default
values:
gateways:
istio-ingressgateway:
serviceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
components:
. k8s:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kops.k8s.io/instancegroup
operator: In
values:
- operations-job-nodes
tolerations:
- effect: NoExecute
key: k8s/dedicated
operator: Equal
value: operations-server

Is this correct or even possible?

Yes, you’re on the right track. You can see that affinity is just defined using the k8s API:


Whatever works for k8s affinity settings should work in IstioControlPlane.

Thanks for the response. So maybe struggling a bit with the overlay file that I have. Getting
could not unmarshal the overlay file: unknown field “k8s” in v1alpha2.IstioControlPlaneSpec. Also, would I have to make this type of change for each istio component or will one change apply to all components?

Tried one of the overlay file examples on the Istio site and tried to generate the manifest file using istioctl. Still getting an error:
could not unmarshal the overlay file: unknown field “components” in v1alpha2.IstioControlPlaneSpec. Wondering if this is only possible in istio 1.5 and not available in istio 1.4.6?