Before we dive into the actual usage of Knative, let's see which components we got and how they interact with each other. We'll approach the subject by trying to figure out the flow of a request. It starts with a user.
Should we use managed Containers as a Service (CaaS)? That must be the most crucial question we should try to answer. Unfortunately, it is hard to provide a universal answer since the solutions differ significantly from one provider to another. Currently (July 2020), CaaS can be described as wild west with solutions ranging from amazing to useless.
Azure Container Instances are a way to deploy containers in the Cloud. Based on that, you might think that ACI is not much different from other Containers as a Service solutions. But it is. It does not have horizontal scaling, nor any other features often associated with schedulers like Kubernetes. It is limited to the ability to run a single container in isolation. It is very similar to using Docker, except that it is in Azure, and that it saves us from worrying about the infrastructure needed to run containers.
So, if Azure Container Instances are very similar to Docker, why not use docker instead of az CLI? Fortunately, folks at Docker asked themselves the same question and released Docker Desktop that supports ACI. It is available since version 2.3.3+.
Personally, I do not think that managed Functions as a Service are a good idea. Functions are too small for my taste. The execution model in which each request is served by a fresh instance is deeply flawed. The pricing is too high for my budget.
All that being said, I can see use cases where managed FaaS is a perfect fit, but only if that would be the only flavor of serverless deployments. But it's not, even though many are putting the equation between FaaS and serverless computing.
We should ask two significant questions when contemplating whether we should use managed Functions as a Service (FaaS) flavor of serverless computing. Should we use them? If we should, shall it be AWS Lambda, Azure Functions, Google Cloud Functions, or something completely different?
So, should we use managed FaaS? We probably should. But that's not the right question. We can almost certainly find at least one good example. A more important question is whether managed FaaS can be the solution for a significant percentage of our workload. That's the question that is much more difficult to tackle. To answer it, we might need first to establish good use cases for deploying and running functions.
Deployment strategies affect everyone, no matter whether we are focused only on a single aspect of the application lifecycle or we are in full control. The way we deploy affects the architecture, testing, monitoring, and many other aspects. And not only that, but we can say that architecture, testing, and monitoring affect the way we deploy. All those things are closely related and affect each other.
We'll discuss different deployment strategies and answer a couple of questions. Is your application stateful or stateless? Does its architecture permit scaling? How do you roll back? How do you scale up and down? Do you need your application to run always? Should you use Kubernetes Deployments instead of, let's say, StatefulSets? Answers to those questions will not serve much unless we are familiar with some of the most commonly used deployment strategies. Not only that knowledge will help us choose which one to pick, but they might even influence the architecture of our applications.
This time I will not write a lenghtly post. Instead, I'll try to explain different deployment strategies through diagrams. This is for all those who dislike black and white terminal and prefer colors, boxes, and lines with arrows.
The deployment strategies are not presented in any particular order.
Serverless deployments are gaining traction. Today, we have quite a few choices for converting our applications into serverless inside Kubernetes cluster. One of those, my favorite, is Knative. We'll explore how we can combine it with Jenkins X to create a fully automated continuous deployment pipeline that deploys serverless applications.
The serverless flavor of Jenkins X or, as some call it, Jenkins X Next Generation, is an attempt to redefine how we do continuous delivery and GitOps inside Kubernetes clusters. It does that by combining quite a few tools into a single easy-to-use bundle. As a result, most people will not have a need to understand intricacies of how the pieces work independently, nor how they are all integrated. Instead, many will merely push a change to Git and let the system do the rest. But, there are always those who would like to know what's happening behind the hood. To satisfy those craving for insight, we'll explore the processes and the components involved in the serverless Jenkins X platform. Understanding the flow of an event initiated by a Git webhook will give us insight into how the solution works and help us later on when we go deeper into each of the new components.