Kubernetes and Cloud Native Associate - KCNA
Cloud Native Architecture
Serverless
Imagine hosting a birthday party at home while hiring a professional cleaning team. This team prepares your home before the event, keeps it tidy during the festivities, and cleans up once the guests leave. This practical approach mirrors serverless computing.
In traditional computing, companies need to purchase or manage servers themselves, setting them up and continually maintaining them. With serverless computing, however, the cloud provider manages the infrastructure—provisioning, maintenance, and scaling—allowing you to focus solely on your application's core functionality.
Even though the server infrastructure is managed by the cloud provider, your application still performs essential tasks such as resizing images, sending notifications, or triggering emails. These operations represent your business logic running seamlessly in the background.
Function as a Service (FaaS)
Function as a Service (FaaS) is like hiring a team of specialized helpers for your party. One helper greets guests, another serves drinks, and another ensures everyone is having a great time. Each helper has a single, clear role and only works when needed. Similarly, FaaS lets you write small, task-specific pieces of code that execute in response to events like HTTP requests or messages in a queue.
These specialized functions are uploaded to a cloud provider, which automatically executes them when triggered by specific events. The pay-as-you-go pricing model means you only incur costs when the code runs—similar to hiring helpers only for the time they work. This setup is ideal for applications that encounter unpredictable traffic or usage patterns.
The cost-saving benefits become even more apparent with the pay-as-you-go model:
Example: Online T-Shirt Store
For example, consider a small online t-shirt store that needs to send a confirmation email after a purchase. Instead of managing an email server or developing complex dispatch code, you could simply implement a function using a service like AWS Lambda. This function would be triggered automatically after a customer makes a purchase, sending the confirmation email via services such as SendGrid or Amazon SES. The FaaS platform scales the function based on incoming request volume.
Major public cloud providers support FaaS, with offerings such as:
- AWS Lambda and AWS Fargate (Amazon Web Services)
- Azure Functions (Microsoft Azure)
- Google Cloud Functions (Google Cloud)
- IBM Cloud Functions
Kubernetes Serverless: The Hybrid Approach
Kubernetes serverless combines the scalability of Kubernetes with the ease of serverless computing. In a standard Kubernetes setup, containers run within clusters spread across multiple servers or virtual machines. Kubernetes ensures high availability with features like auto-scaling, load balancing, and self-healing.
With the evolving demand for serverless architectures, platforms like Knative and OpenFaaS have been developed on top of Kubernetes. These platforms empower developers to deploy serverless functions that automatically handle scaling, event triggering, and lifecycle management. This hybrid model offers enhanced scalability, reduced operational costs, and improved developer productivity.
The subsequent diagram emphasizes Kubernetes’s scalability and reliability alongside the cost reductions and increased productivity achieved with serverless computing:
Key Takeaways
- Serverless computing frees you from managing infrastructure, enabling you to focus on application logic.
- FaaS offers efficient, event-driven execution of code on a pay-as-you-go basis.
- Kubernetes serverless combines container orchestration with the operational benefits of serverless computing.
This overview of serverless computing closes our discussion, paving the way to explore implementation details and advanced strategies for leveraging these modern technologies effectively.
Watch Video
Watch video content