In today's software development landscape, online collaboration is the norm, especially when working with Kubernetes and cloud-based technologies. However, when developers find themselves without a reliable internet connection, having a local development environment that can run on a laptop and provide a basic Kubernetes setup is crucial for maintaining productivity.
In this article, I will demonstrate how minikube enables the deployment of functional Kubernetes as a single-node cluster on a laptop running Windows 10, utilizing the Hyper-V Hypervisor.
Let’s begin by installing and configuring minikube with Grafana, Prometheus, Helm, and Istio on Windows 10.
Development Machine Environment Prerequisites
- VT-x/AMD-v virtualization must be enabled in the BIOS (requires a machine restart)
- Enable Hyper-V: Navigate to “Windows features On or Off” and locate the Hyper-V section. Enable it, and then restart your machine.
Hyper-V Installation
Hyper-V has been included with Windows since Windows Server 2008, as well as Windows 8, 8.1, and 10 in the Pro versions. It can be enabled from the Control Panel at “Turn Windows features On or Off” under “Programs and Features.” Activate the “Hyper-V” checkbox, apply the change, and follow the on-screen instructions.
Network Configuration
First, you need to configure a new virtual switch to enable your virtual machine to connect to the internet. Once Hyper-V is enabled, launch the Hyper-V Manager.
Configuration can be done via the GUI by opening PowerShell as Administrator and running Hyper-V Manager
mmc.exe virtmgmt.mscAlternatively, we can utilize PowerShell exclusively for the remaining configurations.
Establishing an External Switch
Using PowerShell (run as Administrator)
- Retrieve a list of the network adapters in the host. Typically, you should see “Ethernet” and “Wi-Fi” on a laptop.
Get-NetAdapter- Create the external switch, naming it VM-External-Switch, and bind it to the network adapter named Wi-Fi retrieved from the previous command. You may need to modify the -NetAdapterName to an interface connected to the internet.
New-VMSwitch -name ExternalSwitch  -NetAdapterName "Ethernet 3"  -AllowManagementOS $trueThe most straightforward way to install minikube is to deploy it via choco.
Chocolatey is a Windows package manager, similar to apt-get or yum, designed to facilitate rapid installation of applications and tools. Built on the NuGet infrastructure, it utilizes PowerShell as its primary focus for delivering packages.
Follow the Installation Guide or execute the below PowerShell commands
Using PowerShell (run as Administrator):
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1'))Using cmd (run as Administrator):
@”%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe” -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command “iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1'))" && SET “PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin”Once installed, check for any available upgrades for Chocolatey:
choco upgrade chocolateyInstall the kubectl CLI:
choco install kubernetes-cliSet up minikube:
Using PowerShell (run as Administrator):
choco install minikubeVerify minikube installation:
minikube versionExplore available Kubernetes versions:
minikube get-k8s-versionsUpdate minikube:
minikube update-checkInitialize minikube
Review available initialization options:
minikube.exe start — help-  vm-driver Hyper-V: Specifies the Hypervisor driver to utilize
-  cpus 4: Allocates the number of CPU “cores”, defaulting to 2 if unspecified
-  memory=4096: Allocates the amount of RAM, defaulting to 2048 if unspecified
-  hyperv-virtual-switch “VM-External-Switch”: Specifies the virtual network switch to utilize, “VM-External-Switch” created in previous steps
-  kubernetes-version string: Specifies the version of Kubernetes to install (e.g., v1.2.3)
Post-minikube Installation
- 
Halt minikube k8s VM 
minikube stopDisable Dynamic RAM allocation in Hyper-V
Set-VMMemory minikube -DynamicMemoryEnabled $falseRestart minikube k8s VM
minikube startDeploy additional Kubernetes components
List minikube addons
minikube addons listEnable Heapster for cluster performance monitoring
minikube addons enable heapsterPost-installation checks for minikube
Check minikube status
minikube status
minikube service listLaunch Kubernetes dashboard
minikube dashboardVerify dashboard URL
minikube dashboard — urlEstablish a secure shell connection to minikube
minikube sshExecute kubectl commands against minikube
kubectl config use-context minikube
kubectl config current-context
kubectl get po -n kube-system
kubectl get po — all-namespaces
kubectl get all — all-namespaces
kubectl api-versions | grep rbac
kubectl version
kubectl cluster-info
kubectl api-versionsTest minikube Kubernetes deployment
kubectl run hello-minikube — image=k8s.gcr.io/echoserver:1.4 — port=8080
kubectl expose deployment hello-minikube — type=NodePort
kubectl get services
kubectl get deploy
kubectl get podDetermine IP address
minikube ipFind mapped port number
kubectl describe service hello-minikube
kubectl get svc hello-minikube
curl http://$IP:$PORTRemove testing deployment
kubectl delete services hello-minikube
kubectl delete deployment hello-minikube
eval $(minikube docker-env)
docker infoMinikube Add-Ons
Enumerate minikube available add-ons
minikube addons listActivate Ingress for minikube K8s
minikube addons enable ingressActivate Elastic Fluentd Kibana
minikube addons enable efkInstall Helm cli and initialise tiller
choco install kubernetes-helmhelm initPost Helm installation configuration
kubectl — namespace=kube-system edit deployment/tiller-deployModify automountServiceAccountToken to true
automountServiceAccountToken trueAlternatively, you can do it in one command
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"automountServiceAccountToken":true}}}}'Verify Helm Installation
helm version
helm search
kubectl get svc -n kube-system
helm ls — debugUpgrade Helm
helm init --upgradeUpdate Helm Repositories
helm repo updateLet’s attempt to deploy some packages and inspect using MySQL as an example.
helm inspect stable/mysql
helm install stable/mysqlInstall Helm Packages for Prometheus and Grafana.
helm install stable/prometheus
helm install stable/grafanaAccess Prometheus.
- 
Obtain the Prometheus Server URL 
- 
Get the POD_NAMEfor the running Prometheus server
kubectl get pods — namespace default -l “app=prometheus,component=server” -o jsonpath=”{.items[0].metadata.name}”Note: Replace $POD_NAME with the output from the previous command
kubectl — namespace default port-forward $POD_NAME 9090Obtain the Alertmanager URL
Get the POD_NAME for the running Prometheus alert manager
kubectl get pods — namespace default -l “app=prometheus,component=alertmanager” -o jsonpath=”{.items[0].metadata.name}”Note: Replace $POD_NAME with the output from the previous command
kubectl — namespace default port-forward $POD_NAME 9093Obtain the PushGateway URL
Get the POD_NAME for the running Prometheus push gateway
kubectl get pods — namespace default -l “app=prometheus,component=pushgateway” -o jsonpath=”{.items[0].metadata.name}”Replace $POD_NAME with the output from the previous command
kubectl — namespace default port-forward $POD_NAME 9091Gain Access to Grafana
Retrieve your ‘admin’ user password in base64 and decode it by executing:
Note: This method is exclusive to Linux environments.
kubectl get secret — namespace default interested-moth-grafana -o jsonpath=”{.data.admin-password}” | base64 — decode ; echo- 
Obtain the Grafana URL 
- 
Retrieve the POD_NAMEfor running Grafana
kubectl get pods — namespace default -l “app=grafana” -o jsonpath=”{.items[0].metadata.name}”  Note: Replace $POD_NAME with the output from the previous command.
kubectl — namespace default port-forward $POD_NAME 3000Deploy the Kubernetes dashboard for Docker Kubernetes (note: Minikube comes with the dashboard pre-deployed)
helm install stable/kubernetes-dashboard
kubectl proxyIn your web browser, access the Kubernetes dashboard using the following link:
http://localhost:8001/uiAlternatively, open in your browser:
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/Install Istio.
git clone https://github.com/istio/istio.git
cd istio
kubectl create -f install/kubernetes/helm/helm-service-account.yaml
helm init — service-account tiller
helm install install/kubernetes/helm/istio — name istio
helm delete — purge istio 


 
    
Top comments (0)