Skip to content

Easy deploy multi OS / multi nodes Kubernetes on Windows10 Hyperv - via Vagrant & Kubespray

Notifications You must be signed in to change notification settings

jseguillon/winspray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Winspray

Easy kubernetes on hyperV windows 10

Winspray is set of functions made to ease Kubernetes install on Hyperv via Vagrant and kubespray

Goal :

  • multi-node
  • multi OS
  • easy config
  • no effort / repeatable

Compatible Vagrant boxes :

  • "generic/centos8"
  • "generic/debian10"
  • "generic/ubuntu1910"

Requirements

Windows 10 software Requirements

Latest Vagrant must be installed.

Latest Docker Destkop must be installed.

Windows 10 network requirements

Ensure you're not connected into any kind of VPN or you'll probably get into troubles.

Quick start

Import module

Import from Powershell Gallery :

Install-Module -Name winspray

Create your cluster

Choose your infra : pick one config file on winspray github repo. You can edit and create your own.

Create your cluster with New-Winspray-Cluster command. In this example, "minimal.yaml" infra is used :

New-Winspray-Cluster .\minimal.yaml

First installation may take as long as one hour, depending on your Internet connexion. Next install usually takes from a quarter to 25 minutes.

More usefulls commands

Restore

Restore-Winspray-Cluster # Restore all VMs to snapshot created right after installation is OK

Quick Stop and start

Stop-Winspray-Cluster
Start-Winspray-Cluster

Create a new cluster

Remove-Winspray-Cluster
New-Winspray-Cluster .\mynewcluster.yaml

# or New-Winspray-Cluster .\mynewcluster.yaml -Force 

Other usefull commands

Get-Help winspray

A bit of architecture

Network

Since kubespray signs SSL certificates with IPs, and Hyperv defaults VMs with dynamic IPs and MACs, Winspray adds a secondary inteface, dedicated to kubernetes control-plane, with static IPs.

Network

Main flow chart

This chart exposes behaviour of New-Winspray-Cluster with sub functions calls.

                                                                    winspray                                                                                         
            New-Winspray-Cluster             Vagrant             docker container              HyperV                  VMS
               |                                |                        |                       |                      | 
  Test-     |  |---------|                      |                        |                       |                      | 
  Winspray- |  |         | check env            |                        |                       |                      | 
  Env       |  |----------                      |                        |                       |                      | 
               |                                |                        |                       |                      | 
               |                    run playbook "create"                |                       |                      | 
  New-      |  --------------------------------------------------------->|                       |                      | 
  Winspray- |  |                                |                        |                       |                      | 
  Inventory |  |                 Vagrantfile and kubespray inventory     |                       |                      | 
               |<--------------------------------------------------------|                       |                      | 
               |                                |                        |                       |                      | 
               |        launch vagrant up       |                        |                       |                      | 
               |------------------------------->|     create VMs with additional interface       |                      | 
               |                                |----------------------------------------------->|                      | 
               |                                |                        |                       |     VMs are          | 
               |                                |                VMs created ok                  |    now created       | 
               |                                |<-----------------------------------------------|                      | 
               |           ok good to go        |                        |                       |                      | 
               |<------------------------------ |                        |                       |                      | 
               |                                |                        |                       |                      | 
               |                    run playbook "prepare"               |                       |                      | 
            |  |-------------------------------------------------------->|                       |                      | 
            |  |                                |                        |               prepare netwok                 | 
  Prepare-  |  |                                |                        |--------------------------------------------->| 
  Winspray- |  |                                |                        |                       |                      | 
  Cluster   |  |                                |                        |                  network ok                  | 
            |  |                           good to go                    |<---------------------------------------------| 
            |  |<--------------------------------------------------------|                       |                      | 
               |                                |                        |                       |                      | 
               |                launch kubespray "cluster" playbook      |                       |                      | 
            |  |-------------------------------------------------------->|                       |                      | 
            |  |                                |                        |             do all the kubespray magic       | 
  Install-  |  |                                |                        |--------------------------------------------->| 
  Winspray- |  |                                |                        |                       |                      | 
  Cluster   |  |                                |                        |          kubespray install done              | 
            |  |     THE END                    |                        |<---------------------------------------------| 
            |  |<--------------------------------------------------------|                       |                      | 
               |                                |                        |                       |                      | 

Note : hyperv snapshots are taken at the end of Prepare-Winspray-Cluster function and another one after Install-Winspray-Cluster.

Directories after creation

yourpath:.
├───.vagrant # <- internal vagrant files
├───current
│   ├───config # <- kubespray config copied from winspray docker image. Overrides default `group_vars`
│   ├───credentials # <- kubespray gathered credentials
│   └───group_vars # <- default group_vars copied from kubespray defaults
├───kubespray_cache # <- downloaded binaries and docker images for kubespray. Kept for faster re-install.

About

Easy deploy multi OS / multi nodes Kubernetes on Windows10 Hyperv - via Vagrant & Kubespray

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published