Day 31 - Launching your First Kubernetes Cluster with Nginx running.

Day 31 - Launching your First Kubernetes Cluster with Nginx running.

ยท

4 min read

INTRODUCTION:

In this blog we will Launch our first Kubernetes cluster using Minikube and running an Nginx web server is a great way to get started with container orchestration and Kubernetes.

We will set up Minikube, deploy an Nginx container, and access it through your web browser.

What is Minikube?

Minikube is an open-source tool that facilitates the local deployment and management of Kubernetes clusters for development and testing purposes.

Kubernetes is a powerful container orchestration platform used for managing containerized applications at scale.

Minikube simplifies the process of setting up a small, single-node Kubernetes cluster on your local machine, allowing developers to experiment with Kubernetes features, test applications, and develop containerized software without the need for a full-scale production cluster.

Features of minikube?

Minikube is a tool designed to make it easier to run Kubernetes clusters locally for development and testing purposes.

Its features are aimed at providing a streamlined and simplified experience for developers.

Here are some of the key features of Minikube:

  1. Local Kubernetes Clusters: Minikube allows you to run a complete Kubernetes cluster locally on your computer, providing an environment that closely resembles a production Kubernetes cluster.

  2. Cross-Platform Support: Minikube is compatible with various operating systems, including Linux, macOS, and Windows, making it accessible to developers on different platforms.

  3. Easy Installation: Minikube is relatively easy to install and set up, often requiring just a single command to start a local cluster.

  4. Multiple Hypervisor Support: It supports multiple hypervisors, such as VirtualBox, VMware, KVM, and others, allowing you to choose the one that best fits your environment.

  5. Single-Node Clusters: Minikube focuses on providing single-node Kubernetes clusters, which are simpler to manage and are suitable for development and testing scenarios. This simplifies resource management compared to multi-node clusters.

  6. Automatic Kubernetes Configuration: Minikube automatically configures your kubectl command-line tool to interact with the local cluster, eliminating the need for manual configuration.

  7. Addon Support: Minikube includes a set of optional add-ons that you can enable to extend the functionality of your local cluster. Addons can include features like the dashboard, metrics server, and more.

  8. Cluster Version Management: Minikube allows you to choose and run specific Kubernetes versions, making it easy to test your applications across different Kubernetes releases.

  9. NodePort Access: It provides easy access to applications running in your Minikube cluster via NodePort, allowing you to access services from your local machine.

  10. Integration with Container Registries: Minikube supports integration with container registries, making it easier to pull container images from remote repositories.

  11. Resource Configuration: You can customize the resources allocated to your Minikube cluster, including CPU, memory, and disk space, to match your development needs.

  12. Dashboard Access: Minikube offers an optional web-based dashboard that provides a graphical interface for managing and monitoring your local cluster.

  13. Support for Network Plugins: Minikube can be configured to use different network plugins, such as CNI (Container Network Interface) plugins, to customize network settings within the cluster.

  14. Cluster Backup and Restore: Minikube includes commands for backing up and restoring your cluster's state and configuration, which can be useful for preserving your development environment.

Install Minikube on your local :

To install Minikube on your local machine, you'll need to follow a set of steps that may vary slightly depending on your operating system.

Here, I'll provide general instructions for installing Minikube on Linux, macOS, and Windows.

Installation Steps:

  1. Linux (Debian/Ubuntu):

\>> sudo apt update

\>> sudo apt install virtualbox virtualbox-ext-pack

\>> sudo apt install kubectl

Install Minikube :

\>> curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

\>> sudo install minikube-linux-amd64 /usr/local/bin/minikube

  1. macOS (Homebrew):

# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# Install VirtualBox, kubectl (if not already installed), and Minikube
brew install virtualbox kubectl minikube
  1. Windows (Powershell) :

# Install Chocolatey (package manager for Windows) if not already installed
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install VirtualBox, kubectl (if not already installed), and Minikube
choco install virtualbox kubernetes-cli minikube

Verify the installation:

minikube version

Start Minikube:

minikube start

Create your first pod on Kubernetes through Minikube.

  1. Start Minikube (if not running):
minikube start
  1. Create a Pod YAML Manifest:

Create a YAML file that describes your pod.

For example, you can create a simple pod named my-first-pod in the YAML file named my-pod.yml with the following content:

vim my-pod.yml

That's it! We have created and accessed your first pod on Kubernetes.

Pods are the fundamental units in Kubernetes.

I hope you find the blog post helpful! If you do, don't forget to like ๐Ÿ‘, comment ๐Ÿ’ฌ, and share ๐Ÿ“ข it with your friends and colleagues.

ย