Get startedGet started for free

Scaling Applications in AKS

1. Scaling Applications in AKS

In this video, we'll explore how to scale applications in AKS, ensuring workloads remain responsive under varying demand.

2. Why scaling matters

Applications rarely experience constant traffic. Some hours may be quiet, while others bring spikes in usage. Without scaling, workloads risk becoming overloaded, leading to poor performance or downtime.

3. Why scaling matters

Kubernetes provides mechanisms to adjust resources dynamically, so applications can handle demand efficiently. Scaling ensures users get consistent experiences while organizations optimize costs.

4. Manual scaling

The simplest way to scale is manual. You can increase or decrease the number of replicas in a deployment using kubectl scale.

5. Manual scaling

For example, scaling a web app from two replicas to four ensures more pods are available to serve requests.

6. Manual scaling

Manual scaling is useful for predictable events, such as planned product launches, promotions, stock sales, where traffic increases are expected. It gives administrators direct control but requires monitoring and intervention.

7. Horizontal Pod Autoscaler (HPA)

For dynamic workloads, Kubernetes offers the Horizontal Pod Autoscaler.

8. Horizontal Pod Autoscaler (HPA)

The autoscaler monitors metrics like CPU and memory usage, then automatically adjusts the number of replicas.

9. Horizontal Pod Autoscaler (HPA)

If usage rises above a threshold, more pods are created.

10. Horizontal Pod Autoscaler (HPA)

If demand falls, pods are removed.

11. Horizontal Pod Autoscaler (HPA)

In AKS, the autoscaler integrates with Azure Monitor, allowing custom metrics such as request latency or queue length. This automation reduces manual effort and keeps applications responsive.

12. Cluster Autoscaler

Scaling pods is only effective if nodes have capacity. AKS supports the Cluster Autoscaler, which adds or removes nodes based on demand. If pods cannot be scheduled due to insufficient resources, new nodes are provisioned automatically.

13. Cluster Autoscaler

When demand decreases, unused nodes are removed to save costs. This elasticity ensures infrastructure matches workload needs without over-provisioning.

14. Best practices for scaling

Effective scaling requires planning. Define realistic resource requests and limits so Kubernetes can schedule pods efficiently. Use metrics that reflect actual user experience, not just CPU usage. Combine Horizontal Pod Autoscaler with Cluster Autoscaler for end-to-end elasticity. Test scaling behavior under load to confirm applications remain stable. Finally, monitor costs, as auto-scaling can increase spending if thresholds are set too aggressively.

15. Recap

Scaling in AKS ensures applications adapt to demand automatically. With manual scaling, Horizontal Pod Autoscaler, and Cluster Autoscaler, you can balance performance and efficiency. Mastering these tools helps deliver reliable, cost-effective applications in production.

16. Let's practice!

And now, let's practice with some exercises.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.