Skip to content

Instantly share code, notes, and snippets.

@nsmith5
Last active June 23, 2020 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nsmith5/a0a1130c7e23ff075ced2cc74afc59a8 to your computer and use it in GitHub Desktop.
Save nsmith5/a0a1130c7e23ff075ced2cc74afc59a8 to your computer and use it in GitHub Desktop.
Kubeadm + Containerd + Flannel + Fedora
# Steps to bring up kubeadm + containerd on Fedora 29
# First up, install containerd + containernetworking-plugins
dnf install containerd containernetworking-plugins crictl
# Set up CNI configuration
mkdir -p /etc/cni/net.d
cat >/etc/cni/net.d/10-mynet.conf <<EOF
{
"cniVersion": "0.2.0",
"name": "mynet",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.22.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
}
EOF
$ cat >/etc/cni/net.d/99-loopback.conf <<EOF
{
"cniVersion": "0.2.0",
"name": "lo",
"type": "loopback"
}
EOF
# Start (and enable on boot) containerd
systemctl enable --now containerd
# Next install kubelet, kubeadm, kubectl from upstream
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kube*
EOF
# Set SELinux in permissive mode (effectively disabling it)
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
dnf install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable --now kubelet
# Next, enable bridge stuff in the kernel? This is wierd and wasn't necessary before recently I think
modprobe br_netfilter
cat <<EOF >/etc/modules-load.d/br_netfilter
br_netfilter
EOF
# Then to the normal sysctl bridge configuration stuff
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
# Ok we're all ready to gooo
# Start up the master node
kubeadm init --apiserver-advertise-address 10.0.0.1 --cri-socket unix:///run/containerd/containerd.sock --pod-network-cidr=10.244.0.0/16
# Rinse and repeat on other nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment