Giter VIP home page Giter VIP logo

istio-multi-cluster-setup's Introduction

Introduction

This repo is to automate the setup of a Multi-primary Istio Mesh of two AKS clusters using Hashicorp Vault or using Self Signed Certificates

Prerequisites

  1. Azure Subscription
  2. Terraform
  3. kubectl
  4. istioctl

Configuration Setup

Deploy South Central Cluster

  az login
  terraform -chdir=./infrastructure workspace new southcentral
  terraform -chdir=./infrastructure init
  terraform -chdir=./infrastructure apply -var "location=southcentralus" -auto-approve

Deploy Central Cluster

  az login

  terraform -chdir=./infrastructure workspace new central
  terraform -chdir=./infrastructure init
  terraform -chdir=./infrastructure apply -var "location=centralus" -auto-approve

Peer Networks

  source ./scripts/setup-env.sh
  bash ./scripts/peer.sh

Setup Hashicorp Vault

  1. Setup Vault

Request Istio Certificates - Central

  # https://cert-manager.io/docs/configuration/vault/
  #Update ./cluster-manifests/base/certificate-issuer with values from Vault configuration 
    #  secretId: ""
    #  server: ""
    #  roleId: ""

  source ./scripts/setup-env.sh

  az aks get-credentials -g ${CENTRAL_CLUSTER_RG} -n ${CENTRAL_CLUSTER_NAME} --overwrite-existing
  kubelogin convert-kubeconfig -l azurecli
  kubectl --context="${CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/istio-namespace.yaml
  kubectl --context="${CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/certificate-issuer.yaml
  kubectl --context="${CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/certificate.yaml
  helm --kube-context="${CENTRAL_CLUSTER_NAME}" upgrade -i -n cert-manager cert-manager-istio-csr jetstack/cert-manager-istio-csr \
    --set "app.tls.rootCAFile=/var/run/secrets/istio-csr/ca.pem" \
    --set "app.server.clusterID=${CENTRAL_CLUSTER_NAME}" \
    --set "app.certmanager.issuer.name=vault-issuer" \
    --set "app.tls.certificateDNSNames[0]=cert-manager-istio-csr.istio-system.svc" \
    --set "volumeMounts[0].name=root-ca" \
    --set "volumeMounts[0].mountPath=/var/run/secrets/istio-csr" \
    --set "volumes[0].name=root-ca" \
    --set "volumes[0].secret.secretName=istio-ca"

Request Istio Certificates - South Central

  #Update ./cluster-manifests/base/certificate-issuer with values from Vault configuration 
    #  secretId: ""
    #  server: ""
    #  roleId: ""

  source ./scripts/setup-env.sh

  az aks get-credentials -g ${SOUTH_CENTRAL_CLUSTER_RG} -n ${SOUTH_CENTRAL_CLUSTER_NAME} --overwrite-existing
  kubelogin convert-kubeconfig -l azurecli
  kubectl --context="${SOUTH_CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/istio-namespace.yaml
  kubectl --context="${SOUTH_CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/certificate-issuer.yaml
  kubectl --context="${SOUTH_CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/certificate.yaml
  helm --kube-ccontext="${SOUTH_CENTRAL_CLUSTER_NAME}"  upgrade -i -n cert-manager cert-manager-istio-csr jetstack/cert-manager-istio-csr \
    --set "app.tls.rootCAFile=/var/run/secrets/istio-csr/ca.pem" \
    --set "app.server.clusterID=${CENTRAL_CLUSTER_NAME}" \
    --set "app.certmanager.issuer.name=vault-issuer" \
    --set "app.tls.certificateDNSNames[0]=cert-manager-istio-csr.istio-system.svc" \
    --set "volumeMounts[0].name=root-ca" \
    --set "volumeMounts[0].mountPath=/var/run/secrets/istio-csr" \
    --set "volumes[0].name=root-ca" \
    --set "volumes[0].secret.secretName=istio-ca"

Install Istio - Central

  watch kubectl --context="${CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/istio-operator.yaml
  kubectl --context="${CENTRAL_CLUSTER_NAME}" apply -k ./cluster-mantifests/central

Install Istio - South Central

  watch kubectl --context="${SOUTH_CENTRAL_CLUSTER_NAME}" apply -f ./cluster-manifests/base/istio-operator.yaml
  kubectl --context="${SOUTH_CENTRAL_CLUSTER_NAME}" apply -k ./cluster-mantifests/southcentral

Setup Istio Remote Secrets

  source ./scripts/setup-env.sh

  istioctl x create-remote-secret --context="${CENTRAL_CLUSTER_NAME}" --name="${CENTRAL_CLUSTER_NAME}" \
    | kubectl --context="${SOUTH_CENTRAL_CLUSTER_NAME}" apply -f - 
  istioctl x create-remote-secret --context="${SOUTH_CENTRAL_CLUSTER_NAME}" --name="${SOUTH_CENTRAL_CLUSTER_NAME}" \
    | kubectl --context="${CENTRAL_CLUSTER_NAME}" apply -f - 

Deploy App

  kubectl --context="${CENTRAL_CLUSTER_NAME}" apply -f ./apps/os-checker/v1/os-checker.yaml
  kubectl --context="${SOUTH_CENTRAL_CLUSTER_NAME}" apply -f ./apps/os-checker/v2/os-checker.yaml

Validate

  kubectl run --restart=Never --image=bjd145/utils:3.10 utils
  kubectl exec utils -- curl -sS whatos-api.whatos.svc:8081/api/os
  kubectl exec utils -- curl -sS whatos-api.whatos.svc:8081/api/os

References:

istio-multi-cluster-setup's People

Contributors

briandenicola avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

istio-multi-cluster-setup's Issues

Version 2.0 Rewrite

The goal of this issue is to simplify the deployment and create an end-to-end validation of the multi-primary istio deployment

  • Simplify Kubernetes cluster deployments. Assume no existing Azure resources especially Azure firewalls to keep costs down.
    • Two regions
    • Create two vnets peered
    • AKS clusters will be public
  • Remove flux dependency.
  • Update and Validate documentation for Hashicorp Vault
  • Update and validate Istio Operator configuration

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.