Last active
November 5, 2018 17:56
-
-
Save krsna1729/31c2627ad6294509eb70d5f567cf6800 to your computer and use it in GitHub Desktop.
install kubernetes with containerd. no docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
set -o pipefail | |
echo "Pre-reqs" | |
sudo apt-get -y install wget | |
sudo modprobe br_netfilter | |
sudo swapoff -a | |
VERSION="1.1.4" | |
echo "Install Containerd ${VERSION}" | |
wget -q https://storage.googleapis.com/cri-containerd-release/cri-containerd-${VERSION}.linux-amd64.tar.gz | |
sudo tar --no-overwrite-dir -C / -xzf cri-containerd-${VERSION}.linux-amd64.tar.gz | |
sudo systemctl enable --now containerd | |
echo "Install k8s binaries" | |
sudo apt-get update && sudo apt-get install -y apt-transport-https | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
deb http://apt.kubernetes.io/ kubernetes-xenial main | |
EOF | |
sudo apt-get update && sudo apt-get install -y kubelet=1.10.* kubeadm=1.10.* kubectl=1.10.* | |
echo "Setup Kubelet" | |
cat <<EOF | sudo tee /etc/systemd/system/kubelet.service.d/0-containerd.conf | |
[Service] | |
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock" | |
EOF | |
sudo systemctl daemon-reload && sudo systemctl enable kubelet && sudo systemctl start kubelet | |
echo "Init k8s Cluster" | |
sudo kubeadm init --pod-network-cidr 10.244.0.0/16 --kubernetes-version stable-1.10 --cri-socket="unix:///run/containerd/containerd.sock" --ignore-preflight-errors="Service-Docker" | |
echo "Setup k8s Credentials" | |
echo 'export KUBECONFIG="/etc/kubernetes/admin.conf"' | sudo tee -a /etc/profile | |
source /etc/profile | |
sudo chown $(id -u):$(id -g) /etc/kubernetes/admin.conf | |
echo "Install Calico CNI" | |
kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml | |
CALICO_CONF=/etc/cni/net.d/10-calico.conf | |
while [ ! -f ${CALICO_CONF} ]; do echo "Waiting for Calico"; sleep 2; done | |
while [[ ! $(kubectl get pods -n kube-system -l k8s-app=kube-dns | awk 'FNR == 2 {print $2}') = "3/3" ]]; | |
do echo "Waiting for kube-dns"; sleep 2; done | |
echo "Untaint the Master" | |
kubectl taint nodes $(hostname) node-role.kubernetes.io/master:NoSchedule- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment