Minikube: start
Sumber: https://minikube.sigs.k8s.io/docs/start/
minikube adalah Kubernetes lokal, berfokus untuk membuatnya mudah dipelajari dan dikembangkan untuk Kubernetes.
Yang kita butuhkan hanyalah wadah Docker (atau kompatibel serupa) atau lingkungan Mesin Virtual, dan Kubernetes hanya dengan satu perintah:
minikube start
Spesifikasi Minimal
- CPU 2 core atau lebih
- RAM 2GB free
- Harddisk 20GB free
- Sambungan Internet
- Container atau virtual machine manager, seperti: Docker, QEMU, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, atau VMware Fusion/Workstation
Instalasi
Linux Binary Package
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
Linux Debian Package
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb sudo dpkg -i minikube_latest_amd64.deb
Linux RPM Package
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm sudo rpm -Uvh minikube-latest.x86_64.rpm
Windows
Download and run the installer for the latest release. Or if using PowerShell, use this command:
New-Item -Path 'c:\' -Name 'minikube' -ItemType Directory -Force Invoke-WebRequest -OutFile 'c:\minikube\minikube.exe' -Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' -UseBasicParsing
Add the minikube.exe binary to your PATH. Make sure to run PowerShell as Administrator.
$oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine) if ($oldPath.Split(';') -inotcontains 'C:\minikube'){ ` [Environment]::SetEnvironmentVariable('Path', $('{0};C:\minikube' -f $oldPath), [EnvironmentVariableTarget]::Machine) ` }
If you used a terminal (like powershell) for the installation, please close the terminal and reopen it before running minikube.
Start minikube
minikube start
Interaksi dengan Cluster minikube
kubectl get po -A minikube kubectl -- get po -A
Untuk melihat dashboard
minikube dashboard
Akan membuka akses web di
http://127.0.0.1:46779/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
Deploy Application
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4 kubectl expose deployment hello-minikube --type=NodePort --port=8080 kubectl get services hello-minikube
atau di arahkan ke browser
minikube service hello-minikube
atau lakukan port fowarding
kubectl port-forward service/hello-minikube 7080:8080
supaya bisa di akses di http://localhost:7080/
Deploy Loadbalancer
kubectl create deployment balanced --image=k8s.gcr.io/echoserver:1.4 kubectl expose deployment balanced --type=LoadBalancer --port=8000
minikube tunnel
kubectl get services balanced
Bisa di akses dari <EXTERNAL-IP>:8000
Management Minicube
minikube pause minikube stop minikube config set memory 16384 minikube addons list minikube start -p aged --kubernetes-version=v1.16.1 minikube delete --all
Referensi