#!/bin/sh
# https://www.gnu.org/licenses/gpl-3.0.txt

# https://projectcalico.docs.tigera.io/getting-started/kubernetes/quickstart

sudo kubeadm init --pod-network-cidr=192.168.0.0/16 && \
  (
    mkdir -p $HOME/.kube; \
    sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config && \
    sudo chown $(id -u):$(id -g) $HOME/.kube/config \
  ) && \
  echo && echo && echo && \
  kubectl apply -f https://hej.hu/install/calico/tigera-operator.yaml && \
  kubectl apply -f https://hej.hu/install/calico/custom-resources.yaml && \
  sleep 10 && \
  kubectl get pods -n calico-system && \
  echo "Kubernetes and Calico CNI successfully started." && \
  echo "Kubectl configured." &&\
  echo "You can add more nodes with the kubeadm join command above."

kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl get nodes
