Goal:
This article explains the detailed steps on how to get started with Minikube on Mac OS.This is a good starting point to learn Kubernetes.
Env:
Mac OS 10.14Minikube v0.30.0
Solutions:
1. Prerequisite
Install xcode on Mac:xcode-select --installThen install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"So basically Homebrew installs packages to their own directory and then symlinks their files into /usr/local.
2. Install Minikube
Using Homebrew we can easily install Minikube on Mac:brew cask install minikube
3. Start a single node Kubernetes cluster in VM
By default Minikube uses "virtualbox" as the VM driver, and you can also change it to others:$ minikube start -h |grep vm-driver
--vm-driver string VM driver is one of: [virtualbox vmwarefusion kvm xhyve hyperv hyperkit kvm2 none] (default "virtualbox")
Now start the single node Kubernetes cluster in VM(default memory size is 2G):minikube start
4. Launch Kubernetes Web Dashboard
minikube dashboardOnly one node shows:
5. Deploy a hello world Node.js application into Minikube
kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080Shown in "Deployments" in dashboard:
Or shown in CLI:
$ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE hello-minikube 1 1 1 1 15m
6. Expose the deployment as a service
kubectl expose deployment hello-minikube --type=NodePortDisplay the service information in dashboard:
Or display the service information in CLI:
$ kubectl get services hello-minikube NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello-minikube NodePort xxx.xxx.xxx.xxx <none> 8080:31978/TCP 3m
7. Wait for the pod up and running
Keep running below command until the pod's status is running and is ready.$ kubectl get pods NAME READY STATUS RESTARTS AGE hello-minikube-6c47c66d8-gv7n2 1/1 Running 0 31m
8. Access the service
curl $(minikube service hello-minikube --url)
Or go directly to the web URL in browser:
$ minikube service hello-minikube --url http://192.168.99.100:31978
9. Shutdown cluster
Delete the service(Service is gone after that):kubectl delete service hello-minikubeDelete the deployment(Both deployment and pod are gone after that):
kubectl delete deployment hello-minikubeStop the minikube cluster:
minikube stop
Reference:
https://github.com/kubernetes/minikube




0A02786E
ReplyDeleteIğdır
Çorum
Amasya
Bitlis
Şırnak
Malatya
Van
Ordu
Antep
E1053CB7
ReplyDeleteBalçova
Mudanya
Bayındır
Menderes
Gökçeada
Kızılay
Pursaklar
Selçuk
Mezitli
3602966A
ReplyDeleteReyhanlı
Akşehir
Akyaka
Kemalpaşa
Tatvan
Karaburun
Karşıyaka
Balgat
Biga