Skip to content

Subham-Maity/kubernetes_tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 

Repository files navigation

Kubernetes Made Simple ๐Ÿ™Œ

Welcome to the world of Kubernetes! In this article, we'll break down the basics of Kubernetes in a fun and engaging way. Let's dive in! ๐Ÿš€

What is Kubernetes? ๐Ÿค”

Kubernetes, often abbreviated as K8s, is an open-source container orchestration platform that automates deploying, scaling, and managing containerized applications. In simpler terms, it helps you manage and scale your applications effortlessly.

Why should we use Kubernetes? ๐ŸŒŸ

Kubernetes solves a common problem that many developers and operators have when running apps at scale: how to handle the complexity and variety of the infrastructure and the app lifecycle.

Before Kubernetes, you had to deal with many headaches, such as:

  • How to spread your apps across multiple machines or regions?
  • How to make sure your apps are always up and running?
  • How to adjust your apps based on demand or performance?
  • How to change your apps without annoying the users or losing data?
  • How to share the load across your apps and use resources wisely?
  • How to keep an eye on your apps and fix issues?
  • How to manage the settings and secrets of your apps safely?

These headaches can be stressful and time-consuming, especially when you have to work with different platforms, tools, languages, frameworks, etc.

Kubernetes makes these headaches go away by giving you a simple and consistent way of managing your apps on any platform. You can use Kubernetes to:

  • Describe your apps using YAML or JSON files that say what you want (e.g., how many copies, what image to use, what ports to open, etc.)
  • Apply these files to a Kubernetes cluster using a command-line tool called kubectl
  • Let Kubernetes do the rest and make your apps match what you want
  • Use kubectl or a web dashboard to check and control your apps
  • Use various features and tools from Kubernetes or its ecosystem to improve your apps (e.g., service discovery, load balancing, logging, monitoring, etc.)

By using Kubernetes, you can focus more on making your apps awesome and less on managing their infrastructure.

So we use Kubernetes for :

  • Scalability: Kubernetes makes it easy to scale your applications up or down as needed.
  • High availability: It ensures your applications are always up and running, even in the event of failures.
  • Portability: Kubernetes works with various container runtimes and can be used across different cloud providers or on-premises environments.
  • Efficient resource utilization: It optimizes the use of resources like CPU and memory, ensuring your applications run efficiently.
  • Scales your apps: Kubernetes can make more or less pods depending on how busy your app is. This helps your app run faster and cheaper.
  • Fixes your apps: Kubernetes can find and fix broken pods, or move them to another machine if needed. This makes your app more reliable and secure.
  • Balances your apps: Kubernetes can spread the traffic among your pods, so that none of them get overloaded. This makes your app more responsive and stable.
  • Finds your apps: Kubernetes can give names and addresses to your pods, so that they can find each other easily. You don't have to worry about updating files or codes when things change.
  • Configures your apps: Kubernetes can give settings and secrets to your pods, so that they can use them without exposing them. You can also change these settings without rebuilding or restarting your pods.
  • Updates your apps: Kubernetes can change your pods with new versions without any downtime. You can also go back to the old version if something goes wrong.

Kubernetes in Action ๐ŸŽฌ

Let's take a look at some key components of Kubernetes and how they work together to manage your applications.

Kubectl ๐ŸŽฎ

kubectl is the command-line tool used to interact with the Kubernetes cluster. It allows you to create, update, and delete resources, as well as view the current state of your cluster.

Control Plane ๐Ÿง 

The control plane is the set of components that manage the overall state of the cluster. It includes:

Cluster is a set of nodes that run containerized applications. Each cluster has a master node and one or more worker nodes.

  • API Server: The main entry point for all administrative tasks.
  • etcd: A distributed key-value store that stores the configuration data of the cluster.
  • Controller Manager: Manages the core control loops in Kubernetes.
  • Scheduler: Assigns workloads to nodes based on resource requirements and other constraints.

Nodes ๐Ÿ–ฅ๏ธ

Nodes are the worker machines that run your applications. Each node runs a container runtime (like Docker) and the kubelet, which communicates with the control plane to ensure the desired state of your applications is maintained.

Config (dburl) ๐Ÿ“

ConfigMaps are used to store non-sensitive configuration data, like database URLs, in key-value pairs. They can be mounted as environment variables or files in your containers.

Secrets (env) ๐Ÿ”’

Secrets are similar to ConfigMaps but are used to store sensitive data, like passwords or API keys. They can also be mounted as environment variables or files in your containers.

Deployment ๐Ÿš€

A Deployment is a higher-level abstraction that represents a container image and its desired state. It wraps the control plane and makes it available to all nodes in the cluster.

Challenge: Deploy MongoDB in Kubernetes ๐Ÿ†

To deploy MongoDB in Kubernetes, you would create a Deployment and a Service to expose it to the internal network. You would also use a ConfigMap for the database URL and a Secret for any sensitive data.

Kubernetes Services ๐ŸŒ

Services are used to expose your applications to the internal network or the internet. They provide a stable IP address and load balance traffic between multiple instances of your application.

NodePort ๐Ÿšช

NodePort is a type of Service that exposes your application on a specific port on each node in the cluster. This is useful for development and testing purposes but is not recommended for production use.

Running Kubernetes Locally with Minikube ๐Ÿ 

Minikube is a tool that allows you to run a single-node Kubernetes cluster on your local machine. It's perfect for learning and testing purposes. To get started, simply install Minikube and run minikube start.

That's it! You're now ready to explore the world of Kubernetes. ๐ŸŒŽ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published