Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (38 sloc) 1.8 KB
- name: Install Runtime Docker CE
name: install-docker-ce
- name: Create a single k8s master cluster by kubeadm
cmd: |
set -x
set -e
# Installing kubeadm, kubelet and kubectl.
apt-get update && apt-get install -y apt-transport-https curl
curl -s | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb kubernetes-xenial main
apt-get update
if [[ "{{ kubernetes_version }}" == "latest" ]]; then
apt-get install -y kubelet kubeadm kubectl
install_version=$(apt-cache madison kubelet |grep "{{ kubernetes_version }}" | head -n 1 | awk '{print $3}')
apt-get install -y kubelet=$install_version kubeadm=$install_version kubectl=$install_version
kubelet --version
apt-mark hold kubelet kubeadm kubectl
# Creating a single master cluster with kubeadm:
## to avoid coredns crashloopbackoff, we set nameserver to instead of
cat /etc/resolv.conf
sed -i 's/nameserver' /etc/resolv.conf
cat /etc/resolv.conf
## Initializing master
sysctl net.bridge.bridge-nf-call-iptables=1
kubeadm init --pod-network-cidr= --kubernetes-version="{{ kubernetes_version }}"
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
## Installing a pod network add-on.
kubectl apply -f
# make sure we can schedule pods on the master.
kubectl taint nodes --all
executable: /bin/bash
You can’t perform that action at this time.