Cilium 마이그레이션
https://docs.cilium.io/en/stable/installation/k8s-install-migration/
Cilium은 다른 CNI (ex- Flannel)에서 마이그레이션 하는 기능을 제공한다. (마이그레이션 공식 가이드 참조)
진행 전 확인사항
기존 CNI 설정을 Cilium으로 변경
kubelet은 새로운 pod 생성 시 /etc/cni/net.d/ 에 있는 CNI 설정을 따른다. 이 설정을 cilium으로 변경하면 새로 생성되는 pod들에 대해서는 cilium CNI를 사용한다. node의 CNI 설정을 변경 후 node를 재시작하면 pod의 CNI 설정이 변경되지만, 재시작 시간동안 장애가 발생할 수 있기 때문에 cilium에서는 듀얼 오버레이 방식을 사용한다.
요구사항
- A new, distinct Cluster CIDR for Cilium to use
- Use of the Cluster Pool IPAM mode
- A distinct overlay, either protocol or port
- An existing network plugin that uses the Linux routing stack, such as Flannel, Calico, or AWS-CNI
제약사항
- BGP-based routing
- Changing IP families (e.g. from IPv4 to IPv6)
- Migrating from Cilium in chained mode
- An existing NetworkPolicy provider
마이그레이션 진행
현재 사용중인 pod IP 대역 출력
kubectl -n kube-system describe pod kube-controller-manager-k8s-ctr | grep '\--cluster-cidr'
--cluster-cidr=10.244.0.0/16
새로운 ip 대역 10.245.0.0/16 을 지정 (요구사항 1번)
values-migration.yaml 작성
operator:
unmanagedPodWatcher:
restart: false # Migration: Don't restart unmigrated pods
routingMode: tunnel # Migration: Optional: default is tunneling, configure as needed
tunnelProtocol: vxlan # Migration: Optional: default is VXLAN, configure as needed
tunnelPort: 8473 # Migration: Optional, change only if both networks use the same port by default
cni:
customConf: true # Migration: Don't install a CNI configuration file
uninstall: false # Migration: Don't remove CNI configuration on shutdown
ipam:
mode: "cluster-pool"
operator:
clusterPoolIPv4PodCIDRList: ["10.245.0.0/16"] # Migration: Ensure this is distinct and unused
policyEnforcementMode: "never" # Migration: Disable policy enforcement
bpf:
hostLegacyRouting: true # Migration: Allow for routing between Cilium and the existing overlay
install cilium using helm
cilium cli 설치 필수
$ helm repo add cilium https://helm.cilium.io/
$ helm install cilium cilium/cilium --namespace kube-system --values values-initial.yaml
상태 확인
cilium을 설치한다고 모든 Pod의 CNI 가 변경되지 않는다.
cilium status --wait
노드 지정
cat <<EOF | kubectl apply --server-side -f -
apiVersion: cilium.io/v2
kind: CiliumNodeConfig
metadata:
namespace: kube-system
name: cilium-default
spec:
nodeSelector:
matchLabels:
io.cilium.migration/cilium-default: "true"
defaults:
write-cni-conf-when-ready: /host/etc/cni/net.d/05-cilium.conflist
custom-cni-conf: "false"
cni-chaining-mode: "none"
cni-exclusive: "true"
EOF
노드 출력, 지정 및 마이그레이션
kubectl get nodes
NODE="k8s-w2"
kubectl cordon $NODE
kubectl drain --ignore-daemonsets $NODE
cilium / Node 재시작
kubectl label node $NODE --overwrite "io.cilium.migration/cilium-default=true"
kubectl -n kube-system delete pod --field-selector spec.nodeName=$NODE -l k8s-app=cilium
kubectl -n kube-system rollout status ds/cilium -w
마이그레이션 확인
cilium status --wait
kubectl get -o wide node $NODE
kubectl -n kube-system run --attach --rm --restart=Never verify-network \
--overrides='{"spec": {"nodeName": "'$NODE'", "tolerations": [{"operator": "Exists"}]}}' \
--image ghcr.io/nicolaka/netshoot:v0.8 -- /bin/bash -c 'ip -br addr && curl -s -k https://$KUBERNETES_SERVICE_HOST/healthz && echo'
노드 경계 해제
kubectl uncordon $NODE
마이그레이션 후 확인

이전 네트워크 플러그인 삭제
'DevOps > cilium' 카테고리의 다른 글
| [Cilium study] IPAM 모드 (2) | 2025.07.31 |
|---|---|
| [Cilium study] Loki 스택 기반 중앙 로깅 시스템 구성 (4) | 2025.07.27 |
| [Cilium Study] Network Observability with Hubble (3) | 2025.07.27 |
| Cillium 시스템 요구사항 점검 자동화 (1) | 2025.07.20 |
| Kubeadm Configuration 을 사용하여 node ip 지정 (0) | 2025.07.20 |