DEV Community

Cover image for Kubernetes for Beginners: Introduction, Functionality, and Cost
Shubhendra Singh Chauhan
Shubhendra Singh Chauhan

Posted on

Kubernetes for Beginners: Introduction, Functionality, and Cost

Are you just starting to learn about Kubernetes, but the technical jargon and complex concepts are making your head spin? Fear not! In this beginner-friendly tutorial, we'll dive into everything you need to know about Kubernetes to kickstart your journey. Whether you're a developer, IT enthusiast, or someone just curious about the world of tech, we'll break down the basics of Kubernetes, explore its functionalities, and even sprinkle in some insights on managing costs associated with it. So, let's get started.

⚠️ Note: This tutorial assumes a basic familiarity with Docker. If you're new to Docker, consider exploring its fundamentals before diving into this content for a smoother learning experience.

Table Of Contents


Let's first take a look at the definition of Kubernetes:

Kubernetes, also known as K8s, is an open-source container orchestration tool developed by Google to help you manage containerized/dockerized applications supporting multiple deployment environments like On-premise, cloud, or virtual machines.

In simple words, imagine you have a bunch of different programs, each like a little worker doing a specific job. Now, Kubernetes is like the smart manager that keeps an eye on all these workers (we call them containers) and makes sure they're doing their tasks correctly.

Think of these containers as small, portable boxes that contain everything a program needs to work smoothly. They could be on your computer, in the cloud, or on some virtual machines – it doesn't matter. Kubernetes helps you manage and organize these containers so that your programs run smoothly no matter where they are.


Now, we will learn about the functionalities of Kubernetes using an analogy:

Imagine you have a bakery with a superstar baker (your website) making delicious cakes (information) stored in a special box (Docker container). Business is booming, and lots of people are coming in to buy cakes. But, oh no, the baker is getting overwhelmed, and sometimes the cakes don't come out right.


  • Issue: Too many customers, and the baker (Docker container) is struggling.
  • Solution: You decide to set up another baker in a different kitchen (server) to share the workload.

Functionality: Horizontal Scaling

  • Explanation: In the digital world, we call this "Horizontal Scaling," where we duplicate our bakers (pods) to handle more customers (traffic).

This helps for a while, but your bakery becomes so famous that you're flooded with customers, and now you need even more bakers and kitchens. It's a lot of work, and you can't update the cake recipes without a headache.


  • Issue: The bakery is getting extremely popular, and you need more bakers and kitchens (servers).
  • Solution: You set up another 20+ servers (just to be sure this time), which all need Docker containers and some extra load balancers to help manage the bandwidth distribution.

Functionality: Load Balancing and Efficient Resource Management

  • Explanation: Now, you're practicing "Load Balancing" to make sure customers are evenly distributed between your servers, and you're also efficiently managing resources to handle the increased workload.

Now, imagine if you had a magical organizer (Kubernetes). Right from the start, when you had just one or two bakers, this organizer could automatically duplicate them whenever you needed. In this magical world, each baker (Docker container) is called a 'pod,' and the organizer knows exactly how many bakers you want (worker nodes).

Functionality: Pod Creation and Auto-scaling

  • Explanation: The magical organizer is Kubernetes, creating and managing 'pods' (containers) and automatically adjusting their numbers based on your needs. It's like having a dynamic baking team that grows or shrinks as the demand changes.

You simply tell the organizer (Kubernetes master) how many pods (bakers) you need, and it takes care of distributing the workload among them, making sure no baker is overworked or underworked. Plus, you can easily update your recipes (website) without breaking a sweat.

Functionality: Workload Distribution and Rolling Updates

  • Explanation: Kubernetes master efficiently distributes the workload among pods, ensuring each one is handling its fair share. When you update your recipes (website), it's like having a smooth "Rolling Update" without disrupting the entire bakery operation.

It's like having a baking manager who automatically handles everything, ensuring your bakery runs smoothly, no matter how many customers (visitors) show up. Smart, isn't it? 🍰✨

Functionality: Exposing the Bakery to the World

So these pods (bakers) that are created, and the cakes (website) that are inside them, all have their own addresses. Great, they are all accessible to the outside world, and each version of your bakery can be reached by the public and by you if you want to edit anything. can they be exposed if they are in a pod? Well, it’s one of the powerful features of Kubernetes.

Functionality: Service and Load Balancing

  • Explanation: For the outside world to view your bakery, you need to expose the pods to the network. If you tell it to, Kubernetes will spin up something called a 'Service,' acting like a diligent front-of-house staff member to make sure that none of the bakers (pods) are getting too much traffic and risking a 'crash zone.'

Functionality: Precision Load Balancing

  • Explanation: Unlike a usual front-of-house staff member (load balancer), Kubernetes Service balances the load by baker ID (pod ID), ensuring that you can control everything with a lot more precision. It's like making sure each baker is handling customers according to their individual capacity.

Functionality: Cloud Provider Load Balancer

  • Explanation: To top it all off, Kubernetes creates a load balancer in your cloud provider. This means that you update your bakery in one place, and like magic, the changes are reflected everywhere. It's like having a head chef who updates the menu centrally, and all the kitchens automatically get the latest recipes. Mind-blowing, isn't it? 🀯

From the above analogy we can conclude the following benefits of using Kubernetes:

  • Assures high availability with zero downtime
  • Highly performant and scalable
  • Reliable infrastructure to support data backup and recovery

Bonus: A video that explains Kubernetes


Over the past decade, migrating to the public cloud and adopting continuous delivery has enabled developers to move faster than ever before. accelerating their time to market from weeks to on-demand using self-service capabilities. Today developers consume the cloud like they consume coffee but they never get to see the real cost, resulting in the CFOs and finance teams receiving the bill every 30 days with little to no context. The problem today is that developers lack basic visibility into which apps or microservices are consuming cloud resources and costs. Over-provisioned infrastructure, deserted environments, zombie nodes, or even under-utilized clusters can all be cost wildfires but they go unnoticed until someone finally picks up the bill. In a world where developers are scrambling to determine the root cause of cloud cost, Tagging has become the new scripting. However, tagging cloud infrastructure with labels is a time-consuming mind-numbing, and never-ending exercise that at best is only 75% accurate in an ever-changing world.

Cost associated with k8 clusters

The cost associated with Kubernetes (K8s) clusters can vary based on several factors, including the cloud provider you choose, the type and size of instances you use, the storage requirements, network usage, and any additional services or features you employ. Here are some key factors that contribute to the cost of running Kubernetes clusters:

  1. Compute Resources (Instances): The cost of the virtual machines or instances used to run your Kubernetes nodes.
  2. Storage: The cost of persistent storage for your data within the cluster.
  3. Network Traffic: Charges related to data transfer between nodes, load balancers, and services.
  4. Managed Services: If using a managed Kubernetes service from a cloud provider, there may be additional costs.
  5. Load Balancers: Charges for using load balancing services to distribute traffic.
  6. Geographical Location: The cost of resources can vary based on the geographical region in which your Kubernetes clusters are deployed.


Optimizing cost

Let’s look at some of the ways through which the cost can be optimized focusing on primary cost factors associated with K8 clusters:

  1. Compute Resources (Instances):
    • Right-size Instances: Choose instances that match your actual workload requirements to avoid overprovisioning.
    • Auto-scaling: Implement auto-scaling to dynamically adjust the number of instances based on demand.
  2. Storage:
    • Optimize Storage: Choose the right type of storage (e.g., standard, SSD) based on your performance needs.
    • Data Lifecycle Policies: Implement automated policies for managing data lifecycle, including retention and deletion.
  3. Network Traffic:
    • Minimize Data Transfer: Optimize communication between services and regions to reduce data transfer costs.
    • Content Delivery Networks (CDNs): Use CDNs for static assets to lower data transfer costs.
  4. Managed Services:
    • Evaluate Costs: Compare the costs of using managed Kubernetes services vs. self-managed clusters.
    • Choose Efficient Services: Use only the managed services that are necessary for your application.
  5. Load Balancers:
    • Use Efficiently: Optimize the use of load balancers and consider alternatives for specific use cases.
    • Evaluate Traffic Patterns: Understand your application's traffic patterns to provision load balancers appropriately.
  6. Geographical Location:
    • Select Regions Wisely: Choose regions based on cost considerations and the geographic distribution of your user base.
    • Consider Multi-Region Strategies: Explore multi-region deployments for redundancy and cost optimization.

These tips specifically target the major cost factors associated with running Kubernetes clusters. By implementing these strategies and integrating tools, you can optimize your spending on compute resources, storage, network traffic, managed services, load balancers, and geographical considerations. Regularly review and adjust your configurations based on changing requirements to ensure ongoing cost efficiency.

Top comments (2)

get_pieces profile image
Pieces 🌟

Solid content! An insightful guide to K8s.

camelcaseguy profile image
Shubhendra Singh Chauhan

Thank you!! :)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.