Skip to content

Instantly share code, notes, and snippets.

@xuyuji9000
Last active November 1, 2017 02:22
Show Gist options
  • Save xuyuji9000/53c4c118908f0f262fafb4fe04aca7be to your computer and use it in GitHub Desktop.
Save xuyuji9000/53c4c118908f0f262fafb4fe04aca7be to your computer and use it in GitHub Desktop.
#!/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
@xuyuji9000
Copy link
Author

xuyuji9000 commented Oct 14, 2017

build up the image

curl -s https://gist.githubusercontent.com/xuyuji9000/53c4c118908f0f262fafb4fe04aca7be/raw/baa18c59fc61f4af6e94f0c048dae2fb4e04938b/ubuntu-1604-install-kubeadm-with-docker.sh | bash

@xuyuji9000
Copy link
Author

xuyuji9000 commented Oct 15, 2017

  1. init for calico

    kubeadm init --pod-network-cidr=192.168.0.0/16
  2. init for flannel

    kubeadm init --pod-network-cidr=10.244.0.0/16

@xuyuji9000
Copy link
Author

xuyuji9000 commented Oct 15, 2017

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

@xuyuji9000
Copy link
Author

xuyuji9000 commented Oct 15, 2017

  1. apply calico

    kubectl apply -f \
    https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml
  2. apply flannel

    kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.0/Documentation/kube-flannel.yml

Reference

  1. Quickstart for Calico on Kubernetes

@xuyuji9000
Copy link
Author

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