Customizing the installation configuration

Prerequisites

Before you begin, check the following prerequisites:

  1. Download the Istio release.
  2. Perform any necessary platform-specific setup.
  3. Check the Requirements for Pods and Services.

In addition to installing any of Istio’s built-in configuration profiles, istioctl install provides a complete API for customizing the configuration.

The configuration parameters in this API can be set individually using --set options on the command line. For example, to enable debug logging in a default configuration profile, use this command:

  1. $ istioctl install --set values.global.logging.level=debug

Alternatively, the IstioOperator configuration can be specified in a YAML file and passed to istioctl using the -f option:

  1. $ istioctl install -f samples/operator/pilot-k8s.yaml

For backwards compatibility, the previous Helm installation options, with the exception of Kubernetes resource settings, are also fully supported. To set them on the command line, prepend the option name with “values.”. For example, the following command overrides the pilot.traceSampling Helm configuration option:

  1. $ istioctl install --set values.pilot.traceSampling=0.1

Helm values can also be set in an IstioOperator CR (YAML file) as described in Customize Istio settings using the Helm API, below.

If you want to set Kubernetes resource settings, use the IstioOperator API as described in Customize Kubernetes settings.

Identify an Istio component

The IstioOperator API defines components as shown in the table below:

Components
base
pilot
ingressGateways
egressGateways
cni
istiodRemote

The configurable settings for each of these components are available in the API under components.<component name>. For example, to use the API to change (to false) the enabled setting for the pilot component, use --set components.pilot.enabled=false or set it in an IstioOperator resource like this:

  1. apiVersion: install.istio.io/v1alpha1
  2. kind: IstioOperator
  3. spec:
  4. components:
  5. pilot:
  6. enabled: false

All of the components also share a common API for changing Kubernetes-specific settings, under components.<component name>.k8s, as described in the following section.

Customize Kubernetes settings

The IstioOperator API allows each component’s Kubernetes settings to be customized in a consistent way.

Each component has a KubernetesResourceSpec, which allows the following settings to be changed. Use this list to identify the setting to customize:

  1. Resources
  2. Readiness probes
  3. Replica count
  4. HorizontalPodAutoscaler
  5. PodDisruptionBudget
  6. Pod annotations
  7. Service annotations
  8. ImagePullPolicy
  9. Priority class name
  10. Node selector
  11. Affinity and anti-affinity
  12. Service
  13. Toleration
  14. Strategy
  15. Env
  16. Pod security context

All of these Kubernetes settings use the Kubernetes API definitions, so Kubernetes documentation can be used for reference.

The following example overlay file adjusts the resources and horizontal pod autoscaling settings for Pilot:

  1. apiVersion: install.istio.io/v1alpha1
  2. kind: IstioOperator
  3. spec:
  4. components:
  5. pilot:
  6. k8s:
  7. resources:
  8. requests:
  9. cpu: 1000m # override from default 500m
  10. memory: 4096Mi # ... default 2048Mi
  11. hpaSpec:
  12. maxReplicas: 10 # ... default 5
  13. minReplicas: 2 # ... default 1

Use istioctl install to apply the modified settings to the cluster:

  1. $ istioctl install -f samples/operator/pilot-k8s.yaml

Customize Istio settings using the Helm API

The IstioOperator API includes a pass-through interface to the Helm API using the values field.

The following YAML file configures global and Pilot settings through the Helm API:

  1. apiVersion: install.istio.io/v1alpha1
  2. kind: IstioOperator
  3. spec:
  4. values:
  5. pilot:
  6. traceSampling: 0.1 # override from 1.0
  7. global:
  8. monitoringPort: 15014

Some parameters will temporarily exist in both the Helm and IstioOperator APIs, including Kubernetes resources, namespaces and enablement settings. The Istio community recommends using the IstioOperator API as it is more consistent, is validated, and follows the community graduation process.

Configure gateways

Gateways are a special type of component, since multiple ingress and egress gateways can be defined. In the IstioOperator API, gateways are defined as a list type. The default profile installs one ingress gateway, called istio-ingressgateway. You can inspect the default values for this gateway:

  1. $ istioctl profile dump --config-path components.ingressGateways
  2. $ istioctl profile dump --config-path values.gateways.istio-ingressgateway

These commands show both the IstioOperator and Helm settings for the gateway, which are used together to define the generated gateway resources. The built-in gateways can be customized just like any other component.

From 1.7 onward, the gateway name must always be specified when overlaying. Not specifying any name no longer defaults to istio-ingressgateway or istio-egressgateway.

A new user gateway can be created by adding a new list entry:

  1. apiVersion: install.istio.io/v1alpha1
  2. kind: IstioOperator
  3. spec:
  4. components:
  5. ingressGateways:
  6. - name: istio-ingressgateway
  7. enabled: true
  8. - namespace: user-ingressgateway-ns
  9. name: ilb-gateway
  10. enabled: true
  11. k8s:
  12. resources:
  13. requests:
  14. cpu: 200m
  15. serviceAnnotations:
  16. cloud.google.com/load-balancer-type: "internal"
  17. service:
  18. ports:
  19. - port: 8060
  20. targetPort: 8060
  21. name: tcp-citadel-grpc-tls
  22. - port: 5353
  23. name: tcp-dns

Note that Helm values (spec.values.gateways.istio-ingressgateway/egressgateway) are shared by all ingress/egress gateways. If these must be customized per gateway, it is recommended to use a separate IstioOperator CR to generate a manifest for the user gateways, separate from the main Istio installation:

  1. apiVersion: install.istio.io/v1alpha1
  2. kind: IstioOperator
  3. spec:
  4. profile: empty
  5. components:
  6. ingressGateways:
  7. - name: ilb-gateway
  8. namespace: user-ingressgateway-ns
  9. enabled: true
  10. # Copy settings from istio-ingressgateway as needed.
  11. values:
  12. gateways:
  13. istio-ingressgateway:
  14. debug: error

Advanced install customization

Customizing external charts and profiles

The istioctl install, manifest generate and profile commands can use any of the following sources for charts and profiles:

  • compiled in charts. This is the default if no --manifests option is set. The compiled in charts are the same as those in the manifests/ directory of the Istio release .tgz.
  • charts in the local file system, e.g., istioctl install --manifests istio-1.11.0/manifests
  • charts in GitHub, e.g., istioctl install --manifests https://github.com/istio/istio/releases/download/1.11.0/istio-1.11.0-linux-arm64.tar.gz

Local file system charts and profiles can be customized by editing the files in manifests/. For extensive changes, we recommend making a copy of the manifests directory and make changes there. Note, however, that the content layout in the manifests directory must be preserved.

Profiles, found under manifests/profiles/, can be edited and new ones added by creating new files with the desired profile name and a .yaml extension. istioctl scans the profiles subdirectory and all profiles found there can be referenced by name in the IstioOperatorSpec profile field. Built-in profiles are overlaid on the default profile YAML before user overlays are applied. For example, you can create a new profile file called custom1.yaml which customizes some settings from the default profile, and then apply a user overlay file on top of that:

  1. $ istioctl manifest generate --manifests mycharts/ --set profile=custom1 -f path-to-user-overlay.yaml

In this case, the custom1.yaml and user-overlay.yaml files will be overlaid on the default.yaml file to obtain the final values used as the input for manifest generation.

In general, creating new profiles is not necessary since a similar result can be achieved by passing multiple overlay files. For example, the command above is equivalent to passing two user overlay files:

  1. $ istioctl manifest generate --manifests mycharts/ -f manifests/profiles/custom1.yaml -f path-to-user-overlay.yaml

Creating a custom profile is only required if you need to refer to the profile by name through the IstioOperatorSpec.

Patching the output manifest

The IstioOperator CR, input to istioctl, is used to generate the output manifest containing the Kubernetes resources to be applied to the cluster. The output manifest can be further customized to add, modify or delete resources through the IstioOperator overlays API, after it is generated but before it is applied to the cluster.

The following example overlay file (patch.yaml) demonstrates the type of output manifest patching that can be done:

  1. apiVersion: install.istio.io/v1alpha1
  2. kind: IstioOperator
  3. spec:
  4. profile: empty
  5. hub: docker.io/istio
  6. tag: 1.1.6
  7. components:
  8. pilot:
  9. enabled: true
  10. namespace: istio-control
  11. k8s:
  12. overlays:
  13. - kind: Deployment
  14. name: istiod
  15. patches:
  16. # Select list item by value
  17. - path: spec.template.spec.containers.[name:discovery].args.[30m]
  18. value: "60m" # overridden from 30m
  19. # Select list item by key:value
  20. - path: spec.template.spec.containers.[name:discovery].ports.[containerPort:8080].containerPort
  21. value: 1234
  22. # Override with object (note | on value: first line)
  23. - path: spec.template.spec.containers.[name:discovery].env.[name:POD_NAMESPACE].valueFrom
  24. value: |
  25. fieldRef:
  26. apiVersion: v2
  27. fieldPath: metadata.myPath
  28. # Deletion of list item
  29. - path: spec.template.spec.containers.[name:discovery].env.[name:REVISION]
  30. # Deletion of map item
  31. - path: spec.template.spec.containers.[name:discovery].securityContext
  32. - kind: Service
  33. name: istiod
  34. patches:
  35. - path: spec.ports.[name:https-dns].port
  36. value: 11111 # OVERRIDDEN

Passing the file to istioctl manifest generate -f patch.yaml applies the above patches to the default profile output manifest. The two patched resources will be modified as shown below (some parts of the resources are omitted for brevity):

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: istiod
  5. spec:
  6. template:
  7. spec:
  8. containers:
  9. - args:
  10. - 60m
  11. env:
  12. - name: POD_NAMESPACE
  13. valueFrom:
  14. fieldRef:
  15. apiVersion: v2
  16. fieldPath: metadata.myPath
  17. name: discovery
  18. ports:
  19. - containerPort: 1234
  20. ---
  21. apiVersion: v1
  22. kind: Service
  23. metadata:
  24. name: istiod
  25. spec:
  26. ports:
  27. - name: https-dns
  28. port: 11111
  29. ---

Note that the patches are applied in the given order. Each patch is applied over the output from the previous patch. Paths in patches that don’t exist in the output manifest will be created.

List item path selection

Both the istioctl --set flag and the k8s.overlays field in IstioOperator CR support list item selection by [index], [value] or by [key:value]. The –set flag also creates any intermediate nodes in the path that are missing in the resource.