Intro to Kubernetes(k8s)

Brief Overview of Distributed Computing, Desired State Management, Containerization & Benefits of Kubernetes

Intro to Kubernetes(k8s)

Introduction: Distributed Computing, Desired State Management, Containerization & Benefits of Kubernetes

Kubernetes, also called k8s, is a free and open source framework introduced by Google to organize container-based distributed systems in the cloud. We'll get into containers a little bit later in the article so don't worry if you're not sure what that means yet. Now, we can think of distributed systems as a group of computers working together behind the scenes for the purpose of one specific outcome. The mission of these computers working together is to maintain the desired state that the end-user can depend on to be true.

Global State vs. Desired State Management

If you've worked with React Hooks or Redux, you already understand what it means for an application to have a global state. But if you are unfamiliar with the term, I like to think of a global state using a supermarket analogy. When you go to the supermarket and put items in your cart, each item costs a specific amount. And when you go to the register to pay for all the items, with taxes included, they're going to add up to one final amount. That final total for which you are responsible is the global state of all items that we move from our cart onto our cashier's conveyer belt en route to the price scanner.

With that said, global state and desired state are not the same.

Let's say, we only plan on spending a certain amount because that is what our budget allows. As our cashier rings up our items, we might notice that we are approaching the desired amount we are planning to spend. This would cause us to reconsider some of the items we originally put on the belt. We might ask our cashier to refund some items in order to check out with all of our needs versus some of our wants.

Having an awareness of available resources while being responsive and adaptable to change, is how I've come to understand desired state management.

What does maintaining the desired state have to do with distributed computing systems?

asia_lazer.jpeg

PROOF: At one point, I was NOT born a fully grown human person! :)

Let's continue with the supermarket analogy. When I was a little girl, my mother and I would go to the supermarket. In order for us to check out as quickly as possible, she would scan the lanes and tell me to go stand in one line while she stood with the cart in another. As we each got closer to the checkout she would make the decision of which aisle to actually check out in based on how close either of us ended up being to the cashier.

Her decision-making process would be a good way to think of what it means to scale horizontally. The opposite of horizontal scaling is to scale vertically. Scaling vertically would mean that we had some control over how fast one cashier would ring up items. While not impossible, it would require more resources- i.e. giving the cashier an espresso shot or an energy drink.

If we connect this analogy to global state and desired state, no matter which lane we ended up checking out in, at the end of the trip to the supermarket, the same global state, or single point of truth - the total amount of money spent shopping, would be the same. BUT, managing the desired state, getting in and out of line, within budget as quickly and efficiently as possible, would be dependent on my mother's decision to allocate her human resources in choosing our checkout line and deciding at the moment what we needed versus what we wanted.

scaling.png

Source: Stack Overflow

Additionally, by scaling horizontally, we ended up saving time spent waiting in line by distributing available resources, or the number of bodies waiting in separate lines. To reiterate, in computing terms, "horizontal scaling means adding more machines to the pool, where vertical scaling means adding more power to one existing machine. " At its core, distributed computing allows for horizontal distribution of resources to efficiently manage the desired state.

Containers, Containerization, and Container Orchestration with Kubernetes

Now that we have an understanding of how distributed systems work, let's look a little closer at how containerization helps us organize these types of systems. First, we'll want to define a few key terms.

kubernetesin5.png

VIDEO: Kubernetes in 5 mins

A container:

  1. is an executable unit of software, i.e. file, program, or application able to be run on a computer
  2. bundles up an application's code and dependencies, or other software that the code relies on
  3. allows the software unit to run quickly and predictably across platforms including desktop and cloud.

Containerization:

  1. provides developers the ability to build and deploy programs faster and more securely
  2. keeps code isolated, making it easier to find and fix bugs while letting the other containers within the project maintain uptime.
  3. through container orchestration platforms, the most popular being Kubernetes, make containerized apps easier to manage.

Container orchestration sets up the process of automatically managing the lifecycle of containers. This includes:

Now that we have an overview of Distributed computing, container orchestration mean, let's get into Kubernetes.

In conclusion, here's why I believe Kubernetes is a valuable DevOps solution for developers working in the cloud.

Kubernetes, or k8s, can run on multiple hardware or operating systems and is designed to allow the addition of new capabilities and functionalities. As mentioned earlier, it is open source. Click here to view the codebase on Github. While there are others, such as Docker Swarm and Apache Mesos, as mentioned earlier Kubernetes is the most popular container orchestration platform. You'll find most cloud service providers such as Amazon Web Services(AWS), Microsoft Azure, IBM Cloud, and Google Cloud all provide Kubernetes services.

When we talked about container orchestration, we covered many of the benefits of container orchestration platforms. In closing, Here are just a few of the benefits of running distributed computing systems with Kubernetes.

  1. Being that applications and services are distributed across containers, each container has its own IP address. This arrangement allows Kubernetes to use service discovery to automatically find issues related to network traffic and automatically balance the load, ensuring the deployment remains stable.

  2. If containers fail, Kubernetes can restart, replace, or kill containers and keep them unavailable to clients until they are ready to serve.

  3. In Kubernetes, you can protect sensitive information including passwords, SSH keys, OAuth tokens, and passwords.

To learn more about Kubernetes, the Kubernetes API, and working with Kubernetes objects, check out the docs by clicking here. If you are interested in learning Kubernetes basics through an interactive tutorial that runs in the browser, click here.

If you found this introduction helpful and would like a follow-up to this post, please drop a line in the comments section. Also, this topic is new to me as well, feel free to drop a line with any corrections that may help to explain the topic more clearly. Thanks for taking the time to learn along with me.

References

m.youtube.com/watch?v=PH-2FfFD2PU

kubernetes.io/docs/concepts/overview/what-i..

github.com/kubernetes/kubernetes

freecodecamp.org/news/a-thorough-introducti..

cio.com/article/2924995/what-are-containers..

ibm.com/cloud/learn/containers#:~:text=Cont...

ibm.com/cloud/learn/containerization

redhat.com/en/topics/automation/what-is-pro..

ibm.com/cloud/learn/container-orchestration

webopedia.com/definitions/container-managem..

kubernetes.io/docs/concepts/services-networ..

kubernetes.io/docs/tasks/access-application..