Skip to content
Snippets Groups Projects

Draft: Makefile: Add all commands to deploy the kubernetes controlplane

Merged Sheogorath requested to merge feature/deploy-kubernetes into main
1 file
+ 9
9
Compare changes
  • Side-by-side
  • Inline
+ 9
9
.PHONY: kubeadm-init
.PHONY: kubeadm-init
kubeadm-init:
kubeadm-init:
ssh node01.$(TF_VAR_dns_domain) kubeadm init --control-plane-endpoint "api.$(TF_VAR_dns_domain):6443" --upload-certs --pod-network-cidr "192.168.0.0/16"
ssh cp01.$(TF_VAR_dns_domain) kubeadm init --control-plane-endpoint "api.$(TF_VAR_dns_domain):6443" --upload-certs --pod-network-cidr "192.168.0.0/16"
ssh node01.$(TF_VAR_dns_domain) systemctl enable kubelet.service
ssh cp01.$(TF_VAR_dns_domain) systemctl enable kubelet.service
kubeadm-copy-config: ## Copy Kubernetes admin config from node01 to the local machine
kubeadm-copy-config: ## Copy Kubernetes admin config from cp01 to the local machine
scp node01.$(TF_VAR_dns_domain):/etc/kubernetes/admin.conf /root/.kube/config
scp cp01.$(TF_VAR_dns_domain):/etc/kubernetes/admin.conf /root/.kube/config
kubeadm-join-masters:
kubeadm-join-masters:
ssh node02.$(TF_VAR_dns_domain) $$(ssh node01.$(TF_VAR_dns_domain) kubeadm token create --ttl 1h --print-join-command --certificate-key "$$(ssh node01.$(TF_VAR_dns_domain) kubeadm init phase upload-certs --upload-certs | tail -1)" | tail -1)
ssh cp02.$(TF_VAR_dns_domain) $$(ssh cp01.$(TF_VAR_dns_domain) kubeadm token create --ttl 1h --print-join-command --certificate-key "$$(ssh cp01.$(TF_VAR_dns_domain) kubeadm init phase upload-certs --upload-certs | tail -1)" | tail -1)
ssh node02.$(TF_VAR_dns_domain) systemctl enable kubelet.service
ssh cp02.$(TF_VAR_dns_domain) systemctl enable kubelet.service
ssh node03.$(TF_VAR_dns_domain) $$(ssh node01.$(TF_VAR_dns_domain) kubeadm token create --ttl 1h --print-join-command --certificate-key "$$(ssh node01.$(TF_VAR_dns_domain) kubeadm init phase upload-certs --upload-certs | tail -1)" | tail -1)
ssh cp03.$(TF_VAR_dns_domain) $$(ssh cp01.$(TF_VAR_dns_domain) kubeadm token create --ttl 1h --print-join-command --certificate-key "$$(ssh cp01.$(TF_VAR_dns_domain) kubeadm init phase upload-certs --upload-certs | tail -1)" | tail -1)
ssh node03.$(TF_VAR_dns_domain) systemctl enable kubelet.service
ssh cp03.$(TF_VAR_dns_domain) systemctl enable kubelet.service
kubectl-remove-first-master-taints:
kubectl-remove-first-master-taints:
kubectl taint nodes node01.$(TF_VAR_dns_domain) node-role.kubernetes.io/master-
kubectl taint nodes cp01.$(TF_VAR_dns_domain) node-role.kubernetes.io/master-
kubectl-remove-all-master-taints:
kubectl-remove-all-master-taints:
kubectl taint nodes --all node-role.kubernetes.io/master- || true
kubectl taint nodes --all node-role.kubernetes.io/master- || true
Loading