Skip to content

Instantly share code, notes, and snippets.

@marijus-ravickas
Last active October 28, 2019 14:18
Show Gist options
  • Save marijus-ravickas/56590f60ae232aaa8256b0069dd8cf39 to your computer and use it in GitHub Desktop.
Save marijus-ravickas/56590f60ae232aaa8256b0069dd8cf39 to your computer and use it in GitHub Desktop.
k8s 1.16.2 install with containerd on Centos7

Prepare OS

yum update -y && yum install -y unzip tar btrfs-progs libseccomp socat util-linux curl wget

install containerd and runc

wget https://github.com/containerd/containerd/releases/download/v1.3.0/containerd-1.3.0.linux-amd64.tar.gz && tar xf containerd-1.3.0.linux-amd64.tar.gz -C /usr/local

wget -O /usr/local/sbin/runc https://github.com/opencontainers/runc/releases/download/v1.0.0-rc8/runc.amd64 && chmod 755 /usr/local/sbin/runc

containerd --version && runc --version

Fix snapshoter for containerd

mkdir /etc/containerd

cat <<EOF > /etc/containerd/config.toml [plugins.cri.containerd] snapshotter = "native" EOF

Install systemd service for containerd

curl -o /etc/systemd/system/containerd.service https://raw.githubusercontent.com/containerd/cri/master/contrib/systemd-units/containerd.service systemctl daemon-reload systemctl enable containerd systemctl start containerd systemctl status containerd

Add k8s yum repo

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 EOF

Installing k8s

yum install -y cri-tools ebtables ethtool kubeadm kubectl kubelet kubernetes-cni

Prerequisites befor init k8s

systemctl enable kubelet.service kubeadm config images pull modprobe br_netfilter sysctl net.bridge.bridge-nf-call-iptables=1 sysctl net.ipv4.ip_forward=1 swapoff -a

fix selinux

yum install container-selinux

Init k8s

kubeadm init --ignore-preflight-errors=all --cri-socket /run/containerd/containerd.sock --pod-network-cidr=192.168.0.0/16

Make kubectl config

mkdir -p $HOME/.kube cp -i /etc/kubernetes/admin.conf $HOME/.kube/config chown $(id -u):$(id -g) $HOME/.kube/config

Fix network layer

kubectl apply -f \ https://docs.projectcalico.org/v3.10/manifests/calico.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment