Getting Started with Kubernetes: Deploying Your First Minikube Container

Getting Started with Kubernetes: Deploying Your First Minikube Container
Continuing our Kubernetes series, we move from understanding concepts to hands-on action! This guide focuses on setting up Minikube and deploying your first container in a Kubernetes environment. Following the foundational knowledge shared in our Mastering Kubernetes: Core Concepts, Key Components, and Introduction to Minikube for Beginners, this tutorial will walk you through initializing Minikube, creating a deployment, and managing your containerized application easily. If you're eager to dive into Kubernetes practically, this post is your perfect starting point!

Pre-Requirement for a Minikube

  • Minikube Binary: Download and install the minikube.exe from minikube.sigs.k8s.io
  • kubectl: Install the kubectl by entering minikube kubectl in the terminal
  • Docker: Download and install docker from Docker.com

Setting Up Minikube

Step 1: Verify Docker Installation

  • To check if Docker is installed and running correctly:
docker --version
docker run hello-world

Step 2: Start Minikube with Docker Driver

  • Run the following command to start Minikube using Docker as the driver:
minikube start --driver=docker

Step 3: Verify Minikube Setup

  • After the setup completes, verify that Minikube is running:
minikube status
  • To check cluster details:
kubectl get nodes

Step 4: Interact with Minikube

  • You can now deploy your first containerized application. For example, to deploy a basic Nginx server:
kubectl create deployment nginx --image=nginx
kubectl expose deployment nginx --type=NodePort --port=80
  • Get the service's URL:
minikube service nginx
  • The URL automatically opens in your browser to see the Nginx server running.

Step 5: Deleting the Deployment

  • To delete the running deployment and service
kubectl delete deployment nginx
kubectl delete service nginx

Step 6: Managing Minikube

  • To pause the cluster
minikube pause
  • To stop the cluster:
minikube stop
  • To delete the cluster:
minikube delete

Conclusion

Setting up Minikube with Docker provides a lightweight and efficient way to explore Kubernetes on your local machine. With this setup, you’re now ready to dive deeper into container orchestration, deployments, and scaling. Stay tuned for more hands-on Kubernetes tutorials!