Automating Istio installation: Best practice

To automate istio installation (via Helm Charts), I’m just scripting this with shell. I’m wondering whats the best way to get this in ?

This is what I’ve

#!/bin/sh

# Variables
istio_binary_base_path=.
istio_version=1.3.0

# Housekeeping for istio download
rm -rf $istio_binary_base_path/istio
mkdir $istio_binary_base_path/istio
cd $istio_binary_base_path/istio

# Download istio binaries
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=$istio_version sh -

# Istio install
helm install istio-$istio_version/install/kubernetes/helm/istio-init --name istio-init --namespace istio-system
sleep 1m
helm install istio-$istio_version/install/kubernetes/helm/istio --name istio --namespace istio-system

# Housekeeping after install
rm -rf $istio_binary_base_path/istio

P.S: The 1 min delay was added without which the installation encounters error -

Error: validation failed: [unable to recognize "": no matches for kind "DestinationRule" in version "networking.istio.io/v1alpha3", unable to recognize "": no matches for kind "attributemanifest" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "handler" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "instance" in version "config.istio.io/v1alpha2", unable to recognize "": no matches for kind "rule" in version "config.istio.io/v1alpha2"]

More information
Istio version: 1.3.0
Cloud Vendor : Oracle Cloud Infrastructure

Appreciate any help on this !

Here is a script I use:

latest-version () {
        URL="https://gcsweb.istio.io/gcs/istio-prerelease/prerelease/"
        VERSION="${1:?version like 1.1.8}"
        RELEASE="$URL/$VERSION/istio-$VERSION-linux.tar.gz"
        TMP=`mktemp -d --suffix=_istio_latest`
        pushd $TMP
        curl -sL -o istio.tgz "$RELEASE"
        tar xvf istio.tgz
        rm -r ~/istio/latest-version
        mv "istio-$VERSION" ~/istio/latest-version
        popd
        pushd ~/istio/latest-version
        kubectl create namespace istio-system || true
        helm template install/kubernetes/helm/istio-init --name istio-init --namespace istio-system | kubectl apply -f -
        kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-10-$VERSION
        kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-11-$VERSION
        kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-12-$VERSION
        helm template install/kubernetes/helm/istio --name istio --namespace istio-system "${DEFAULT_HELM_FLAGS[@]}" "${@:2}" | kubectl apply -f -
        popd
        echo "Deployed $VERSION"
}

Use like latest-version 1.3.0. Note this uses the pre-release repos since I do this on pre-relreases often – not recommended for production

Thanks @howardjohn for the script and responses.

So essentially the script waits untill CRDs 10,11,12 are installed successfully.

1 Like