Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helm installation steps for multi-cluster #15459

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ec86ac1
Add helm installation steps for multi-primary
nshankar13 Jul 22, 2024
2683183
Update clusterid
nshankar13 Jul 22, 2024
bf245a5
Update config steps
nshankar13 Jul 22, 2024
e38a352
Edit steps
nshankar13 Jul 22, 2024
1972a1d
Update multi-primary steps
nshankar13 Jul 22, 2024
39cfa21
Update files and docs
nshankar13 Jul 23, 2024
f637195
Add primary-remote steps
nshankar13 Jul 23, 2024
6172022
Edit spacing
nshankar13 Jul 23, 2024
31281af
Remove var
nshankar13 Jul 23, 2024
feff2d2
Fix cluster name
nshankar13 Jul 23, 2024
bd83b5e
Update snips
nshankar13 Jul 23, 2024
7471be6
Update docs
nshankar13 Jul 29, 2024
9b18e85
Update commands
nshankar13 Jul 29, 2024
c10062a
Update docs
nshankar13 Jul 30, 2024
930fc39
Update note
nshankar13 Jul 30, 2024
cc308c8
Resolve comments and UTs
nshankar13 Jul 30, 2024
cf4050c
Add quotes
nshankar13 Jul 30, 2024
293fd4a
Run make gen
nshankar13 Jul 30, 2024
b3bb66d
Add more quotes
nshankar13 Jul 30, 2024
8702ab4
Fix lints
nshankar13 Jul 30, 2024
ef579ed
fix lint and spelling
nshankar13 Aug 1, 2024
e825b61
Update tests
nshankar13 Aug 2, 2024
cfefddd
Add new tests for helm
nshankar13 Aug 5, 2024
ab2ba59
Fix test
nshankar13 Aug 7, 2024
d367e44
Update go.mod
nshankar13 Aug 8, 2024
25db14d
Update installation scripts
nshankar13 Aug 9, 2024
9a94b4b
Update helm repo setup scripts
nshankar13 Aug 14, 2024
642ad91
Update cleanup steps
nshankar13 Aug 15, 2024
7585427
Update script and lint
nshankar13 Aug 15, 2024
0811e68
update cleanup step
nshankar13 Aug 15, 2024
515ea4f
Update cleanup steps
nshankar13 Aug 28, 2024
26d2847
Update cleanup steps
nshankar13 Aug 28, 2024
d8c8d87
Fix cleanup script
nshankar13 Aug 28, 2024
fcac382
Fix installation steps
nshankar13 Aug 28, 2024
f27579e
Update scripts
nshankar13 Aug 28, 2024
7938dad
Update istio-system ns creation steps
nshankar13 Aug 28, 2024
524c567
Fix CRD cleanup
nshankar13 Sep 4, 2024
897e307
Update Helm CRD Cleanup
nshankar13 Sep 4, 2024
c3a771d
Update cleanup
nshankar13 Sep 4, 2024
b58edd1
Remove additional var
nshankar13 Sep 10, 2024
125db3c
Resolve comments
nshankar13 Sep 12, 2024
38fbead
fix go.mod
nshankar13 Sep 12, 2024
98806d5
Fix lint
nshankar13 Sep 12, 2024
ee197ec
update charts for remote profile
nshankar13 Oct 23, 2024
92282fa
Update indentation
nshankar13 Oct 23, 2024
9260923
Update indentation
nshankar13 Oct 23, 2024
3368a94
Fix lint
nshankar13 Oct 23, 2024
3d1a866
Fix numbering
nshankar13 Oct 23, 2024
e119b2a
Update installation steps
nshankar13 Oct 23, 2024
8ac8d40
Add missing steps
nshankar13 Oct 25, 2024
fa47add
Update cleanup steps
nshankar13 Oct 25, 2024
8a4ca03
Fix indentation
nshankar13 Oct 25, 2024
c8c41b7
Update indentation
nshankar13 Oct 25, 2024
8d355b0
Resolve comments
nshankar13 Oct 26, 2024
b06ee3e
Resolve comments
nshankar13 Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ Choose the installation that best fits your needs:

- [Install Primary-Remote on Different Networks](/docs/setup/install/multicluster/primary-remote_multi-network)

{{< tip >}}
If you plan on installing Istio multi-cluster using Helm, follow the
[Helm prerequisites](/docs/setup/install/helm/#prerequisites) in the Helm install guide first.
{{< /tip >}}

{{< tip >}}
For meshes that span more than two clusters, you may need to use more than
one of these options. For example, you may have a primary cluster per region
Expand Down
56 changes: 48 additions & 8 deletions content/en/docs/setup/install/multicluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,27 @@ function configure_trust
popd || exit # Return to the previous directory.
}

# cleanup removes all resources created by the tests.
function cleanup
# cleanup_istioctl removes all resources created by the tests with istioctl.
function cleanup_istioctl
{
# Remove temp files.
rm -f cluster1.yaml cluster2.yaml certs

# Cleanup both clusters concurrently
cleanup_cluster1 &
cleanup_cluster2 &
cleanup_cluster1_istioctl &
cleanup_cluster2_istioctl &
wait
}

# cleanup_cluster1 removes the istio-system and sample namespaces on CLUSTER1.
function cleanup_cluster1
# cleanup_cluster1_istioctl removes the istio-system and sample namespaces on CLUSTER1 with istioctl.
function cleanup_cluster1_istioctl
{
echo y | istioctl uninstall --revision=default --context="${CTX_CLUSTER1}"
kubectl delete ns istio-system sample --context="${CTX_CLUSTER1}" --ignore-not-found
}

# cleanup_cluster2 removes the istio-system and sample namespaces on CLUSTER2.
function cleanup_cluster2
# cleanup_cluster2_istioctl removes the istio-system and sample namespaces on CLUSTER2 with istioctl.
function cleanup_cluster2_istioctl
{
echo y | istioctl uninstall --revision=default --context="${CTX_CLUSTER2}"
kubectl delete ns istio-system sample --context="${CTX_CLUSTER2}" --ignore-not-found
Expand Down Expand Up @@ -144,3 +144,43 @@ function verify_load_balancing
_verify_contains snip_verifying_crosscluster_traffic_3 "$EXPECTED_RESPONSE_FROM_CLUSTER1"
_verify_contains snip_verifying_crosscluster_traffic_3 "$EXPECTED_RESPONSE_FROM_CLUSTER2"
}

# For Helm multi-cluster installation steps

function create_istio_system_ns
{
snip_create_istio_system_namespace_cluster_1
snip_create_istio_system_namespace_cluster_2
}

function setup_helm_repo
{
snip_setup_helm_repo_cluster_1
snip_setup_helm_repo_cluster_2
}

snip_create_istio_system_namespace_cluster_1() {
kubectl create namespace istio-system --context "${CTX_CLUSTER1}"
}

snip_create_istio_system_namespace_cluster_2() {
kubectl create namespace istio-system --context "${CTX_CLUSTER2}"
}

snip_setup_helm_repo_cluster_1() {
helm repo add istio https://istio-release.storage.googleapis.com/charts --kube-context "${CTX_CLUSTER1}"
helm repo update --kube-context "${CTX_CLUSTER1}"
}

snip_setup_helm_repo_cluster_2() {
helm repo add istio https://istio-release.storage.googleapis.com/charts --kube-context "${CTX_CLUSTER2}"
helm repo update --kube-context "${CTX_CLUSTER2}"
}

snip_delete_sample_ns_cluster_1() {
kubectl delete namespace sample --context "${CTX_CLUSTER1}"
}

snip_delete_sample_ns_cluster_2() {
kubectl delete namespace sample --context "${CTX_CLUSTER2}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC2154

# Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# @setup multicluster

set -e
set -u
set -o pipefail

source content/en/docs/setup/install/multicluster/common.sh
set_single_network_vars
setup_helm_repo

function install_istio_helm {
# Install Istio on the 2 clusters. Executing in
# parallel to reduce test time.
install_istio_on_cluster1_helm &
install_istio_on_cluster2_helm &
wait
}

function install_istio_on_cluster1_helm {
echo "Installing Istio on Primary cluster: ${CTX_CLUSTER1}"
snip_configure_cluster1_as_a_primary_3
snip_configure_cluster1_as_a_primary_4
}

function install_istio_on_cluster2_helm {
echo "Installing Istio on Primary cluster: ${CTX_CLUSTER2}"
snip_configure_cluster2_as_a_primary_3
snip_configure_cluster2_as_a_primary_4
}

function enable_endpoint_discovery {
snip_enable_endpoint_discovery_1
snip_enable_endpoint_discovery_2
}

time configure_trust
time install_istio_helm
time enable_endpoint_discovery
time verify_load_balancing

# @cleanup
source content/en/docs/setup/install/multicluster/common.sh
set_single_network_vars

function cleanup_cluster1_helm {
snip_cleanup_3
snip_cleanup_4
snip_delete_sample_ns_cluster_1
}

function cleanup_cluster2_helm {
snip_cleanup_5
snip_cleanup_6
snip_delete_sample_ns_cluster_2
}

function cleanup_helm {
cleanup_cluster1_helm
cleanup_cluster2_helm
snip_delete_crds
}

time cleanup_helm

# Everything should be removed once cleanup completes. Use a small
# timeout for comparing cluster snapshots before/after the test.
export VERIFY_TIMEOUT=20
128 changes: 116 additions & 12 deletions content/en/docs/setup/install/multicluster/multi-primary/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ Service workloads communicate directly (pod-to-pod) across cluster boundaries.

## Configure `cluster1` as a primary

Create the Istio configuration for `cluster1`:
Create the `istioctl` configuration for `cluster1`:

{{< tabset category-name="multicluster-install-type-cluster-1" >}}

{{< tab name="IstioOperator" category-value="iop" >}}
nshankar13 marked this conversation as resolved.
Show resolved Hide resolved

Install Istio as primary in `cluster1` using istioctl and the `IstioOperator` API.

{{< text bash >}}
$ cat <<EOF > cluster1.yaml
Expand All @@ -48,9 +54,36 @@ Apply the configuration to `cluster1`:
$ istioctl install --context="${CTX_CLUSTER1}" -f cluster1.yaml
{{< /text >}}

{{< /tab >}}
{{< tab name="Helm" category-value="helm" >}}

Install Istio as primary in `cluster1` using the following Helm commands:

Install the `base` chart in `cluster1`:

{{< text bash >}}
$ helm install istio-base istio/base -n istio-system --kube-context "${CTX_CLUSTER1}"
{{< /text >}}

Then, install the `istiod` chart in `cluster1` with the following multi-cluster settings:

{{< text bash >}}
$ helm install istiod istio/istiod -n istio-system --kube-context "${CTX_CLUSTER1}" --set global.meshID=mesh1 --set global.multiCluster.clusterName=cluster1 --set global.network=network1
{{< /text >}}

{{< /tab >}}

{{< /tabset >}}

## Configure `cluster2` as a primary

Create the Istio configuration for `cluster2`:
Create the `istioctl` configuration for `cluster2`:

{{< tabset category-name="multicluster-install-type-cluster-2" >}}

{{< tab name="IstioOperator" category-value="iop" >}}

Install Istio as primary in `cluster2` using istioctl and the `IstioOperator` API.

{{< text bash >}}
$ cat <<EOF > cluster2.yaml
Expand All @@ -72,6 +105,27 @@ Apply the configuration to `cluster2`:
$ istioctl install --context="${CTX_CLUSTER2}" -f cluster2.yaml
{{< /text >}}

{{< /tab >}}
{{< tab name="Helm" category-value="helm" >}}

Install Istio as primary in `cluster2` using the following Helm commands:

Install the `base` chart in `cluster2`:

{{< text bash >}}
$ helm install istio-base istio/base -n istio-system --kube-context "${CTX_CLUSTER2}"
{{< /text >}}

Then, install the `istiod` chart in `cluster2` with the following multi-cluster settings:

{{< text bash >}}
$ helm install istiod istio/istiod -n istio-system --kube-context "${CTX_CLUSTER2}" --set global.meshID=mesh1 --set global.multiCluster.clusterName=cluster2 --set global.network=network1
{{< /text >}}

{{< /tab >}}

{{< /tabset >}}

## Enable Endpoint Discovery

Install a remote secret in `cluster2` that provides access to `cluster1`’s API server.
Expand Down Expand Up @@ -101,16 +155,66 @@ You can now [verify the installation](/docs/setup/install/multicluster/verify).

## Cleanup

1. Uninstall Istio in `cluster1`:
Uninstall Istio from both `cluster1` and `cluster2` using the same mechanism you installed Istio with (istioctl or Helm).

{{< tabset category-name="multicluster-uninstall-type-cluster-1" >}}

{{< tab name="IstioOperator" category-value="iop" >}}

Uninstall Istio in `cluster1`:

{{< text syntax=bash snip_id=none >}}
$ istioctl uninstall --context="${CTX_CLUSTER1}" -y --purge
$ kubectl delete ns istio-system --context="${CTX_CLUSTER1}"
{{< /text >}}
nshankar13 marked this conversation as resolved.
Show resolved Hide resolved

Uninstall Istio in `cluster2`:

{{< text syntax=bash snip_id=none >}}
$ istioctl uninstall --context="${CTX_CLUSTER2}" -y --purge
$ kubectl delete ns istio-system --context="${CTX_CLUSTER2}"
{{< /text >}}
nshankar13 marked this conversation as resolved.
Show resolved Hide resolved

{{< /tab >}}

{{< text syntax=bash snip_id=none >}}
$ istioctl uninstall --context="${CTX_CLUSTER1}" -y --purge
$ kubectl delete ns istio-system --context="${CTX_CLUSTER1}"
{{< /text >}}
{{< tab name="Helm" category-value="helm" >}}

Delete Istio Helm installation from `cluster1`:

{{< text syntax=bash >}}
$ helm delete istiod -n istio-system --kube-context "${CTX_CLUSTER1}"
$ helm delete istio-base -n istio-system --kube-context "${CTX_CLUSTER1}"
{{< /text >}}
nshankar13 marked this conversation as resolved.
Show resolved Hide resolved

Delete the `istio-system` namespace from `cluster1`:

{{< text syntax=bash >}}
$ kubectl delete ns istio-system --context="${CTX_CLUSTER1}"
{{< /text >}}
nshankar13 marked this conversation as resolved.
Show resolved Hide resolved

Delete Istio Helm installation from `cluster2`:

{{< text syntax=bash >}}
$ helm delete istiod -n istio-system --kube-context "${CTX_CLUSTER2}"
$ helm delete istio-base -n istio-system --kube-context "${CTX_CLUSTER2}"
{{< /text >}}
nshankar13 marked this conversation as resolved.
Show resolved Hide resolved

Delete the `istio-system` namespace from `cluster2`:

{{< text syntax=bash >}}
$ kubectl delete ns istio-system --context="${CTX_CLUSTER2}"
{{< /text >}}
nshankar13 marked this conversation as resolved.
Show resolved Hide resolved

(Optional) Delete CRDs installed by Istio:

Deleting CRDs permanently removes any Istio resources you have created in your clusters.
Delete Istio CRDs installed in your clusters by running:

{{< text syntax=bash snip_id=delete_crds >}}
$ kubectl get crd -oname --context "${CTX_CLUSTER1}" | grep --color=never 'istio.io' | xargs kubectl delete --context "${CTX_CLUSTER1}"
$ kubectl get crd -oname --context "${CTX_CLUSTER2}" | grep --color=never 'istio.io' | xargs kubectl delete --context "${CTX_CLUSTER2}"
{{< /text >}}

1. Uninstall Istio in `cluster2`:
{{< /tab >}}

{{< text syntax=bash snip_id=none >}}
$ istioctl uninstall --context="${CTX_CLUSTER2}" -y --purge
$ kubectl delete ns istio-system --context="${CTX_CLUSTER2}"
{{< /text >}}
{{< /tabset >}}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ snip_configure_cluster1_as_a_primary_2() {
istioctl install --context="${CTX_CLUSTER1}" -f cluster1.yaml
}

snip_configure_cluster1_as_a_primary_3() {
helm install istio-base istio/base -n istio-system --kube-context "${CTX_CLUSTER1}"
}

snip_configure_cluster1_as_a_primary_4() {
helm install istiod istio/istiod -n istio-system --kube-context "${CTX_CLUSTER1}" --set global.meshID=mesh1 --set global.multiCluster.clusterName=cluster1 --set global.network=network1
}

snip_configure_cluster2_as_a_primary_1() {
cat <<EOF > cluster2.yaml
apiVersion: install.istio.io/v1alpha1
Expand All @@ -56,6 +64,14 @@ snip_configure_cluster2_as_a_primary_2() {
istioctl install --context="${CTX_CLUSTER2}" -f cluster2.yaml
}

snip_configure_cluster2_as_a_primary_3() {
helm install istio-base istio/base -n istio-system --kube-context "${CTX_CLUSTER2}"
}

snip_configure_cluster2_as_a_primary_4() {
helm install istiod istio/istiod -n istio-system --kube-context "${CTX_CLUSTER2}" --set global.meshID=mesh1 --set global.multiCluster.clusterName=cluster2 --set global.network=network1
}

snip_enable_endpoint_discovery_1() {
istioctl create-remote-secret \
--context="${CTX_CLUSTER1}" \
Expand All @@ -69,3 +85,26 @@ istioctl create-remote-secret \
--name=cluster2 | \
kubectl apply -f - --context="${CTX_CLUSTER1}"
}

snip_cleanup_3() {
helm delete istiod -n istio-system --kube-context "${CTX_CLUSTER1}"
helm delete istio-base -n istio-system --kube-context "${CTX_CLUSTER1}"
}

snip_cleanup_4() {
kubectl delete ns istio-system --context="${CTX_CLUSTER1}"
}

snip_cleanup_5() {
helm delete istiod -n istio-system --kube-context "${CTX_CLUSTER2}"
helm delete istio-base -n istio-system --kube-context "${CTX_CLUSTER2}"
}

snip_cleanup_6() {
kubectl delete ns istio-system --context="${CTX_CLUSTER2}"
}

snip_delete_crds() {
kubectl get crd -oname --context "${CTX_CLUSTER1}" | grep --color=never 'istio.io' | xargs kubectl delete --context "${CTX_CLUSTER1}"
kubectl get crd -oname --context "${CTX_CLUSTER2}" | grep --color=never 'istio.io' | xargs kubectl delete --context "${CTX_CLUSTER2}"
}
Loading