Unlocking the DevOps Buffet: A Beginner’s Guide to Kubernetes and kubectl

Anette Haferkorn
5 min readFeb 14, 2024

--

Is infrastructure a mystical realm, and the word ‘kubectl’ sounds like an alien language?

Well, I’ve been there too! Two years ago, I was a software engineer happily coding away, blissfully unaware of the DevOps universe. Fast forward to today, and I’m here to share my not-so-scary beginner guide to Kubernetes and kubectl. Spoiler alert: turns out, it’s not as daunting as it sounds! 😄

What is Kubernetes?

In the digital world, deploying applications is like opening a new restaurant or setting up a play. Imagine you’ve created a fantastic recipe (your application), and now you want people to experience it.

In the real world you would need to rent a location, buy tables, chairs, forks, knives etc. Because let’s be clear: even if you’re dish is amazing if you prepare it in your private kitchen — Do you really want to invite everyone to come over to you?

I doubt it.

So here’s the thing: deploying an application means getting it ready for others to use — Not on your device. It involves setting up the environment, making sure everything works smoothly, and handling the traffic when lots of people want to use your creation.

Photo by shawnanggg on Unsplash

Now, this is where Kubernetes steps in as your digital event manager. Think of it as a friendly assistant taking care of the behind-the-scenes tasks. It helps with organizing the kitchen (nodes), ensuring each dish (containerized application) is cooked perfectly. It also makes sure the waitstaff (services) can efficiently communicate, and if there’s a sudden rush, it’s ready to handle the chaos. Kubernetes, in simple terms, is your go-to helper, making sure your digital restaurant or play runs smoothly for everyone to enjoy.

Understanding Nodes, Pods, and More in the Restaurant Metaphor

  1. Nodes — Your Restaurant Venues: In our restaurant world, Nodes are like the physical venues where your culinary magic happens. Each Node (venue) has its kitchen space and resources, just like a restaurant with its unique setup. Whether it’s a cozy bistro or a grand banquet hall, each Node plays a crucial role in serving up your delectable dishes.
  2. Pods — Culinary Creations on Stage: Now, imagine each dish (containerized application) as a Pod — a delightful creation prepared in your kitchen (Node). A Pod is a small group of dishes that share the same space, much like a chef’s special menu. They work together, ensuring your guests experience a harmonious blend of flavors. Just like a well-orchestrated kitchen, Pods make sure each dish is served to perfection.
  3. Services — Efficient Waitstaff Communication: In our restaurant scenario, Services are akin to the waitstaff. They facilitate smooth communication between different sections of the restaurant, ensuring orders are taken, and dishes are served seamlessly. Services allow your culinary creations (Pods) to communicate and collaborate, making the dining experience enjoyable for your guests.
  4. Deployments — Masterful Event Coordinators: Think of Deployments as the event coordinators overseeing your restaurant’s grand opening. They ensure that your menu (application) is introduced flawlessly to the public. Deployments manage the timing, quantity, and overall presentation, making sure that everything aligns with your vision. Just as event coordinators orchestrate the success of an opening night, Deployments ensure the smooth launch and operation of your digital restaurant.

In this culinary adventure, Kubernetes acts as the chef’s right-hand, orchestrating the whole process. It ensures that your digital restaurant runs like a well-oiled machine, providing a delightful experience for both chefs and guests alike. The Nodes, Pods, Services, and Deployments come together under the guidance of Kubernetes, creating a symphony of flavors in the world of software deployment.

kubectl — the chefs right hand

Now, let’s introduce kubectl, the magical tool that lets you, the chef-owner, manage and control your entire restaurant operation with ease. Think of kubectl as your personal assistant, allowing you to interact with different aspects of your restaurant — adjusting recipes, checking reservations, and even scaling up for a grand event. Here are some kubectl commands explained in our restaurant metaphor:

kubectl create — Crafting New Dishes:

With kubectl create, you can bring new dishes to life in your digital kitchen. In the software world, this command is used to create resources like deployments, services, or pods. For example:

kubectl create deployment sushi-deployment --image=salmon-avocado-roll-image

This command creates a new deployment named “sushi-deployment” with an image of the delectable “salmon-avocado roll.”

kubectl get — Checking the Kitchen Status:

Use kubectl get to check the status of your kitchen – find out which dishes are being prepared or see if everything is running smoothly. In the software realm, this command provides an overview of the existing resources. For example:

kubectl get dishes

This command shows you a list of all the dishes currently in your kitchen.

kubectl get pods

This command shows a list of all the pods (kitchen stations) currently operational in your digital restaurant.

kubectl describe — Getting the Inside Scoop:

Dive deep into the details of a specific dish or kitchen station with kubectl describe. This command is your backstage pass, revealing intricate information about your resources. For example:

kubectl describe deployment sushi-deployment

This command provides a detailed breakdown of the “sushi-deployment,” including its configuration, replicas, and recent events.

kubectl apply — Updating the Menu:

Keep your menu fresh and exciting using kubectl apply. In the software domain, this command applies changes defined in configuration files. For example:

kubectl apply -f new-menu.yaml

This command updates your restaurant’s menu based on the specifications in the “new-menu.yaml” file.

kubectl scale — Handling the Grand Event:

Prepare for bustling nights or special events with kubectl scale. This command adjusts the number of replicas, ensuring your dishes are prepared in abundance. For example

kubectl scale deployment sushi-deployment --replicas=5

This command scales up the “sushi-deployment,” increasing the number of replicas to handle a larger audience.

In this restaurant metaphor, kubectl becomes your trusted assistant, helping you manage, monitor, and evolve your digital kitchen with just a few commands. Whether you’re creating new dishes, checking the kitchen’s status, or preparing for a grand event, kubectl empowers you to be the master chef of your software restaurant.

Conclusion:

So, dear developers, fear not the world of DevOps! Kubernetes and kubectl are here to be your partners in crime, turning the once-scary infrastructure into a playground of possibilities. It’s time to trade in those Dev-exclusive shades for a pair that embraces both sides of the DevOps spectrum. Happy orchestrating! 😎🚀

--

--