In the world of cloud computing, organizations usually face their ultimate challenge of choosing the right cloud platform to build their cloud empire. While choosing the best, we often end up with a decisive question “Kubernetes vs Cloud Foundry”.
Multiple efforts and loads of time has been spent to explain the difference between the two and honestly, I think this is not a fair comparison. Goal of this article is to explain how to leverage the best of both worlds and propose a side-by-side architecture which looks something just like this
Cloud Foundry & Kubernetes : Iron Man & Hulk
Cloud Foundry represents Iron man and comes equipped with a load of super-cool features which help you to quickly develop, deploy and deliver applications. Kubernetes represents Hulk having massive strength (of open community) to easily handle greater loads without any hard limits. Together they can fight as one team to save the world and avenge the challenges.
A Kubernetes cluster setup will serve as the foundation. On top of this, we will run the dockerized components of the cloud foundry stack, which is being managed and scaled by Kubernetes.
What’s the strength of Cloud Foundry ?
Cloud Foundry (CF) platform is primarily designed to support lightweight stateless micro-services. During deployment, applications will need to define upper bound for runtime memory and platform will ensure that the defined memory is at the most available. CPU allocation is handled internally and application cannot define CPU requirements. Hence we will deploy stateless applications and I/O bound applications to CF. Another advantage of cloud foundry is developers need not bother much about runtime, dependencies, containerizing the application. You simply select a build pack, pass along your application code and start your applications.
When does Kubernetes come into picture ?
Assume if your applications are resource intensive and involves some parallel computations and might require GPU’s. These applications do not fall within resource boundaries of cloud foundry, and this is where Kubernetes comes in handy. Applications can set resource requirements for both CPU and memory. This information is used by the kubernetes scheduler to find the suitable worker node which has the necessary resources available. The task of managing resources is then handed over to the docker engine (running within the selected node), which will in-turn guarantee that request CPU and memory is at the most guaranteed. There is also support to build stateful application by using different options for volume management. Hence we deploy CPU intensive applications and stateful applications to Kubernetes via the Kubernetes API server.
Overall there are some common components such as User Authentication and Authorization (ex: CF UAA), Logging and Audit support (ex: ELK stack etc) , Monitoring and Notifications (ex: App Dynamics etc)
If you intend to build stateless 12 factor micro services, you are better off with cloud foundry and developers simply focus on the application development and nothing else. If you have a strong cloud engineering team, K8s could be the right option as it provides manage the resources and gives your flexibility for the application deployments.
However, if you intend to build a suite of applications (some are stateless, some are stateful, some are CPU intensive, some are I/O bound) and all of them need to interact with each other and behave as one logical cohesive system; then the proposed setup of running both CF and K8S side-by-side could be your best bet.
Image Credit : http://inthekan.net/wp-content/uploads/2014/05/Marvels-Iron-Man-and-Hulk-Heroes-United-post-4-600×350.jpg