Skip to content

Instantly share code, notes, and snippets.

@tarlan-huseynov
Created May 4, 2022 04:23
Show Gist options
  • Save tarlan-huseynov/f288950d0898083ecdc44b250a45a76f to your computer and use it in GitHub Desktop.
Save tarlan-huseynov/f288950d0898083ecdc44b250a45a76f to your computer and use it in GitHub Desktop.
makefile for kube init
.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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment