I need to do a quick deploy of cluster k8s to test something, validate a proof of concept, etc
What options do you have?
I can use any solution ready, or I can make my own!
And that's what I did
Using packer to build a ami with all requirements to deploy a k8s cluster.
Terraform to provision all necessary infra in aws.
Ansible to run post-provision the cluster and join nodes
-
Simple
-
Functional
-
Fast to deploy and destroy
- AWS account
- Packer
- Ansible
- Terraform
$ export AWS_KEYPAIR_NAME=name AWS_KEYPAIR_FILE=path to file
$ cd base_image && packer build packer.json
$ cd aws_provision && terraform init && terraform apply -auto-approve
$ cd kubeadm_create && ansible-playbook -i hosts master.yml && ansible-playbook -i hosts nodes.yml
$ cd aws_provision && terraform destroy -auto-approve
#Delete the ami provisioned by Packer
$ aws ec2 deregister-image --image-id 'ami-id'
-
You can also use Gitlab CI. Just clone this repo to a Gitlab namespace and use.
-
There's a
.gitlab-ci.yml
file with all steps to deploy this project.
-
Only improvements
-
I do not want to put new features, the idea here is to stay simple.