Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Istio-Multi Cluster] Tutorial is very detailed to install Primary-Remote on different networks

Posted on August 29, 2021December 14, 2021 By nim No Comments on [Istio-Multi Cluster] Tutorial is very detailed to install Primary-Remote on different networks

Contents

Toggle
  • 1) Overview
  • 2) The acctions on Istio primary cluster (cluster 1).
    • 2.1) Create namespace.
    • 2.2) Prepare essential tool
    • 2.3) Create certs.
    • 2.4) create manifest istio primary
    • 2.5) Apply cacert inside secret on k8s
    • 2.6) Recheck Loadbalancer
    • 2.7) apply istio-primary to k8s and recheck log
      • 2.7.1) injected istio into workloads
  • 3) Install east-west gateway components in cluster1
    • 3.1) east-west gateway
    • 3.2) Expose the control plane in cluster1
    • 3.3 istio remote secret cluster2
  • 4) The acctions on Istio remote cluster (cluster 2).
    • 4.1) Create namespace.
    • 4.2) create manifest istio remote
    • 4.3) Recheck Loadbalancer
    • 4.4) Apply cacert inside secret on k8s
    • 4.5) apply istio-primary to k8s and recheck log
  • 5) Install east-west gateway components in cluster2
  • 6) Verifying Cross-Cluster Traffic

1) Overview

https://istio.io/latest/docs/setup/install/multicluster/primary-remote_multi-network/

2) The acctions on Istio primary cluster (cluster 1).

2.1) Create namespace.

kubectl --context=local create ns istio-system
kubectl --context=local get namespace istio-system && \
  kubectl --context=local label namespace istio-system topology.istio.io/network=network1

2.2) Prepare essential tool

Tạo 1 thư mục để quản lý các file yaml

mkdir mutil-cluster-istio-diff-net
cd mutil-cluster-istio-diff-net/

>>>>download source cài istio
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.9.8 TARGET_ARCH=x86_64 sh -

2.3) Create certs.

Giờ chúng gen ca cert để cho các cluster nói chuyện với nhau

make -f Makefile.selfsigned.mk <tên bạn j cũng được>-cacerts

cd /root/mutil-cluster-istio-diff-net/istio-1.9.8/tools/certs/
make -f Makefile.selfsigned.mk root-ca
make -f Makefile.selfsigned.mk nimtechnology-cacerts

2.4) create manifest istio primary

Dump file operator cho primary(cluster1)

/root/mutil-cluster-istio-diff-net/istio-1.9.8/bin/istioctl profile dump default \
> /root/mutil-cluster-istio-diff-net/istio-operator-1.9.8-cluster1-primary.yaml

Nó có xuất hiện dòng này cũng chả sao nhé“2021-08-29T02:07:47.292081Z info proto: tag has too few fields: “-““

Giờ các bạn sửa file operator

Các bạn thêm vào các phần mầu đỏ nhé

Ở bài lần này mình sẽ không đánh revision cho operator nữa thấy nó cũng ko hữu ích lắm

Giờ tạo thư mục chứa yaml primary và gen file manifest cho primary

cd /root/mutil-cluster-istio-diff-net/
mkdir istio-primary
/root/mutil-cluster-istio-diff-net/istio-1.9.8/bin/istioctl manifest generate \
-f /root/mutil-cluster-istio-diff-net/istio-operator-1.9.8-cluster1-primary.yaml \
> /root/mutil-cluster-istio-diff-net/istio-primary/istio-primary-cluster1-1.9.8.yaml

2.5) Apply cacert inside secret on k8s

Đừng apply vội nhé mà create secret ca certs cho cluster 1 đã

>>>> tạo secret
cd /root/mutil-cluster-istio-diff-net/istio-1.9.8/tools/certs/

kubectl create secret generic cacerts -n istio-system --context=local \
      --from-file=nimtechnology/ca-cert.pem \
      --from-file=nimtechnology/ca-key.pem \
      --from-file=nimtechnology/root-cert.pem \
      --from-file=nimtechnology/cert-chain.pem

2.6) Recheck Loadbalancer

Nếu các bạn cài k8s trên server hay VM thì chắc chắn type LoadBalancer sẽ bị pending nền các cần cài metallb trước nhé

https://notes.nimtechnology.com/2021/07/04/ingress-nginx-install-ingress-nginx-tren-k8s-bang-helm/
Tham khảo bài này để cài mettallb

2.7) apply istio-primary to k8s and recheck log

giờ apply file /root/mutil-cluster-istio-diff-net/istio-primary/istio-primary-cluster1-1.9.8.yaml

Lưu ý ở bước này apply mà istiod ok mà istio-ingressgateway bị lỗi vào báo CA root j đó thì bạn cần xoá hết istio-primary và chạy lại câu lệnh gen cert ca và xoá tạo lại secret khách nhé

Giờ view log của 2 thanh niên:

Log của istiod như này ok
istio-ingressgateway như này là ok

2.7.1) injected istio into workloads

Giờ thử deploy 1 app trên 1 namespace”default” xem nó auto inject sidecar isito ko?

kubectl label namespace default istio-injection=enabled --overwrite
Như này là ngon rồi nhé

3) Install east-west gateway components in cluster1

3.1) east-west gateway

cài đặt east-west gateway in cluster1

cd /root/mutil-cluster-istio-diff-net/
mkdir eastwest-gateway-cluster1

>>>gen file operator cho eastwest-gateway
----
bash /root/mutil-cluster-istio-diff-net/istio-1.9.8/samples/multicluster/gen-eastwest-gateway.sh \
--mesh mesh1 --cluster cluster1 --network network1 \
> /root/mutil-cluster-istio-diff-net/istio-eastwest-gateway-operator-1.9.8-default.yaml

gen file operator xong thì gen file manifest

/root/mutil-cluster-istio-diff-net/istio-1.9.8/bin/istioctl manifest generate \
-f /root/mutil-cluster-istio-diff-net/istio-eastwest-gateway-operator-1.9.8-c1-p-default.yaml \
> /root/mutil-cluster-istio-diff-net/eastwest-gateway-cluster1/istio-eastwest-gateway-1.9.8-c1-p.yaml

Giờ bạn apply istio-eastwest-gateway-1.9.8.yaml ở primary nhé

Như này là ok
Để ý ip này của eastwest cluster 1 nhé

3.2) Expose the control plane in cluster1

Copy file có sẵn gateway và virtualservice

cp /root/mutil-cluster-istio-diff-net/istio-1.9.8/samples/multicluster/expose-istiod.yaml \
/root/mutil-cluster-istio-diff-net/eastwest-gateway-cluster1/

Giờ apply nó

Expose services in cluster1

cp /root/mutil-cluster-istio-diff-net/istio-1.9.8/samples/multicluster/expose-services.yaml \
/root/mutil-cluster-istio-diff-net/eastwest-gateway-cluster1/

Set the default network for cluster2

kubectl --context=k0s-cluster2 create ns istio-system
kubectl --context=k0s-cluster2 get namespace istio-system && \
  kubectl --context=k0s-cluster2 label namespace istio-system topology.istio.io/network=network2

3.3 istio remote secret cluster2

Enable API Server Access to cluster2 –> cái này apply bên cluster 1 nhé

/root/mutil-cluster-istio/istio-1.9.8/bin/istioctl x create-remote-secret \
    --context=k0s-cluster2 \
    --name=cluster2 > /root/mutil-cluster-istio-diff-net/eastwest-gateway-cluster1/istio-remote-secret-cluster2.yaml

sau khi apply xong chúng ta quan sat log của istiod sẽ thấy nó add cluster2

Theo doi thêm lúc nữa nếu ko thây log error là ổn

Nếu bạn cho cluster1 access api của cluster2 và thông qua rancher thì coi hướng dẫn trong bài viết ở dưới mình lười viết lại quá

https://notes.nimtechnology.com/2021/08/26/istio-multi-cluster-install-multi-cluster-istio-with-mode-primary-remote/

Configure cluster2 as a remote

root@work-space-u20:~/mutil-cluster-istio-diff-net# export DISCOVERY_ADDRESS=$(kubectl \
>     --context=local \
>     -n istio-system get svc istio-eastwestgateway \
>     -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
root@work-space-u20:~/mutil-cluster-istio-diff-net# 
root@work-space-u20:~/mutil-cluster-istio-diff-net# 
root@work-space-u20:~/mutil-cluster-istio-diff-net# 
root@work-space-u20:~/mutil-cluster-istio-diff-net# echo $DISCOVERY_ADDRESS
192.168.101.222
root@work-space-u20:~/mutil-cluster-istio-diff-net#

TRên là cách lấy IP LB của istio-eastwestgateway cluster1

4) The acctions on Istio remote cluster (cluster 2).

4.1) Create namespace.

kubectl --context=k0s-cluster2 create ns istio-system
kubectl --context=k0s-cluster2 get namespace istio-system &amp;&amp; \
  kubectl --context=k0s-cluster2 label namespace istio-system topology.istio.io/network=network2

4.2) create manifest istio remote

Giờ dump file operator cho cluster2 remote

/root/mutil-cluster-istio-diff-net/istio-1.9.8/bin/istioctl profile dump remote \
> /root/mutil-cluster-istio-diff-net/istio-operator-1.9.8-cluster2-remote.yaml

giờ sửa file operator

Giờ gen file manifest

mkdir istio-remote
/root/mutil-cluster-istio-diff-net/istio-1.9.8/bin/istioctl manifest generate \
-f /root/mutil-cluster-istio-diff-net/istio-operator-1.9.8-cluster2-remote.yaml \
> /root/mutil-cluster-istio-diff-net/istio-remote/istio-remote-cluster2-1.9.8.yaml

4.3) Recheck Loadbalancer

Giờ bạn cần cài metallb nhé

4.4) Apply cacert inside secret on k8s

rồi create secret ca certs cho cluster 2 – remote nhé

cd /root/mutil-cluster-istio-diff-net/istio-1.9.8/tools/certs/

kubectl create secret generic cacerts -n istio-system --context=k0s-cluster2 \
      --from-file=nimtechnology/ca-cert.pem \
      --from-file=nimtechnology/ca-key.pem \
      --from-file=nimtechnology/root-cert.pem \
      --from-file=nimtechnology/cert-chain.pem

4.5) apply istio-primary to k8s and recheck log

Giờ apply file istio-remote-cluster2-1.9.8.yaml

Nếu istio-ingressgateway thì thấy lỗi này

đầu tiên thì bạn cứ xoá istio-ingressgateway vài lần sem còn lỗi ko?
nếu không được nữa làm cách dưới.

thì bạn xoá cacerts xoá istio-remote và cài lại nhé.

Nếu mọi thứ OK ntn và bạn ko thấy log error chuyển qua phần test nhé

5) Install east-west gateway components in cluster2

Ở phần này mình lười quá bên bạn tham khảo mục 3
3.1) east-west gateway
làm tương tự chúng ta ko gen secret remote he.

6) Verifying Cross-Cluster Traffic

Hướng dẫn check nè dễ lắm
https://istio.io/latest/docs/setup/install/multicluster/verify/

while true; do curl -sS helloworld.sample:5000/hello; echo; sleep 0.5; done

Mô tả đơn giản:

create namespace “sample trên cả 2 cluster” và namespaces đó đã được đánh label “istio-injection=enabled“

Trên các namespace giống nhau đó bạn cài các workload giống nhau thì loadbalancer giữ các workload giống nhau giữa 2 cluster.

Nếu bạn cài kiali bạn sẽ thấy là nó thấy sleep ở cluster2 đang call hello cluster1
Bạn có thể tham khảo bài viết bên dưới nhé!
Multicluster Traffic Mirroring with Istio and Kind
Isito-EnvoyFilter, Kubernetes & Container

Post navigation

Previous Post: [Harbor] Cấu hình Proxy Cache <- Docker Hub trên Harbor.
Next Post: [Kaniko/Jenkins] Install Jenkins through helm and build/deploy app in K8s by Kaniko

More Related Articles

[Datree] Admission Controllers Or CLI? Kubernetes Policy Validations with Datree Kubernetes & Container
[Istio/multi cluster] Install multi-cluster Istio with mode “Primary-Remote” for Kubernetes on Google Cloud Platform. Isito-EnvoyFilter
[Oauth2-Proxy] Protect any of your websites on Kubernetes by Oauth2-Proxy Kubernetes & Container
[git-sync] an auto simple that pulls a git repository into a container on Kubernetes Git
[Oauth2-Proxy] Oauth2-Proxy encounters issue with Cognito Kubernetes & Container
[Kubernetes] Discovering the strategy deployment on K8s Kubernetes & Container

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Azure] The subscription is not registered to use namespace ‘Microsoft.ContainerService’ May 8, 2025
  • [Azure] Insufficient regional vcpu quota left May 8, 2025
  • [WordPress] How to add a Dynamic watermark on WordPress. May 6, 2025
  • [vnet/Azure] VNet provisioning via Terraform. April 28, 2025
  • [tracetcp] How to perform a tracert command using a specific port. April 3, 2025

Archives

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.