Running Kubernetes Locally with Minikube
Deploying a Sample Application
- Create a new Kubernetes deployment using the LabEx NGINX image:
kubectl create deployment labex-nginx --image=labex/nginx:latest
- Expose the deployment as a Kubernetes service:
kubectl expose deployment labex-nginx --type=NodePort --port=80
- Check the status of the deployment and service:
kubectl get deployment,service
You should see the LabEx NGINX deployment and service running in your Minikube cluster.
Accessing the Application
- Retrieve the URL to access the LabEx NGINX application:
minikube service labex-nginx --url
This command will provide the URL you can use to access the application in your web browser.
- Open the application in your web browser:
open $(minikube service labex-nginx --url)
You should see the LabEx NGINX welcome page.
Scaling the Application
- Scale the LabEx NGINX deployment to 3 replicas:
kubectl scale deployment labex-nginx --replicas=3
- Verify the scaled deployment:
kubectl get deployment labex-nginx
You should see that the deployment now has 3 replicas running.
Updating the Application
- Update the LabEx NGINX deployment to use a newer version of the image:
kubectl set image deployment/labex-nginx labex-nginx=labex/nginx:v2
- Monitor the rollout progress:
kubectl rollout status deployment labex-nginx
This will show the deployment updating to the new version of the LabEx NGINX image.
By following these steps, you have successfully deployed, scaled, and updated a sample LabEx NGINX application running on your local Minikube Kubernetes cluster.