Kubernetes has become the go-to orchestration platform for managing containerized applications at scale. Whether you're a seasoned developer or just starting, Minikube offers a convenient way to set up a local Kubernetes cluster for development and testing purposes. In this guide, we'll walk through the steps to get Minikube up and running on an Ubuntu system and deploy a simple application.
Prerequisites
Before diving into the world of Kubernetes, let's ensure that your system is ready for the journey. Open a terminal and run the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y kubectl
This will update your package list, upgrade existing packages, and install kubectl, the command-line tool for interacting with Kubernetes clusters.
Installing Minikube
Now that we have kubectl installed, let's proceed with Minikube installation:
cd /tmp/
sudo curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
sudo chmod +x kubectl
sudo mv kubectl /usr/local/bin/
Next, download and install Minikube:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Starting Minikube
With Minikube installed, let's start our local Kubernetes cluster:
minikube start --driver=wsl
Alternatively, you can use the Docker driver:
minikube start --driver=docker
Check the status of your Minikube cluster:
minikube status
Deploying a Simple Application
Now, let's deploy a straightforward "Hello, World!" application on our Minikube cluster:
kubectl create deployment hello-world --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-world --type=NodePort --port=8080
Check the details of the service:
kubectl get service hello-world
Use Minikube to open the application in your default web browser:
minikube service hello-world
Alternatively, you can use curl to access the application:
curl http://localhost:<NODE_PORT>
Replace <NODE_PORT> with the actual port obtained from the previous step.
Conclusion
Congratulations! You've successfully set up Minikube on Ubuntu and deployed a simple application on your local Kubernetes cluster. This is just the beginning of your Kubernetes journey, and there's a lot more to explore and learn.
Remember to experiment with different applications, explore Kubernetes features, and stay curious. If you have any questions or run into issues, feel free to reach out to the vibrant Kubernetes community for support.
Happy Kuberneting!
Comments
Post a Comment