Pet vs cattle in a cloud-native world


Disclaimer: No animals were harmed in writing this article and I am a vegetarian ;-)

While talking about the containers (Docker and Kubernetes) to the beginners, we start by telling that a container is more like a light-weight virtual machine(VM). 

A container provides isolation from the host OS as VMs do. 

It has its own IP address, process space and storage area.

But this definition of a container has its own limitation, especially when we discuss various container orchestration concepts and the usefulness of the features provided by container orchestration tools like Swarm and Kubernetes.

That is when it is important to bring forth the difference between VMs and Containers by giving an analogy of pet vs cattle. 

Virtual machines are more like pets. Containers and pods are more like cattle. 

What is the difference between pets and cattle?

We love our pets.

Normally there are only a limited number of pets a person have.

These are high maintenance.  

If something happens to them, we go to hospitals.

We provide care for them to recover. 

It is a long term relationship with pets.

On the other hand, there are cattle.  Chicken, sheep etc.

Cattle are ephemeral.

These are here for a very specific purpose.

They require low maintenance cost. 

If there is a flue, normally these are culled without much remorse. 

Ops engineers by default treat the infrastructure as 'pets', but microservices-based and the cloud-native world is revolving around the 'cattle' concepts. 

The aspect of agility, scalability and high availability of our application is being achieved by moving towards a "cattle" mindset from a "pet" mindset. 

Once you keep this fundamental difference between VMs (Pet) and containers (Cattle) in mind, you will appreciate the importance of those complex concepts of kubernetes. It will make you wiser while making judgment calls about the application architecture. 

It helps you give a better clarity for the question such as -

  • Co-existence of VMs and Containers. 
  • When to use VMs and when to use containers?
  • What should be a good design pattern for your application? 
  • How to work with the data and databases?
  • How to ensure scalability and flexibility?
  • Falling fast and healing faster. 

A seasoned software professional would be enticed to make decisions with the pet mindset, as it seems to be the right thing to do, no matter how painful it is. But if you are planning to move to a cloud-native ecosystem,  it is imperative that you know what works as a pet what works as cattle, when to cure and when to cull. 

P.S.: If you are wondering about the application of this concept in real life here is a link to my other article where a worker-node was culled like a cattle. 










要查看或添加评论,请登录

Ashish Pandey的更多文章

  • How to deploy Kafka and Zookeeper on Kubernetes

    How to deploy Kafka and Zookeeper on Kubernetes

    In a Microservices based architecture message -broker plays a crucial role in inter-service communication. The…

  • Go Serverless !!!

    Go Serverless !!!

    What is Serverless? How it evolved? What are its features? What are the tradeoffs? Should I use serverless? How is it…

    2 条评论
  • How to set up Multi-node Kubernetes Cluster from scratch

    How to set up Multi-node Kubernetes Cluster from scratch

    When someone begins learning Kubernetes, the first challenge is to set up the kubernetes cluster. Most of the online…

  • How to resolve bugs in kubernetes clusters in production

    How to resolve bugs in kubernetes clusters in production

    We often hear that containers are going to transform the way we develop, test, deploy and manage our software…

    1 条评论
  • Canary sings: Welcome Kayenta

    Canary sings: Welcome Kayenta

    New DevOps kid is on the block. Welcome "Kayenta".

  • DevOps Terminology

    DevOps Terminology

    DevOps is full of fancy terms and buzzwords. Now when the whole IT world is moving towards DevOps, they need to be…

社区洞察

其他会员也浏览了