Cilium安裝要求


系統要求

  1. 操作系統要求,內核版本 Linux kernel >= 4.9.17
  2. 如果是獨立安裝在裸OS上(不是使用官方的cilium/cilium鏡像),需要滿足
  3. 如果不在Kubernetes環境下使用Cilium的話,需要滿足 

總結如下

Requirement
Minimum Version
In cilium container
Linux kernel >= 4.9.17 no
Key-Value store (etcd) >= 3.1.0 no
Key-Value store (consul) >= 0.6.4 no
clang+LLVM >= 10.0 yes
iproute2 >= 5.0.0 [1] yes

注意

如果系統Systemd 245 或者大於245的版本(systemctl --version)會覆蓋Cilium網絡接口的rp_filter配置,需要使用以下命令糾正

echo 'net.ipv4.conf.lxc*.rp_filter = 0' > /etc/sysctl.d/99-override_cilium_rp_filter.conf
systemctl restart systemd-sysctl

內核參數要求說明

https://docs.cilium.io/en/v1.9/operations/system_requirements/#linux-kernel

clang+LLVM

如果使用原生的cilium-agent那么需要安裝clang+LLVM,如果是使用官方的cilium容器鏡像的話, 那么不需要安裝這二個組件,因為鏡像自帶LLVM編譯器

LLVM是Cilium用來生成eBPF程序並加載到內核中的編譯器套件,Cilium要求LLVM的最低版本高於5.0

iproute2

如果Cilium-agent直接運行在裸OS上,需要安裝,否則使用官方cilium/cilium窗口鏡像

iproute2是一個相對低層的工具,用來配置內核相關的各種網絡子系統

Firewall下使用Cilium的規則

Master Nodes (master-sg) Rules:

Port Range / Protocol
Ingress/Egress
Source/Destination
Description
2379-2380/tcp ingress worker-sg etcd access
8472/udp ingress master-sg (self) VXLAN overlay
8472/udp ingress worker-sg VXLAN overlay
4240/tcp ingress master-sg (self) health checks
4240/tcp ingress worker-sg health checks
ICMP 8/0 ingress master-sg (self) health checks
ICMP 8/0 ingress worker-sg health checks
8472/udp egress master-sg (self) VXLAN overlay
8472/udp egress worker-sg VXLAN overlay
4240/tcp egress master-sg (self) health checks
4240/tcp egress worker-sg health checks
ICMP 8/0 egress master-sg (self) health checks
ICMP 8/0 egress worker-sg health checks

Worker Nodes (worker-sg):

Port Range / Protocol
Ingress/Egress
Source/Destination
Description
8472/udp ingress master-sg VXLAN overlay
8472/udp ingress worker-sg (self) VXLAN overlay
4240/tcp ingress master-sg health checks
4240/tcp ingress worker-sg (self) health checks
ICMP 8/0 ingress master-sg health checks
ICMP 8/0 ingress worker-sg (self) health checks
8472/udp egress master-sg VXLAN overlay
8472/udp egress worker-sg (self) VXLAN overlay
4240/tcp egress master-sg health checks
4240/tcp egress worker-sg (self) health checks
ICMP 8/0 egress master-sg health checks
ICMP 8/0 egress worker-sg (self) health checks
2379-2380/tcp egress master-sg etcd access

 如果Master node & work node 共用一個SG時,可以簡化一些入口/出口規則,如果使用DR模式的話,直接開一條ANY Port/Any Protocol

Port Range / Protocol
Description
4240/tcp cluster health checks (cilium-health)
4244/tcp Hubble server
4245/tcp Hubble Relay
6942/tcp operator Prometheus metrics
9090/tcp cilium-agent Prometheus metrics
9876/tcp cilium-agent health status API
9890/tcp cilium-agent gops server (listening on 127.0.0.1)
9891/tcp operator gops server (listening on 127.0.0.1)
9892/tcp clustermesh-apiserver gops server (listening on 127.0.0.1)
9893/tcp Hubble Relay gops server (listening on 127.0.0.1)

 掛載eBPF文件系統

掛載eBPF文件,在生產環境是必須的,目的作用是在cilium-agent在重啟時,eBPF的資源被持久到文件系統中,以確保保持Pod正常訪問

如果沒有被主動掛載,cilium會自動掛載;但是在cilium-agent重啟時會自動掛載同時也會自動卸載,此時什么影響正在運行的Pod的網絡通信問題

掛載命令,如下

mount bpffs /sys/fs/bpf -t bpf

提供二種方式(啟動自動掛載)

  1. 使用/etc/fstab
    bpffs                      /sys/fs/bpf             bpf     defaults 0 0
  2. 使用systemd

    cat <<EOF | sudo tee /etc/systemd/system/sys-fs-bpf.mount
    [Unit]
    Description=Cilium BPF mounts
    Documentation=https://docs.cilium.io/
    DefaultDependencies=no
    Before=local-fs.target umount.target
    After=swap.target
     
    [Mount]
    What=bpffs
    Where=/sys/fs/bpf
    Type=bpf
    Options=rw,nosuid,nodev,noexec,relatime,mode=700
     
    [Install]
    WantedBy=multi-user.target
    EOF

Privileges

如果Cilium運行在標准的Kubernetes DaemonSet下,Privilege自動賦權給Cilium,如果不是可通過以下方式

  1. 為cilium-agent 賦權CAP_SYS_ADMIN
  2. 使用rootf運行cilium-agent並指定privileged為容器
  3. 要么運行在host network namesapce,就是不進行網絡隔離


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM