Category : Kubernetes | Sub Category : Kubernetes With Java | By Prasad Bonam Last updated: 2023-11-21 10:56:25 Viewed : 222
Minikube is a tool that allows you to run a single-node Kubernetes cluster on your local machine. It is a great way to get started with Kubernetes without the need for a full-scale cluster. Here is a step-by-step guide to getting started with Minikube:
Install Virtualization Software:
Install kubectl:
kubectl
is the command-line tool for interacting with a Kubernetes cluster.kubectl
on your local machine.bashcurl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb sudo dpkg -i minikube_latest_amd64.deb
bashbrew install minikube
Download the Minikube installer for Windows and add the executable to your system PATH.
Open a terminal and run the following command to start Minikube:
bashminikube start
This command downloads the Minikube ISO, creates a virtual machine, and starts the Kubernetes cluster.
To verify that Minikube is running, use the following command:
bashminikube status
You should see a message indicating that the cluster and kubectl are running.
To view the Kubernetes dashboard in your default web browser:
bashminikube dashboard
To check the status of the Minikube cluster:
bashminikube status
To stop the Minikube cluster:
bashminikube stop
Create a simple deployment YAML file (nginx-deployment.yaml
):
yamlapiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
Apply the deployment to the Minikube cluster:
bashkubectl apply -f nginx-deployment.yaml
Expose the deployment as a service:
bashkubectl expose deployment nginx-deployment --type=LoadBalancer --port=80
Retrieve the service URL:
bashminikube service nginx-deployment --url
Open the provided URL in your web browser to access the running NGINX application.
When you are done experimenting with Minikube, you can stop or delete the cluster:
To stop the Minikube cluster:
bashminikube stop
To delete the Minikube cluster:
bashminikube delete
This guide provides a basic introduction to Minikube and deploying a simple application. As you become more comfortable, you can explore additional features, configurations, and use Minikube to experiment with various aspects of Kubernetes locally.