Last year, I was re-platforming AceIelts from VPC to AWS Cloud powered Docker Swarm instance.
Before the end of 2021, I made a decision, to re-platform it to Oracle Cloud powered K8s cluster.
Before the plan, the history of AceIelts Tech Stacks
Section | Original | Ace Ielts Tech Stack in 2020 | Ace Ielts Tech Stack in 2021 | Description |
---|---|---|---|---|
Compute | VPS with 1g Ram | AWS EC2 t3a + 2g Ram | K8s cluster (26GB Ram in total) | 6 CPU Cores, about 200GB Storage |
Data Base | MongoDB + PostgreSQL | PostgreSQL | PostgreSQL | No changes, a db backup and restore |
Platform | VPS | AWS | OCI Oracl Cloud | |
Cost | $5/month | $8~10/month | For now $0/month | The OCI always free tier resources were used for building the K8s cluster |
Deploy | ssh | docker compose | docker + k8s deployment/service/ingress config | Through private docker registry |
Learning Curve | Easy, but a lot of boring steps to do for every single deployment | Easy, simple CLI commands + GUI dashboard, Caprover | Very Difficult | K8s has a very steep learning curve, but it does offer very good flexibility and cloud native scalability |
The original assuming of the cost for the tech stack in 2020 would be $8~10/month, actually it was about $14/month.
Part 1, Plan to re-platform AceIelts/Django Application
Why do you need to do another re-platform?
- Learning K8s and Oracle Cloud, new technology is born everyday, from linux instance => docker => docker swarm => Kubernetes,
- I can, yeah, this is another reason
- Saving money, OCI always free resources are powerful enough for a k3s cluster, $14 dollars, it is like 2 or 3 coffees.
- Easier for deployment, caprover is good enough, but k8s deployment seems easier, through
k8s apply -f ...
How to deploy a Django Application(aceielts.pro) to K8s Cluster?
Prepare:
- k8s cluster
- docker image
- docker registry (you might need a private registry if your application is not an open source app)
- SSL Certificate, you need to config cert manager for managing it
- domain name, in this case it is https://aceielts.pro
Issues during the re-platform
- Ace Ielts container so big, this is an old problem, I didn’t pay a lot of attention for optimizing the container/image building for AceIelts.
- Understand network/ingress/load balancing of K8s, this is the difficult part of k8s, it took me quite a while to understand the differences between NodePort, ClusterIP and LoadBalancer in k8s.
References
- Difference between NodePort, ClusterIP and Load Balancer, 3 types of service in k8s
- How to make EC2 Spot Instance Data Persistent?
To be continued
- Backup all config and db data
- We need to prepare all resources above, each step might be time consuming
- Deploy the app
- Build a dashboard to monitor it.