With the recent pandemic and a global recession in our midst affecting all kinds of markets, businesses are looking for ways to save money and remain competitive. At Mobilise we have been asked by customers to find new innovative ways to save costs on digital services whilst still delivering at an ever-increasing pace.
But does reducing costs on IT infrastructure necessarily lead to a poorer service?
As an AWS Well Architected Partner and Kubernetes Certified Service Provider, we are uniquely positioned to offer customers the latest in Cloud technology and solution designs. With that in mind, we have been working with customers to pair two amazing technologies together and produce enterprise-grade level platforms at a fraction of the cost.
What is Kubernetes?
Well, we have covered this over a series of blogs previously, so it’s worth checking those out – but basically, Kubernetes is an open-source platform for orchestrating your containerised workloads with a tonne of cool features.
What are AWS Spot Instances?
Spot Instances take advantage of spare computing power that Amazon is not using, essentially EC2 instances that are sitting idle. Amazon offers these spot instances at a massively discounted rate – up to 90% off the on-demand price!
Okay so how do these two technologies work together?
Elastic Kubernetes Service (EKS) is Amazon’s managed Kubernetes service which manages the control plane within Kubernetes and automatically handles things like
- High Availability,
EKS supports the creation of Kubernetes clusters using AWS Spot Instances. These Spot Instances will act as worker nodes, which is where your applications are deployed.
Hang on, don’t spot instances sometimes get reclaimed by AWS?
Yes, this is true – when AWS need more compute power back for a particular instance type they can reclaim your existing spot instances with little more than a two-minute warning before your instance is terminated! But don’t panic, by designing your Kubernetes workloads to be stateless this isn’t a problem.
By selecting a group of spot instances covering different instance types spread across availability zones you increase your spot flexibility. For example, if your cluster is deployed across three availability zones made up from the following spot pool
Then if your cluster running 2 x T3.Mediums and 1 x T2.Medium has a spot request to reclaim the T2.Medium instance class, your cluster has the option to spin up a new instance of the T3, T3a and T2. Large instance types.
Given that it is unlikely that AWS will reclaim multiple types across all availability zones – you can rest easy knowing your workloads will keep running.
Okay – but what if AWS does reclaim all of those instance types?
Well, for Production workloads it’s possible to create a set of On-Demand instances that always remain up, complemented by a set of spot instances to run excess and non-vital workloads.
Interesting, so what benefits does Kubernetes give you aside from a common platform for containers?
- Automated Deployments – Kubernetes will handle all of your deployments for you – which is a major bugbear in any business. Using rolling deployments, Kubernetes can automatically maintain zero downtime for your service whilst new versions are deployed.
- Namespaces – These provide an isolated area for your application to run within the Kubernetes cluster, which can be used to isolate particular applications or environments.
- Innovate Faster – Want to spin up another application stream to test a new feature or trial a new application but don’t have the pipelines in place or the budget to spend on extra infrastructure? No problem, use namespaces to deploy to the existing cluster and begin instantly testing your new service with next to no extra cost using spot instances.
- High Availability & Resiliency – Kubernetes ensures that there is always the desired number of instances of your applications running, which can be spread across availability zones.
This doesn’t sound cheap, how much are we talking to run these clusters?
Traditionally the largest monthly expense in cloud computing is paying for your virtual machines, but thanks to Spot Instances that have been drastically reduced. Let’s take a look at an example EKS cluster running in a non-production environment…
- EKS Pricing – EKS charges a flat rate of $0.10 per hour for each cluster – you’re essentially paying for AWS to manage the Kubernetes Control Plane for you.
- EC2 Spot Instance Pricing – at the time of writing a T3. Medium costs $0.0142 an hour.
So if we’re running 24 hours a day for a month, we have…
- EKS – 0.10 * 24 * 30 = $72
- EC2 Spot – 0.0142 * 24 * 30 = $10
That’s roughly $82 per month to run a Kubernetes cluster that can manage roughly 10-15 microservice applications.
And the best part? When you want to add more applications to your cluster, just add another spot instance at an additional cost of $10 for another 10-15 microservice applications!
*This doesn’t include regular running costs that any platform would incur such as VPC and storage costs
That’s cheap! What else?
Well, you can go a whole lot further by…
- Enabling cluster autoscaling – when an EC2 spot instance reaches the maximum number of microservices you can deploy to it, the cluster can automatically provision new spot instances and deploy to those.
- Infrastructure as Code – Use tooling to automate the creation and destruction of clusters so you can create a new cluster at the start of your day, deploy workloads to it and then tear it down at the end of each day. This would save roughly 12 hours of charges, bringing your development cluster pricing down to $41 a month in this example.
- Use an Ingress Controller – Use a Kubernetes Ingress Controller to control external traffic into your application and reduce load balancer costs.
- Productionise your cluster – Deploy a mixture of On-Demand and spot instances to ensure your service is always up. Turn on pod-autoscaling to allow your application to scale horizontally within the cluster, increasing availability as demand peaks.
Did you know that we offer Enterprise Cloud Services?