Showing posts with label Kubernetes. Show all posts
Showing posts with label Kubernetes. Show all posts

Saturday 2 March 2024

Kubernetes: Orchestrating Containers like a Maestro 🪄

 



In the ever-evolving world of containerized applications, managing and scaling them effectively becomes paramount. Enter Kubernetes, an open-source container orchestration platform that has revolutionized how we deploy, manage, and scale containerized applications.

Developed by Google and released in 2014, Kubernetes (often abbreviated as "k8s") has become the de facto standard for container orchestration. It acts as a maestro, automating the deployment, scaling, and operations of containerized applications across clusters of hosts. orchestrator ‍

But why Kubernetes?

Traditional application deployments often involved manual processes and complex configurations, making scaling and managing applications cumbersome. Kubernetes simplifies this process by providing a platform to:

  • Automate deployments and scaling: Define your application's desired state, and Kubernetes takes care of deploying and scaling containers to meet that state.
  • Manage container lifecycles: Kubernetes handles container creation, deletion, and health checks, ensuring your application remains healthy and responsive.
  • Facilitate service discovery and load balancing: Kubernetes enables applications to discover and communicate with each other easily, while also providing built-in load balancing for distributing traffic across container instances. ⚖️
  • Self-healing capabilities: If a container fails, Kubernetes automatically restarts it, ensuring your application remains highly available.

How does Kubernetes work? ⚙️

At the heart of Kubernetes lies a cluster architecture composed of various components:

  • Master node: The brain of the operation, responsible for scheduling container workloads across worker nodes and managing the overall state of the cluster.
  • Worker nodes: The workhorses of the cluster, running containerized applications as instructed by the master node. ️
  • Pods: The smallest deployable unit in Kubernetes, consisting of one or more containers that share storage and network resources.
  • Deployments: Manage the desired state of your application by deploying and scaling pods.
  • Services: Abstractions that expose pods to other applications or users within the cluster. ✨

Here's a simplified example:

  1. You define your application as a set of containerized services using YAML files.
  2. You deploy the application using kubectl, the Kubernetes command-line tool.
  3. The master node schedules the pods containing your containers across available worker nodes in the cluster.
  4. Kubernetes manages the lifecycles of your pods, ensuring they run healthy and scaled as needed.

Exploring Further:

For a deeper dive into Kubernetes, check out the following resources:

By embracing Kubernetes, you can streamline your containerized application deployments, gain better control over your infrastructure, and empower your development teams to focus on building innovative applications, not managing infrastructure complexities.

Remember, this is just a glimpse into the vast world of Kubernetes. As you explore further, you'll discover its extensive capabilities and how it can empower you to build and manage modern, scalable applications like a maestro! 🪄

Monday 16 October 2023

List of the best Terraform infrastructure as Code Books, based on Readers feedback.

Based on readers’ feedback, here are some of the best books on Terraform Infrastructure as Code:



  • Continuous Delivery with Jenkins, Kubernetes, and Terraform: by Mohamed Labouardy. This book is a practical guide to automating your development pipeline in a cloud-native, service-driven world. It covers topics like the basics of Terraform and Jenkins, how to use Jenkins for code-driven CI/CD pipelines, and mastering the usage of Terraform for code-based infrastructure management.
Continuous Delivery with Jenkins, Kubernetes, and Terraform: by Mohamed Labouardy12


  • Terraform: Up & Running: Writing Infrastructure as Code by Yevgeniy (Jim) Brikman. This hands-on book shows you how to get up and running with Terraform fast. It covers topics like manual and automated testing for Terraform code, comparing Terraform to Chef, Puppet, Ansible, CloudFormation, and Salt Stack, and deploying server clusters, load balancers, and databases. It also important to mention here, this book is at 3rd edition already.


Terraform in Action




  • Terraform Cookbook: Efficiently define, launch, and manage Infrastructure as Code across various cloud platforms. This book is ideal for those who are new to Terraform and want to learn more about it.



Please, bear in mind that the availability of these books may vary. I recommend checking them out on your preferred book retailer or library.

1 - Here I can leave you guys with some more learning/Reading resources - GitHub - shuaibiyy/awesome-terraform: Curated list of resources on HashiCorp's Terraform

2 - Hashicorp Terraform source documentation - https://developer.hashicorp.com/terraform/docs 

3 - Master Terraform: A cheat sheet for infrastructure automation - https://www.architect.io/blog/2023-02-02/terraform-cheat-sheet/ 






Wednesday 23 March 2022

Terraform Availability Zone on Azure Deployment. Documentation and Good Examples Missing..



While learning Terraform some time back, I wanted to leverage Availability Zones in Azure. I was specifically looking at Virtual Machine Scale Sets.  https://www.terraform.io/docs/providers/azurerm/r/virtual_machine_scale_set.html 

Looking at the documentation Terraform has, I noticed there is no good example on using zones. So, I tried a few things to see what was really needed for that field. While doing some research, I noticed there are many people in the same situation. No good examples. I figured I'd create this post to help anyone else. And, of course, it's a good reminder for me too if I forget the syntax on how I did this.

Here's a very simple Terraform file. I just created a new folder then a new file called zones.tf. Here's the contents:

variable "location" {
description = "The location where resources will be created"
default = "centralus"
type = string
}

locals {
regions_with_availability_zones = ["centralus","eastus2","eastus","westus"]
zones = contains(local.regions_with_availability_zones, var.location) ? list("1","2","3") : null
}

output "zones" {
value = local.zones
}


The variable 'location' is allowed to be changed from outside the script. But, I used 'locals' for variables I didn't want to be changed from outside. I hard coded a list of Azure regions that have availability zones. Right now it's just a list of regions in the United States. Of course, this is easily modifiable to add other regions.

The 'zones' local variable uses the contains function to see if the specified region is in that array. If so, then the value is a list of strings. Else it's null. This is important. The zones field in Azure resources required either a list of strings or null. An empty list didn't work for me.

As it is right now, you can run the Terraform Apply command and you should see some output. Changing the value of the location variable to something not in the list and you may not see output at all simply because the value is null.

Now, looking at a partial example from the Terraform documentation:

resource "azurerm_virtual_machine_scale_set" "example" { name = "mytestscaleset-1" location = var.location resource_group_name = "${azurerm_resource_group.example.name}" upgrade_policy_mode = "Manual" zones = local.zones

Now the zones field can be used safely when the value is either a list of strings or null. After I ran the complete Terraform script for VM Scale Set, I went to the Azure Portal to verify it worked.

I also changed the specified region to one that I know does not use Availability Zones, South Central US.

This proved to me that I can use a region with and without availability zones in the same Terraform script.

For a list of Azure regions with Availability Zones, see:
https://docs.microsoft.com/en-us/azure/availability-zones/az-overview

Friday 29 March 2019

What is Kubernetes? Container orchestration explained


Docker containers have reshaped the way people think about developing, deploying, and maintaining software. Drawing on the native isolation capabilities of modern operating systems, containers support VM-like separation of concerns, but with far less overhead and far greater flexibility of deployment than hypervisor-based virtual machines.


Containers are so lightweight and flexible, they have given rise to new application architectures. The new approach is to package the different services that constitute an application into separate containers, and to deploy those containers across a cluster of physical or virtual machines. This gives rise to the need for container orchestration—a tool that automates the deployment, management, scaling, networking, and availability of container-based applications.


Enter Kubernetes. This open source project spun out of Google automates the process of deploying and managing multi-container applications at scale. While Kubernetes works mainly with Docker, it can also work with any container system that conforms to the Open Container Initiative (OCI) standards for container image formats and runtimes. And because Kubernetes is open source, with relatively few restrictions on how it can be used, it can be used freely by anyone who wants to run containers, most anywhere they want to run them.

How to Create a Ansible Lab on your Local Machine using Vagrant in 5 min using ChatGPT

This is an exciting experiment of mine as DevOps. As I am experimenting with the Tools available ... So, the quest is to " Vagrantfile ...