
Welcome back to our Kubernetes series! Last week, we explored the basics of Kubernetes. This week, we're diving into setting up a local Kubernetes cluster using Minikube. Minikube is a tool that lets you run Kubernetes locally, making it an excellent option for development and learning.
What is Minikube?
Minikube is a lightweight Kubernetes implementation that creates a virtual machine on your local machine and deploys a simple Kubernetes cluster. It supports most Kubernetes features and is perfect for developers who want to test Kubernetes locally before deploying to a production cluster.
Prerequisites
Before we get started, ensure you have the following installed on your machine:
Virtualization: Ensure your system supports virtualization (VT-x or AMD-v).
Hypervisor: Install a hypervisor like VirtualBox, Hyper-V, or Docker.
kubectl: The Kubernetes command-line tool. You can download it from here [https://kubernetes.io/docs/tasks/tools/].
Minikube: You can download Minikube from below command .
For Linux User:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
For Windows User:
winget install minikube
OR
Download the .exe installer in your system and set ENV
https://storage.googleapis.com/minikube/releases/latest/minikube-installer.exe
For Mac User:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube
I installed it in my V-Box_6 + Ubuntu-22.0
Step-by-Step Guide to Setting Up Minikube
1. Install Minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
2. Start Minikube
minikube start --driver=docker
3. Verify Minikube Installation
minikube status
4. Now Interact with Minikube using kubectl which we Installed earlier.
kubectl get nodes
5. Deploy You First Application
$ kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
Expose the deployment as a service:
$ kubectl expose deployment hello-minikube --type=NodePort --port=8080
Get the URL of service:
$ minikube service hello-minikube --url
6. Enable Dashboad of Minikube
$ minikbe dashboard --url
Troubleshooting Common Issues
Virtualization Not Enabled: Ensure virtualization is enabled in your BIOS settings.
Minikube Start Failures: Try starting Minikube with a specific driver, e.g., minikube start --driver=virtualbox OR minikube start --driver=docker
Resource Constraints: Adjust CPU and memory allocation for Minikube using the --cpus and --memory flags, e.g., minikube start --cpus=2 --memory=2048.
Url's
https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Fx86-64%2Fstable%2Fbinary+download
Kommentare