Skip to content

Instantly share code, notes, and snippets.

@tarlan-huseynov
Created May 4, 2022 04:23
Show Gist options
  • Select an option

  • Save tarlan-huseynov/f288950d0898083ecdc44b250a45a76f to your computer and use it in GitHub Desktop.

Select an option

Save tarlan-huseynov/f288950d0898083ecdc44b250a45a76f to your computer and use it in GitHub Desktop.

Revisions

  1. tarlan-huseynov renamed this gist May 4, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. tarlan-huseynov created this gist May 4, 2022.
    31 changes: 31 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    .PHONY: all setup init join cni reset uninstall
    kv ?= 1.22.4-00
    dv ?= 5:20.10.14~3-0~ubuntu-jammy
    ha ?= 'false'
    cpe ?= none
    aaa ?= none

    all: init cni

    setup:
    @bash kubesetup --docker-version ${dv} --kube-version ${kv} -i

    init: setup
    @if [ ${ha} != 'true' ];then kubeadm init;else kubeadm init --control-plane-endpoint=${cpe} --upload-certs --apiserver-advertise-address=${aaa}; fi
    @echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bashrc
    @source ~/.bashrc

    join:
    @kubeadm join ${cpe} --token ${token} --discovery-token-ca-cert-hash sha256:${hash}

    cni:
    @curl -O https://projectcalico.docs.tigera.io/manifests/calico.yaml
    @kubectl apply -f calico.yaml

    reset:
    @kubeadm reset
    @sed '/KUBECONFIG/d' ~/.bashrc
    @rm -rf /etc/cni

    uninstall: reset
    @bash kubesetup -rm