Kubernetes: Scaling up solution for multiple services

Shubham Gupta
Failing Fast
Published in
4 min readJan 5, 2019

Since the inception of Docker and OCI(Open Container Initiative), the landscape for Operating-system-level virtualization has changed. So many PaaS(Platform as a Service) and IaaS(Infrastructure as a Service) have either begun their journey or have changed the way they provide services. This change in landscape is not only because there is a dramatic shift in billing methods, from bare metal infrastructure to cloud-native resources, but also the flexibility that was introduced by Docker Images.

Why Containers?

Any current time developer can endorse for the flexibility that docker provides. The docker images provide a complete configured environment with its own. Containers made from these images are portable and can run on any platform. They can run a single application service or can support a complete solution with multiple services on its own. Earlier it was only containers with POSIX base images, but now we also have hypervisors with Windows as their base image. Depending on the required usage we can easily deploy these containers in dev, stage and prod environment as well. And because containers use host OS base resources they are much lighter than a virtual machine, while also maintaining namespace, security and starting states. Hence ramping up and scaling up the containers based on the requirement is just a piece of cake. This is an organized and efficient manner to use the underlying server infrastructure.

While these containers are actually capable of running application and services with scalability, they are not good enough to manage the host OS resources which includes network, volume, and processing power. Google started Kubernetes initiative, as a container orchestration tool, in 2014 to tackle this problem. They also tried to cover issues like deploying, scheduling, distribution, and load balancing as well. Hence, Kubernetes has proved to be a blessing for DevOps.

Advantage over PaaS

PaaS like Google Cloud, AWS(Amazon Web Services) and Azure also even though try to go around this problem but the issues that arrive with these services is the constraints to use restricted environments with programming languages and application framework. For example, AWS is integrated with Amazon DynamoDB, Amazon ElasticCache, Amazon Relational Database Service and Amazon Redshift while Google cloud provides Cloud Memorystore, Persistent Disk, Cloud Datastore, IoT Database Firestore, Cloud Spanner, Cloud Bigtable, Cloud SQL, Filestore and Cloud Storage. PaaS should only be seen as a solution when a business requires a particular kind of software/application service on that platform depending on the requirement. This not only helps business to rely on their licensed services but with also provided 24x7 support.

Kubernetes offers cloud server and their associated resources via dashboards and API. Businesses and clients have direct access to Kubernetes servers and storage, just as they would with traditional servers but with a higher order of scalability. One of the advantages of Kubernetes I would like to mention is that using these outsourced resources, clients can build “virtual data center” in Kubernetes and also have same technologies and resource capabilities of a traditional data center.

Architecture

Kubernetes work on the principle and master controller(Kubernetes Control Panel) and worker slaves(Kubernetes Nodes). A frontend API through Control Panel is exposed so that clients/users can use this to access the bare metal resources offered by Kubernetes and used by Kubernetes node.

Kubernetes Architecture [source: Wikipedia]

All this is made possible with modules like:

· etcd: acts as a configuration data storage of Kubernetes cluster.

· API server: this provides both external and internal interface to Kubernetes, allowing clients to configure workloads and containers across Worker Nodes

· Scheduler: allocates unscheduled pods to nodes according to the available resources. It is there to match resource “supply” to workload “demand”.

· Controller manager: the process that runs core Kubernetes controllers like DaemonSet Controller and Replication Controller. The controllers communicate with the API server to create, update and delete the resources they manage (pods, service endpoints, etc.)

· Kubelet: responsible for running state of each node, ensuring that all containers on the node are healthy.

· Container: lowest level of a service unit running on Kubernetes

· Kube-proxy: a fusion of network-proxy and a load balancer on a node

· cAdvisor: monitors performance metrics such as CPU, memory, file and network usage of containers on each node

Merits

After elaborating the functionalities and the force behind the development of Kubernetes, let's look at a few significant advantages of using Kubernetes:

  1. No restriction on software stack, unlike PaaS.
  2. Better modularity with version control and distributed application layers using multiple service containers.
  3. Accessible API through the frontend. This gives visibility to identify running, failed and completed deployed containers.
  4. Services can be deployed across pods in a scaled-out manner. They can also be scaled in and scaled out any time according to the need.
  5. 5. Controlled orchestration for rolling out updates, so that updated version of containers is deployed on pods in a “rolling fashion.”
  6. Multiple environments like dev, stage, and prod can be used in parallel for deployments of new versions of images.

Conclusion

Not surprising given the interest in containers, other management, and orchestration tools have emerged. Popular alternatives include Apache Mesos with Marathon, Docker Swarm, AWS EC2 Container Service (ECS), and HashiCorp’s Nomad. Each of has its own advantage with their additional proprietary solutions to their IaaS.

There is duplicity in features and functionality between these services, but Kubernetes remains immensely popular due to its architecture, innovation, and the large open source community around it.

--

--