Intro

Introduction

In this guide, we will explore the world of Kubernetes and learn how to deploy applications using its powerful features.

What we will cover

Kubernetes Intro

  • Introduction to Kubernetes
  • Why Kubernetes? Benefits and use cases

Docker

  • What is Docker?
  • Writing a Dockerfile
  • Building and running Docker images
  • Pushing and pulling images

Pod

  • What is a Pod?
  • Writing Pod manifests
  • Deploying and managing Pods in Kubernetes

Deployment

  • What is a Deployment?
  • Writing Deployment manifests
  • Scaling applications
  • Performing rolling updates and rollbacks

Configmap / Secrets

  • What are ConfigMaps?
  • What are Secrets?
  • Use cases and examples

Service

  • What is a Service?
  • Types of Services: ClusterIP, NodePort, LoadBalancer
  • Writing Service manifests
  • Exposing applications within the cluster

Ingress

  • What is Ingress?
  • Writing Ingress manifests
  • Path-based and host-based routing
  • TLS/SSL

Helm

  • What is Helm?
  • Understanding Helm charts
  • Creating and managing Helm charts
  • Deploying applications with Helm

What is Kubernetes?

The purpose of Kubernetes is to host your applications as containers, automating their deployment and management. It allows you to scale your application instances effortlessly and facilitates seamless communication between different services within your application.

Worker Node in the cluster are ships that can load containers. But somebody needs to load the containers on the ships and not just load, plan how to load, identify the right ships, store information about the ships, monitor and track the location of containers on the ships, manage the whole loading process etc. This is done by the controller ships that host different offices and departments, monitoring equipments, communication equipments, cranes for moving containers between ships etc.

Hello

💡

Master node in public cloud services for Kubernetes are managed by the cloud provider. This ensures maintenance, updates, and high availability, allowing users to focus on their applications without worrying about the infrastructure.

5 Most Important Benefits of Using Kubernetes

  1. Scalability: Kubernetes can automatically scale your applications up or down based on demand, ensuring that your services can handle varying loads efficiently.

  2. High Availability: Kubernetes ensures that your applications are always available by automatically managing and distributing workloads across multiple nodes, providing built-in redundancy and failover mechanisms.

  3. Automated Rollouts and Rollbacks: Kubernetes automates the deployment of new versions of your application and can roll back to previous versions if something goes wrong, reducing downtime and minimizing deployment errors.

  4. Self-Healing: Kubernetes automatically restarts failed containers, replaces unresponsive nodes, and reschedules containers when nodes die, ensuring continuous operation and minimal manual intervention.

  5. Infrastructure Abstraction: Kubernetes abstracts away the underlying infrastructure, allowing you to run your applications on any cloud provider or on-premises data center without changes, providing flexibility and avoiding vendor lock-in.

Let's discover nodes on cluster

To see the nodes in our cluster, use the following command:

kubectl get nodes

This command displays a list of all nodes in the cluster.

If you want to know more about the nodes, you can use the following command to show their labels. Labels provide additional information about the nodes.

kubectl get nodes --show-labels

Alternatively, you can use this command to format the output in a more readable JSON format:

kubectl get nodes -o json | jq -r '.items[] | {name: .metadata.name, labels: .metadata.labels}'

Namespaces

Namespaces in Kubernetes are used to organize and manage resources in a cluster. To see the namespaces in our cluster, use the following command:

kubectl get namespaces

or

kubectl get ns

This command displays a list of all namespaces in the cluster.

To create a new namespace, use the following command. Replace namespace-name with the desired name of your new namespace:

kubectl create namespace namespace-name

Replace namespace-name with the name of the namespace you want to switch to. This command sets the namespace for the current context, allowing you to work within the specified namespace.

kubectl config set-context --current --namespace=namespace-name