If you are an application developer or a system administrator in the 21st century you have probably come across the term containers. The container is nothing but an entity that comprises software packages tightly bundled together which can execute your code in an isolated environment. Unlike virtual machines which virtualize hardware resources to run multiple operating systems, containers virtualize the operating system to run multiple workloads on a single OS.
Now, just like in a production environment running a single VM instance is not enough to host your application, similarly, you need to manage multiple container instances in order to fulfill your microservice needs and get your application running. This can be very stressful and managing, monitoring and scaling 100s of containers can be a disaster when not done right. To manage your application well and provide 24X7 availability you need to think beyond just running your code in containers.
This is exactly where container orchestration tools like Kubernetes and Mesos fit in!
· Container orchestrator is a tool that monitors and manages the complete lifecycle of your containers right from bringing it into the running stage until gracefully terminating your code and shutting down your container
· These tools probe for container’s health and keeps in check for application code running in your container
· In case of higher loads, these tools can efficiently scale out your application code to cater from 100 clients to millions of clients without any downtime
Unlike Docker which has been the undefeated platform for running containers, there are various orchestration tools that are available in market to cater to different needs as per your application’s current workflow and future needs. Today we take a look at two of the world’s most widely adopted and versatile orchestration tools: Kubernetes and Mesos, and which suits your application’s needs and meets your future demands the best.
Kubernetes is an open-source container orchestration tool developed by Google and currently managed by Cloud Native Computing Foundation. Kubernetes provides container deployment, scalability, and management services, along with an exposed API core which enables developers to directly interact with Kubernetes control plane nodes to manage, create, configure Kubernetes clusters and integrate their systems with its core seamlessly.
Mesos is an open-source cluster manager developed originally by UC Berkeley and currently owned by Apache. It is designed to handle both types of workloads, containerized or non-containerized running on distributed systems. Mesos marathon is the framework that enables container runtime in a Mesos cluster.
After having a brief look at Kubernetes and Mesos architecture diagram and some features, let’s now compare them in detail and choose the right one for your application workload.
Kubernetes cluster comprises of two types of nodes: master and slave. Each node runs a specific set of services in order to form a cluster and provide a container orchestration platform.
Master nodes: these nodes are responsible for maintaining the state of the clusters and controls all the nodes in the cluster. Master nodes contain backed up cluster state in key-value store known as ETCD which can be setup along with master nodes or maintained separately on different nodes. Master node runs three major processes which are kube-apiserver, kube-scheduler and kube-controller-manager.
Slave nodes: these nodes are responsible for running your workload in containerized environment with help of these three major services namely kubelet, kube-proxy and container runtime(Docker preferably).
Mesos cluster comprises of master nodes and slave nodes, where master nodes are selected from a Quorum managed by zookeeper and slaves running Mesos agent for running the application workloads.
Master nodes in Mesos cluster are broadcasted with resources available by Mesos agent nodes and as per the tasks registered by schedulers a master nodes assigns the workload to the slave nodes which run the Mesos Executors.
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS
nginx Deployment/nginx 10%/80% 1 10 1
{
"id" : "my app",
...
"instances" : "10",
...
}
Nodes, processes, and workload failovers are managed both in Kubernetes as well as Mesos.
...
livenessProbe:
failureThreshold: 3
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 1
...
...
readinessProbe:
failureThreshold: 3
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 1
...
kubectl rollout history deployment/nodejs-app
kubectl rollout undo deployment/nodejs-app --to-revision=99
...
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-data
- mountPath: /usr/share/elasticsearch/config/certs
name: elastic-certificates
- mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
name: esconfig
subPath: elasticsearch.yml
...
...
volumes:
- name: elasticsearch-data
persistentVolumeClaim:
claimName: efk-data-efk-data-0
- name: elastic-certificates
secret:
secretName: elastic-certificates
- configMap:
name: efk-data-config
name: esconfig
...
{
"container_path": "/var/lib/elasticsearch",
"mode": "RW",
"source": {
"type": "HOST_PATH",
"host_path": {
"path": "/usr/src/elasticsearch"
}
}
}
apiVersion: v1
kind: Service
metadata:
labels:
release: logstash
name: logstash
spec:
ports:
- name: beats
port: 5044
protocol: TCP
targetPort: 5044
selector:
release: logstash
type: ClusterIP
Azure container service is easy to set up and deploy lightweight container service but lacks the features of auto-scaling, self-healing, and networking, hence use of Kubernetes and Mesos on Azure provide many advantages which can be summed up as,
Cons of using Kubernetes and Mesos on Azure,
Both Kubernetes and Mesos on AWS manages a cluster formed by Amazon EC2 instances running container instances on them.
Kubernetes runs the containerized workload on a single node or can range to a set of nodes forming a cluster hence, it is best suited for organizations and start-ups migrating from application deployments on small scale to cloud-native deployments. Kubernetes aids in the initial lifecycle of application development since it is lightweight, easy to deploy, and helps developers in their initial stage of working on cluster-oriented deployments. Backed with a large pool of development communities, Kubernetes provides a vast variety of plugins and integrations as compared to its competition.
If you have an existing workload that needs to be integrated with your currently developing containerized application then Mesos helps you leverage its hybrid distributed systems orchestration design, by providing a framework to host all the workloads in a single cluster. Mesos is desirable when you require a stable platform with a high number of nodes, typically over 20 in a cluster. Mesos has a steep in-depth learning curve for developers in order to harness the full potential of the Mesos cluster.
In conclusion, Kubernetes and Mesos are completely different frameworks that enable orchestration of Docker containers finding the similarity in providing scalability, portability, and isolated workspace for running your workloads.
Kubernetes turns out to be a fan favorite, provides a simple to use architecture with many benefits for beginners in cloud development, whereas Mesos is a robust and heavyweight framework that is best suited for organizations with the need of existing application migration and integration with the containerized environment.
Have a product idea?
Talk to our experts to see how you can turn it
into an engaging, sustainable digital product.