Created
          May 4, 2022 04:23 
        
      - 
      
 - 
        
Save tarlan-huseynov/f288950d0898083ecdc44b250a45a76f to your computer and use it in GitHub Desktop.  
    makefile for kube init
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | .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