Konfigurasi Mode VXLAN pada Calico Kubernetes

Issue

Saat pertama kali setup kubernetes dengan calico network, muncul permasalahan load balancer dengan ingress tidak berfungsi sehingga trafik tidak terdistribusi ke semua pods pada node lain dan hanya terhubung ke node yang terdapat ingress nginx controller.

Jika dicek pada log ingress controller mendapati beberapa kali connection timeout ke tujuan network pod pada node lain.

2023/07/30 08:38:05 [error] 98#98: *96486 upstream timed out (110: Operation timed out) while connecting to upstream, client: 192.168.12.72, server: web8.srv1.de, request: "GET / HTTP/1.1", upstream: "http://10.10.80.209:80/", host: "web8.srv1.de"
2023/07/30 08:38:10 [error] 98#98: *96486 upstream timed out (110: Operation timed out) while connecting to upstream, client: 192.168.12.72, server: web8.srv1.de, request: "GET / HTTP/1.1", upstream: "http://10.10.80.210:80/", host: "web8.srv1.de"

Solution

Setelah penelusuran baru diketahui jika konfigurasi saat pertama men-deploy calico mode yang digunakan tidak VXLAN melainkan IPIP sehingga terdapat rute blackhole pada network pods yang dialokasikan pada setiap node.

Berikut cara untuk mengubah mode menjadi VXLAN.

Edit konfigurasi IPPool

kubectl edit ippools/default-ipv4-ippool

Selanjutnya ubah ipipMode menjadi Never dan vxlanMode menjadi Always

spec:
  allowedUses:
  - Workload
  - Tunnel
  blockSize: 26
  cidr: 10.10.0.0/16
  ipipMode: Never
  natOutgoing: true
  nodeSelector: all()
  vxlanMode: Always

Simpan konfigurasi lalu jalankan perintah berikut pada semua node yang ada di kluster kubernetes untuk me-restart pods.

crictl stop $(crictl ps --name calico* -q)

Tunggu beberapa saat sampai pods dibuat lagi secara otomatis.

Atau Anda dapat reboot semua node.