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,就是不进行网络隔离
原文地址:https://www.cnblogs.com/apink/p/15172328.html