Mémo pour corriger l’erreur « /proc/sys/net/bridge/bridge-nf-call-iptables does not exist ».
Le problème
Lors de l’exécution de cette commande pour initialiser le serveur Kubernetes master dans un container LXC/LXD, j’ai eu une belle erreur :
1 |
command kubeadm init --apiserver-advertise-address=192.168.56.101 --node-name $HOSTNAME --pod-network-cidr=10.244.0.0/16 |
Résultat :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[init] Using Kubernetes version: v1.22.2 [preflight] Running pre-flight checks [preflight] The system verification failed. Printing the output from the verification: KERNEL_VERSION: 5.4.0-88-generic DOCKER_VERSION: 20.10.9 DOCKER_GRAPH_DRIVER: vfs OS: Linux CGROUPS_CPU: enabled CGROUPS_CPUACCT: enabled CGROUPS_CPUSET: enabled CGROUPS_DEVICES: enabled CGROUPS_FREEZER: enabled CGROUPS_MEMORY: enabled CGROUPS_PIDS: enabled CGROUPS_HUGETLB: enabled error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables does not exist [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher |
Solution
Editer le profile par défaut de Kubernetes et rajouter la configuration « linux.kernel_modules: br_netfilter » dans la partie config :
1 |
command lxc profile edit default |
Mon profile default à adapter :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
config: linux.kernel_modules: br_netfilter description: Default LXD profile devices: eth0: name: eth0 network: lxdbr0 type: nic root: path: / pool: default type: disk name: default used_by: - /1.0/instances/kubmaster - /1.0/instances/kubnode |
Source : https://askubuntu.com/a/821872