Open In App

How To Set Up Master-Slave Architecture Locally in Kubernetes?

Pre-requisite: Kubernetes

Kubernetes is an open-source container orchestration system for automating containerized applications’ deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF). Kubernetes helps you deploy and manage containerized applications at scale more efficiently and resiliently. It provides features such as declarative configuration, self-healing, and horizontal scaling.



Components in Kubernetes Architecture

Minikube

Minikube is a tool that allows you to run Kubernetes locally on your computer. It is a lightweight, easy-to-use Kubernetes cluster that is great for developing and testing applications. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your local machine. It is a great way to get started with Kubernetes and learn how it works.

To use Minikube, you need to install a hypervisor (such as VirtualBox or VMware Fusion) and the Minikube binary on your local machine. Then, you can start Minikube and deploy your applications to the cluster. Minikube also provides a built-in dashboard that you can use to manage and monitor your applications.



Minikube is a useful tool for developers who want to test their applications in a Kubernetes environment without the need for a full-fledged cluster. It is also useful for learning and experimentation with Kubernetes.

Installation

That’s it! You have successfully installed Minikube on your local machine. You can now deploy your applications to the Minikube cluster and start experimenting with Kubernetes.

Note: These are the basic steps to install Minikube. The exact steps may vary depending on your operating system and the hypervisor you are using.

Let’s test whether Kubernetes is working or not with an example

Deploying Ngnix in Minikube Cluster

Step 1: Create nginx-deployment.yaml file

 

$ kubectl apply -f  nginx-deployment.yaml

Step 2: Create Nginx-Service.yaml to Expose the deployment

 

Step 3: The kubectl get all command retrieves all the pods, services, deployments, replica sets, and pods in the cluster. It shows the name, ready status, age, and other details of each resource.

$ kubectl get all

 

Step 4: Generating URL to Access our Webpage

The minikube service command is used to access the service in a Minikube cluster. It opens the service in a web browser or prints the service’s URL to the console. You can also use the –url flag to print the service’s URL to the console, regardless of the service type.

 

Step 5: Accessing our service through a web browser

nginx webpage 

Article Tags :