How to spin a multi cloud application with CAST AI
Tags: kubernetes, multicloud, cloudnative, devops
Published: 2021-08-10 11:12:16

<!-- wp:paragraph -->
<p>Multi cloud has been touted as <strong>the magic pill for many cloud </strong>pain points: getting locked into the services of a single vendor, ensuring business continuity in the case of an outage, and having your cloud bill spiral out of control.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>But more often than not, the <strong>effort of using multi cloud</strong> brings engineers more complexities to deal with - and a cost increase.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:tadv/classic-paragraph -->
<table style="width: 100%; height: 513px;">
<tbody>
<tr style="height: 64px;">
<td style="height: 64px; width: 52.9762%;">
<p><b>Multi cloud (CAST AI)</b></p>
</td>
<td style="height: 64px; width: 46.1905%;">
<p><b>Cluster federation </b><b><i>(other services)</i></b></p>
</td>
</tr>
<tr style="height: 200px;">
<td style="height: 200px; width: 52.9762%;">
<p><span style="font-weight: 400; font-size: 14px;">A multi cloud cluster is a single cluster - the connection between clouds is at network level. </span></p>
<br />
<p><span style="font-weight: 400; font-size: 14px;">Kubernetes doesn’t know that there are multiple cloud services or locations at play - it just sees a single network of nodes.</span></p>
</td>
<td style="height: 200px; width: 46.1905%;">
<p><span style="font-weight: 400; font-size: 14px;">A cluster federation is made of multiple clusters where the connection is at the level of Kubernetes. </span></p>
<br />
<p><span style="font-weight: 400; font-size: 14px;">Great for coordinating the configuration of multiple clusters from a single set of APIs in a hosting cluster. </span></p>
</td>
</tr>
<tr style="height: 249px;">
<td style="height: 249px; width: 52.9762%;">
<p><b>Benefits:</b></p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Instant multi cloud in the same region</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Cost optimization</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Access to best-in-class services</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Performance optimization</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Security </span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Disaster prevention</span></li>
</ul>
</td>
<td style="height: 249px; width: 46.1905%;">
<p><b>Benefits:</b></p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Easier deployment of multi-geo applications</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Disaster recovery</span></li>
</ul>
<p> </p>
<p> </p>
</td>
</tr>
</tbody>
</table>
<!-- /wp:tadv/classic-paragraph -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:quote {"className":"is-style-large"} -->
<blockquote class="wp-block-quote is-style-large"><p>So how do you actually run a multi cloud application that gives you the freedom to choose among the best-in-class services from various providers, prevents disasters, and helps you save, not increase, on the cloud?</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>This may sound too good to be true, but that’s the promise of multi cloud. And we guarantee that it works.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Take a look at this guide to see how multi cloud works in practice:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:html -->
<ul><li><a href="#whatismulticloud">What is multi cloud all about?</a></li>
<li><a href="#benefitsofmulticloud">What’s there to gain with multi cloud?</a><ol>
<li><a href="#costoptimization">Cost optimization</a></li>
<li><a href="#accesstoservices">Access to best-in-class services</a></li>
<li><a href="#performanceoptimization">Performance optimization</a></li>
<li><a href="#security">Security</a></li>
<li><a href="#disasterprevention">Disaster prevention</a></li></ol></li>
<li><a href="#howmulticloudworks">How multi cloud works in CAST AI</a></li>
<li><a href="#multicloudcasestudy">Case study: How multi cloud works in CAST AI</a></li></ul>
<!-- /wp:html -->

<!-- wp:heading -->
<h2 id="whatismulticloud">What is multi cloud all about?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In a multi cloud setup, teams can deploy applications and other assets across several cloud environments at the same time. A typical multi cloud architecture uses two or more public clouds, sometimes in combination with private clouds. In a <a href="https://www.gartner.com/en/conferences/apac/infrastructure-operations-cloud-india/featured-topics/cloud">Gartner survey</a>, 81% of respondents admitted using two or more providers already.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Check out this video to learn more: <a href="https://www.youtube.com/watch?v=qkj5W98Xdvw&amp;t=608s">Hybrid Cloud and MultiCloud | Why are companies adopting it?</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here’s how we understand multi cloud at the level of:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li><strong>Data</strong> - having a single source of data shared among different workloads, regardless of which public cloud service they’re in.&nbsp;</li><li><strong>Service</strong> - making services built in one cloud available for reuse in other cloud services. If you use Amazon RDS and have a process that uses the Machine Learning engine from Google Cloud, you should be able to make these things work together to use the best of both worlds.</li><li><strong>Workload</strong> - applications and data work together using abstract processes that may be installed in different VMs - some owned by AWS, others by Google Cloud or Azure.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Translated into the Kubernetes world, multi cloud means the ability to create and manage a Kubernetes cluster in any number of clouds. </strong>To the point where the number of cloud services becomes irrelevant.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:quote {"className":"is-style-large"} -->
<blockquote class="wp-block-quote is-style-large"><p>Developers should be able to deploy their applications to clusters easier and then have these clusters optimized all the time. This is what true multi-cloud is for us. </p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>This approach is on its way to becoming the core of the future multi cloud initiatives as more and more companies realize the limitations of monocloud setups and start looking for a better cost vs. performance balance.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="benefitsofmulticloud">What’s there to gain with multi cloud?</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3 id="costoptimization">1. Cost optimization</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>A multi cloud environment gives you the freedom to compare different cloud providers and secure the best offers depending on your changing needs. You can choose services that offer exactly what you need - from flexible payments to customizable capacity. And a better price.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Here’s an example from our research: </strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Let's say that you have two instances with 4 CPU and 16 GB RAM from Google Cloud and AWS. Compare them and you’ll see that the instance from Google is 10% cheaper and offers 7% more compute capacity in the EU Central Frankfurt region.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh4.googleusercontent.com/IfwBsbksoCjCL1QruwiVxm9O9fQxgiDjS5w-3uAN0uOlqfByaWTlJffN29dcQ6nOZAGDhCRnFnASebzsYfE7a3qoje5LJhnFgwvxXV1zpUEvRZKB82pwn910eqDGE3C29cWYXJ_F" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh6.googleusercontent.com/GAKZbBe2J-opkKauIYis5ZwBcUIIinHF2o9GK9Be51B_464i9hkxotk1o5SrJXLu7T9EKxJ1jYt2qWZCFU64zfba78xp5qD9ykCIp3wqnJYtiyPQnuFzP6_7gfBhsjE98GgkCSZk" alt="multi cloud cost optimization"/></figure>
<!-- /wp:image -->

<!-- wp:html -->
<h3 id="accesstoservices">2. Access to best-in-class services</h3>
<!-- /wp:html -->

<!-- wp:paragraph -->
<p>To make the most of the public cloud services, engineers should be able to use the best services and features. In a multi cloud setting, a team can select a primary cloud provider and a secondary one for for extra value or carrying out a specific task (like machine learning training) and then bring the results over to the first cloud solution to build and deploy applications.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:quote {"className":"is-style-large"} -->
<blockquote class="wp-block-quote is-style-large"><p>Say your team uses Amazon RDS but wants to use the Machine Learning engine from Azure - making these two things work together is possible if you go multi cloud.</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":3} -->
<h3 id="performanceoptimization">3. Performance optimization</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Optimizing performance across various cloud services is another perk of a multi cloud setup.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Say you have an application that experiences a sudden increase of requests per second. Your team can check which cloud service eligible for multi cloud (in a so-called <a href="https://cast.ai/blog/learn-how-to-find-the-multi-cloud-goldilocks-zone-with-cast-ai/">Goldilocks Zone</a>) has the available resources at the lowest possible price - and then start deploying additional capacity immediately.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="security">4. Security</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Multi cloud opens the doors to finding the best security solutions that might come in handy as your infrastructure and applications evolve. In this scenario, you’re free to switch providers anytime and find a good match for ensuring the security level you need or achieve compliance.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 id="disasterprevention">5. Disaster prevention</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Even the most well-known cloud service vendors experience outages. Since downtime may have serious financial and reputational consequences for your business, you should do your best to avoid this risk. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>One way to prevent this from happening is by replicating large parts of your infrastructure and workloads in two places. But it's a costly solution.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here’s one that doesn’t increase your cloud bill: multi cloud. When one cloud service goes down, your business isn’t hurt in any way because your workloads and data are moved to other clouds.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="howmulticloudworks">How multi cloud works in CAST AI</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>CAST AI uses the Cloud Service Provider (CSP) accounts of its users to create the required cloud resources (VPCs, Resource Groups, and networking layer) and set up multi cloud clusters. It then selects the right regions with cross-cloud latency of no more than 10 ms in normal operation.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here are a few <a href="https://cast.ai/disaster-prevention/">multi cloud features</a> we included to :</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Active-Active Multi Cloud</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Using the active-active approach, CAST AI replicated applications along with data across multiple cloud services. If one of them fails, others keep your workloads afloat and guarantee business continuity.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Global Server Load Balancing</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Traffic is distributed evenly across all the participating clouds, choosing the cloud endpoints that are up and healthy.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Automated Data Movement</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>When working across cloud boundaries, it's essential that you can move data seamlessly. CAST AI provides automated block storage migration with advanced replication through our partners.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Multi-Region Mono-Cloud</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A Kubernetes cluster in CAST AI works on a single cloud service stretched across multiple regions. Thanks to this, you can connect nearby regions with low latency and still secure the active-active approach to disaster prevention.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Cross-Node Live Migration</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Moving pods from one node to another can cause disruptions, especially when the pods in question handle long-running transactions or network connections. Thanks to live migrations, pods can move and stay intact without breaking any connections.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="multicloudcasestudy">Case study: How multi cloud works in CAST AI</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3>TL;DR</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><em>Let’s put the CAST AI multi cloud feature to the test. Imagine that you have a cluster that consists of one worker node. We then deploy an app and find our that there’s not enough space for all the pods on the cluster. This is when CAST AI automatically scales up our setup with additional machines.&nbsp;</em></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><em>Sounds good so far? Then get this: CAST AI decided to add VMs from a different cloud provider because it judged them to be most cost-effective (including the use of spot instances for even more cost savings!). This is how multi cloud Kubernetes works in CAST AI.</em><em>&nbsp;</em></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Step 1: Create a multi cloud&nbsp; cluster&nbsp;</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Let’s start by creating a cluster that has multi cloud capabilities. In the CAST AI platform, we can easily create a cluster in the US-East region spread between AWS and Google - in US-East-1 (Virginia). CAST AI automatically connects the cluster via Wireguard VPN - but we have a choice of the cloud VPN-as-a-service as well.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>This is what the cluster creation dashboard looks like:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh4.googleusercontent.com/_vAsphFCtFgr38PU97lV1cgckk3H7e9y6NUdi_sJN1eupPLjtPO_qp7Wsly3MIqycvIRSnNPFsojgjVo2QOCuTTWH_tMl1TKi1z4nSB6NV6I_0-HpuO6PHepNCUVv2GRqha8Yiv4" alt="create a multi cloud cluster"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Our cluster is ready! It took me just 5 minutes.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh4.googleusercontent.com/snMG_0zoK0VRZ8fZj7Lij1p9iqd8mLhTnm1Gnck4YWWOpJE1DLcePnxsa2k7gMws0o87CYqj9SrO3p_JVqoKJfIS8uELcjqsdRoZemjFF1RWZrLkYczTsfiNFgXt3nz4xzqeKUU1" alt="multi cloud Kubernetes cluster"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Let’s take a closer look at our cluster. It has one worker node and one master node. Both are hosted on AWS by default:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh6.googleusercontent.com/-G5iEhNOsHyPR9DnOlOcdw29rgxJlnuPAv2JscCSTUl8m_HtV6vAY7D55FX6zjDP1D9Eo-1IhZynDOG8kzOY5S5-wKZ69VyW8FAg4Km6lcisX6extBNQPGC3JBqYcNOCkSsENAre" alt="node selection in multi cloud"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Next we download the Kubeconfig file and import it to Lens:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh5.googleusercontent.com/1ZXzBvjLm6qKmVVZJ3BfP5Y4XHZSAyGAid5m1j2jZAdroJ_cWeHS3HDrzfErvxztrB9I32_inuHCY67omG3yYcDDW8pkGyJ0t8sYmhG1PVQZLRZHM5GgZ5VhGJjnuBBFjls7AWb4" alt="multi cloud code"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>&nbsp;Here’s a visualization of our cluster composed of one master and one worker node.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh6.googleusercontent.com/y5ICMcChwkEiGE2Jt7iEY-1N9TF63US2QkK_Ft_ZxVvag8rWKvZ735oOPk0bxl0WyRuaMNixbD-JVv60T4wblUfOJVePh7jR8Ebz2ksvIQY9RzS33lUYHvNATLOnjc2fm6RB8Ipf" alt="Kubernetes cluster"/></figure>
<!-- /wp:image -->

<!-- wp:heading -->
<h2>Step 2: Deploy an application on the cluster</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Now, let’s deploy our Kubernetes application! This is what is happening now in my setup:&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh4.googleusercontent.com/zfsDbfhUBANiMm4_Ew2OdJ7WPxeP0_WTgzt4L_YqB5irBJEiD5ZaCmrMGZBae7DNoH0UL4FaQeMI0WwL_rA-kl7UNy0jOGJ2AdCR83f8zULeNBQlOHvm1zhzgqlN2Tz7SemXntoL" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Our worker node is now full with CPU of more than 89%. We also have a lot of pods that are unscheduled (marked in yellow) - they simply have no room to run on our existing node.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Step 3: Let the autoscaling begin</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>CAST AI autoscales our setup by adding nodes to the application. As you can see, it added two additional VMs on Google Cloud: e2-standard-4 with 4 CPUs/16 GB and e2-standard-2 with 2 CPUs/8 GB.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh5.googleusercontent.com/4ILortWI2FVsBp-7EcO_ReB18iFm4ONy3HH6kuIrT8H6KYM2C73TrzzTwaKyBoRB48qy4LvCw4-9Me3NWohqBR1zlWVGzQy913aGQY0HAFTUqFpeSB6vPh19mPmYHgFLunV7uZ7T" alt="autoscaling multi cloud"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Let’s take a look at our setup now. Do you see how optimized our CPU is on the first two worker node machines (the VM on top is the master node).</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh6.googleusercontent.com/MolJbek0xd1MP6Wnjc0MuxFnm5YcAvNaUYizPv_Pkbx6_ZkWdz4NC7jYcwsllcCUheNwOZanwAASwWCSFYxoD4lcxVJt3-R20i8GYi3dIiAgN0-KnI-ix4CuHEuFWfEtOKYTBHnh" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Why did the solution select two instances on Google and not on AWS? Because they were the most cost-effective at this time.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Let’s confirm this. Here are the prices of Google and Amazon.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Cost savings</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>On Google Cloud, the e2-standard-4 costs $0.134012 per hour:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh5.googleusercontent.com/rt5ZrEDzzuQ07HWj6u_73bNp86vRlDPah601-J7FrO1J2QFkNlFcmnNwljNpOEsNuyHDmv9YZL1kr1T7c2H3ju0eE1snPEBAn5vnKHZ2olU-cvgPFapnSDB5hLodGuyvvYA7lFXr" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>And here’s an equivalent on AWS. We can see that every single 4 CPUs/16 GB are more expensive, even the t4g instance equipped with the Arm processor. Note: We didn’t consider this since we were looking at x86 CPUs.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh6.googleusercontent.com/y4w_7_z_WIcoXgpq_4mtR31qFzTTE-BoRTnDEFatRMjxVF4TzEDUPJoAsEsvmCJYfkQ3kZCaB_bUa-SkhholP7ZytCh_qqXpaL5PTqE29QF_crBIduw6VZXugUAwWd50vm7HXANv" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>On Google Cloud, the e2-standard-2 is $0.067006 per hour:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh3.googleusercontent.com/r0ohn3ixi0VEVkbu2Vxc5n7h_7BXDLh0FGe1tWeVxDJLRCnXp3fV7uIh35BV6YWzm0If279AbfdaoxnZn-wHaPJ0FD0zi4edVnaFf7qJIM2PCsOLTyyaxXfqj_D-Mj5wW79zycT2" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>The AWS equivalent costs $0.0832 per hour (excluding the Arm processor-based instances):</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh3.googleusercontent.com/FDKxDM7CUK-s9RRn98JraqTVRXyib1TWw_EeSaEiEOsqNZigBgjjoXFAGKNkXuAbKUy-IvZ4z0U0gqaiW0Qf7HeIzOy3XNQuF3qQJ6m8f_eIfhxdsmKu1J5gQO17EBi2tlvkv0-E" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:quote {"className":"is-style-large"} -->
<blockquote class="wp-block-quote is-style-large"><p><span data-mce-type="bookmark" id="mce_1_start" data-mce-style="overflow:hidden;line-height:0px" style="overflow:hidden;line-height:0px">As you can see, CAST AI made the right decision. It intelligently selected the most cost-effective additional instances choosing Google Cloud instead of sticking to AWS.</span> <span data-mce-type="bookmark" id="mce_1_end" data-mce-style="overflow:hidden;line-height:0px" style="overflow:hidden;line-height:0px"></p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading -->
<h2>Step 4: Testing the pod autoscaler further</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Let’s simulate a pod autoscaler by adding more replicas to one pod. We’re going from 5 replicas to 50:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh5.googleusercontent.com/xf6AtvVRRQGKd2pXaXGp8ZH9owDjievWMVrEuiS5foCNGs0LJi8GjZQ4mixBLnTlE_qUBYC82NKoV4m8_OrL9KFTQfgHVWErXDIKOCzGQb0rsjOdYTFTGWlWxcg7JS_qFxDmiDLs" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>As expected, some pods filled up the spot instance and the rest became unscheduled. This triggered an autoscaling event and after a minute, CAST AI added new nodes.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh4.googleusercontent.com/iPSUJ4umUn5ZxnlQws9ZdXjugxq9YbhIC-0BoA9SyrP7xOVxTLNgJkMTNNXDINwOMInVb6C4NrWL-l5v9Xi4RWgHpMLlPUvEwmhLJqPJoajdrfyueeUKEN6cvMaFentSMcvz7V0e" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>A few minutes later, the solution reshuffled all the nodes automatically. Since many of the new pods were friendly to spot instances, it decided to add one spot instance and was able to consolidate both the unscheduled pods and pods from the former e2-standard-2 into an all new spot n1-standard-4. This brought the total cost even lower than before scaling up the pods.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>So this is the final look of the nodes for our cluster:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh3.googleusercontent.com/IDq6RVGPYMM2dx-zFd7HN7GA7LH0Vc8iOS1b2YD301JDfHibAiivAZ-cCPwKYmZVTOiK5HFHpWD8X5a43RA6Wnhc_-C-xTHO_RYuLJvniAwSgUaoKNEt4KGwAf1IQMLxx5c4Z576" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh5.googleusercontent.com/dg7pNkLS9oI5zOa5-4RQdMp0qYjWbiPuGbXgze9ykWWoCRaxUJ697iEVWeeI51UbV9JO6SfnxxOJl9UcixWBXqrNprBeX3LkFxJxmpR3MHj3tH9NH5_V8VmorbVHMNO8p_usexiE" alt="multi cloud cost optimization"/></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":3} -->
<h3>Cost savings</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The e2-standard-2 (2 CPUs/8GB) on demand was replaced by a larger n1-standard-4 (4 CPUs/16GB) spot instance.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Google Cloud’s n1-standard-4 pricing&nbsp; 4 CPUs/16 GB is $0.04280 per hour:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh6.googleusercontent.com/d0L6ko2zQ-OQNx2et9dJZI9VrPCHw9IonCwpN4ni1QwItxV08OqLwPS-W-e6Cue-AVaXLtSSwM-Yhdqe6GcW28mM4qUkfepuhzCyO8r1nlGqQ2BMmuuhgI6FuKsgkoItvDi2OxqH" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>The equivalent on AWS would be at $0.0687 per hour:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh3.googleusercontent.com/hzGRlMW95MJUn6Hcb-s7ILaj-1_qL5X7_QdZXf4jSDriFx6cViDRxhMzRkKoXtCo7j-4iWNV-zJvovtS87-oi-Ikf8ExfPkvI_fb8OCrcYQth2o0EQZIc_nkAjbapLjRU_fNPjRl" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:quote {"className":"is-style-large"} -->
<blockquote class="wp-block-quote is-style-large"><p>CAST AI decided to eliminate the expensive On Demand e2 instance, and consolidate its pods (and the new unscheduled pods) on a highly discounted spot instance (called Preemptible Instance on Google Cloud).</p></blockquote>
<!-- /wp:quote -->

<!-- wp:heading {"level":3} -->
<h3>Curious to see how multi cloud works in CAST AI? You can start by automatically creating a Kubernetes cluster in 10 minutes: <a href="https://console.cast.ai/?screen_hint=SIGNUP">Start now</a>.&nbsp;</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3>If you’re a business user, <a href="https://cast.ai/get-a-demo/">book a short demo</a> to get a walkthrough of the solution and see the value of multi cloud.</h3>
<!-- /wp:heading -->