Notes Kubernetes k8s - Install Node

Prérequis

Prérequis :

Unique mac addresses et /sys/class/dmi/id/product_uuid

Pas de swap

Debian

Voir :

https://cyril.deguet.com/fr/2018/02/12/kubernetes-debian-vps/

https://www.digitalocean.com/community/tutorials/how-to-create-a-kubernetes-cluster-using-kubeadm-on-debian-9

https://gist.github.com/apokalyptik/99cefb3d2e16b9b0c3141e222f3267db

https://www.server-world.info/en/note?os=Debian_10&p=kubernetes&f=3

https://www.nuxeo.com/fr/blog/installing-kubernetes-moving-from-physical-servers-to-containers/

Generic all Debians

# generic apt-get install -y yq vim atop tmux sudo # for apt-get apt-get install -y apt-transport-https ca-certificates curl gpg

A faire :

Changer hostname

Mettre à jour /etc/hosts

Copier la clef SSH ssh-copy-id

@ip /etc/network/interfaces.d/vlan100 ou netplan

apt-get install apt-get install network-manager

/etc/netplan/00-network-manager.yaml

network: version: 2 renderer: NetworkManager

Netplan avec NetworkManager bug -- Solution :

apt-get purge '*netplan*' systemctl disable --now systemd-networkd.service
chmod 600 /etc/netplan/00-network-manager.yaml netplan try netplan apply --debug netplan apply nmcli connection add con-name vlan100 ifname enp7s0 type ethernet ip4 192.168.100.21/24 nmcli connection up vlan100 hostnamectl hostname vmdeb01 #echo -e "$(hostname -I | awk '{print $2}')\t\t$(hostname)" >> /etc/hosts echo "192.168.100.21 vmdeb01.local vmdeb01" >> /etc/hosts echo "192.168.100.22 vmdeb02.local vmdeb02" >> /etc/hosts apt-get install openssh-server adduser admin echo "admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/admin
# sysctl params required by setup, params persist across reboots cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.ipv4.ip_forward = 1 EOF # Apply sysctl params without reboot sudo sysctl --system

Vérif

sysctl net.ipv4.ip_forward

Source : https://kubernetes.io/docs/setup/production-environment/container-runtimes/#cgroup-drivers

Autres

Vim comme éditeur par défaut

update-alternatives --set editor /usr/bin/vim.basic

Old - conf Docker

groupadd -g 500000 dockremap groupadd -g 501000 dockremap-user useradd -u 500000 -g dockremap -s /bin/false dockremap useradd -u 501000 -g dockremap-user -s /bin/false dockremap-user echo "dockremap:500000:65536" >> /etc/subuid echo "dockremap:500000:65536" >> /etc/subgid

/etc/docker/daemon.json

{ "userns-remap": "default" }

Old

/etc/docker/daemon.json

{ "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2" }
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy sudo update-alternatives --set arptables /usr/sbin/arptables-legacy sudo update-alternatives --set ebtables /usr/sbin/ebtables-legacy
systemctl restart docker.service