- Install terraform v1.5.5
- Setup the aws cli credentials with
default
profile name.
- Apply the terraform project.
terraform init; terraform apply
This will create one k8s master/control-plane node along with two worker nodes.
This will output
- ssh commands to access the swarm nodes.
- Ssh into the k8s master node(ssh command details available in terraform apply output from step 2)
- [Run on Manager Node] Get the join-token and ca cert hash:
kubeadm token list
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | \
openssl dgst -sha256 -hex | sed 's/^.* //'
-
Copy the token and cert sha.
-
Ssh into worker nodes(ssh command details available in terraform apply output from step 2)
-
[Run on all workers nodes]Run join token command along with token&hash(copied from step 4).
control-plane-host
is the private ip of the master node.
kubeadm join --token <token> <control-plane-host>:6443 --discovery-token-ca-cert-hash sha256:<hash>