Last active
November 1, 2017 02:22
-
-
Save xuyuji9000/53c4c118908f0f262fafb4fe04aca7be to your computer and use it in GitHub Desktop.
This file contains 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 | |
# install docker | |
apt update | |
apt install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
apt-key fingerprint 0EBFCD88 | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
apt update | |
apt install docker-ce -y | |
curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
usermod -aG docker $USER | |
# install kubeadm | |
apt update && apt install ebtables ethtool -y | |
apt update && apt install -y apt-transport-https | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list | |
deb http://apt.kubernetes.io/ kubernetes-xenial main | |
EOF | |
apt update && apt install -y kubelet kubeadm kubectl |
-
init for calico
kubeadm init --pod-network-cidr=192.168.0.0/16
-
init for flannel
kubeadm init --pod-network-cidr=10.244.0.0/16
connect cluster with kubectl
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
-
apply calico
kubectl apply -f \ https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml
-
apply flannel
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.0/Documentation/kube-flannel.yml
Reference
make the master can host pods
kubectl taint nodes --all node-role.kubernetes.io/master-
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
build up the image
curl -s https://gist.githubusercontent.com/xuyuji9000/53c4c118908f0f262fafb4fe04aca7be/raw/baa18c59fc61f4af6e94f0c048dae2fb4e04938b/ubuntu-1604-install-kubeadm-with-docker.sh | bash