๐ Deploying "Hello World" in Minikube with Nginx
Setting up "Hello World" in Minikube using Nginx is a great starting point for anyone learning Kubernetes. This post walks you through the steps to achieve this, even if you're new to the world of containers and Kubernetes.
๐ก What You'll Learn:
-
Install Minikube and start a cluster
-
Deploy Nginx and expose a "Hello World" page
-
Verify the setup with a browser and a simple Kubernetes service
๐ ๏ธ Step 1: Install Minikube
Before starting, make sure you have Minikube installed. If not, follow these instructions:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& sudo install minikube-linux-amd64 /usr/local/bin/minikube
Once installed, start the cluster:
minikube start
โ Pause to verify: At this point, Minikube should be running. You can verify it with:
kubectl get nodes
๐ ๏ธ Step 2: Deploy Nginx with a Hello World page
Now, we will deploy a simple Nginx container with a custom "Hello World" page.
- Create a deployment:
kubectl create deployment helloworld --image=nginx
- Expose the deployment as a service:
kubectl expose deployment helloworld --type=NodePort --port=80
This creates a service that exposes port 80 of the Nginx container.
๐ ๏ธ Step 3: Accessing the Service
Now that your Nginx deployment is up and running, access it using the following command to get the URL:
minikube service helloworld --url
Copy the provided URL and open it in your browser. You should see the "Welcome to Nginx!" default page.
๐ก Customizing the "Hello World" Page
If you'd like to customize the message, you can create a ConfigMap and update the default Nginx index.html file. Here's how:
- Create a
ConfigMap:
kubectl create configmap helloworld-config --from-literal=index.html="
Hello World from Nginx on Minikube!
"- Apply the
ConfigMapto your Nginx deployment:
kubectl set volume deployment/helloworld --add --name=helloworld-config --mount-path=/usr/share/nginx/html --sub-path=index.html --configmap-name=helloworld-config
๐ผ๏ธ Adding a Screenshot
After deploying Nginx, grab a screenshot of the running service from your browser and include it here to show the Hello World page in action!
๐ฏ Summary
Youโve now successfully:
-
Installed Minikube and started a Kubernetes cluster.
-
Deployed an Nginx web server with a simple "Hello World" message.
-
Exposed the service for browser access.
With this foundation, you're ready to dive deeper into Kubernetes and explore more complex deployments!
๐ Connect with me:
-
๐ผ LinkedIn: Rifat Erdem Sahin
-
๐ฆ Twitter: @rifaterdemsahin
-
๐ฅ YouTube: Rifat Erdem Sahin
-
๐ป GitHub: @rifaterdemsahin
Imported from rifaterdemsahin.com ยท 2025