Kubernetes Cluster for Local Development with Minikube
Minikube Installation
Deploy Nginx WebServer In Kubernets Cluster Setup via Minikube
From Official Documentation:
# Minikube Cluster supports
- Dashboard to manage cluster.
- ConfigMaps to store configurations.
- Secrets to store secrets related to your application.
- NodePorts
- Various Container Runtime like: Docker, rkt etc
- Container Network Interface (CNI)
- Ingress
# End Goal
- Minikube installed.
- Little hands on with Minikube commands
- Deploy Nginx webserver in kubernetes cluster formed by minikube
# Prerequisites
- Hypervisor installed. For Linux: VirtulBox or KVM, for OSX: VirtualBox or HyperKit.
- Kubectl installed.
# Video Tutorial
# Installation Steps
- For Linux:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.26.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- For OSX:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.26.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
Minikube is ready to use.
2. To stop Minikube Cluster
3. To check Status
4. To launch dashboard
2. Create service to expose the nginx web server
4. Get endpoint and port on which nginx service is running, so that it can be accessed.
Open above url in browser, you will see, nginx webserver up and running.
Once you have setup minikube, you might be interested in setting up kubernetes cluster for production - How To Setup Kubernetes Cluster
# Minikube Useful Commands
1. To start Minikube Cluster$ minikube start Starting local Kubernetes cluster... Running pre-create checks... Creating machine... Starting local Kubernetes cluster...
2. To stop Minikube Cluster
$ minikube stop Stopping local Kubernetes cluster... Stopping "minikube"...
3. To check Status
$ minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
4. To launch dashboard
$ minikube dashboard
Opening kubernetes dashboard in default browser...
# Lets try deploying Nginx Webserver on Minikube Cluster
1. Create deployment for nginx server$ kubectl run nginx --image=nginx:latest --port=80 deployment.apps "nginx" created
$ kubectl expose deployment nginx --type=NodePort service "nginx" exposed
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-7dc954dcb5-6qqcz 1/1 Running 0 18s
4. Get endpoint and port on which nginx service is running, so that it can be accessed.
$ minikube service nginx --url
http://192.168.99.100:32688
Open above url in browser, you will see, nginx webserver up and running.
Once you have setup minikube, you might be interested in setting up kubernetes cluster for production - How To Setup Kubernetes Cluster
0 comments:
Post a Comment