Skip to content

I am trying to build a vagrantfile and collect further instructions to build a Kubernetes Cluster including a Windows (Server 2019) node.

License

Notifications You must be signed in to change notification settings

jayunit100/sig-windows-dev-tools

 
 

KubernetesOnWindows

Prerequisites

You need the reload plugin for vagrant.

vagrant plugin install vagrant-reload

If your system has less than 16 gb ram, adjust the Vagrantfile:

    winw1.vm.provider :virtualbox do |vb|
      vb.memory = 4096

change the 4096 to 2048.

How to run !

There are two use cases for these windows k8s dev environments: Quik testing, and testing k8s from source.

Testing from source: make

To test from source, run make all. This will

  • clone down k8s from github. If you have the k/k repo locally you can make path=path_to_k/k all
  • compile the k8s proxy and kubelet
  • inject them into the Vagrant windows environment at the C:/k/bin/ location
  • start the linux and windows VMs up
  • ... TODO ~ build linux components from source as well ...

Quick testing: Vagrant up

# 1) first run this, bc vagrant needs to do some reload of machines
vagrant plugin install vagrant-reload 

# 2) bring up your entire windows cluster ! 
vagrant up

AND THATS IT ! Your machines should come up in a few minutes...

IMPORTANT

Do not log into the VMs until the provisioning is done. That is especially true for Windows because it will prevent the reboots.

If you still have an old instance of these VMs running for the same dir:

vagrant destroy -f && vagrant up

after everything is done (can take 10 min+) ssh' into the linux vm:

vagrant ssh master

and get an overview of the nodes:

kubectl get nodes

The win node might stay 'NotReady' for a while, because it takes some time to download the flannel image.

vagrant@master:~$ kubectl get nodes
NAME     STATUS     ROLES                  AGE    VERSION
master   Ready      control-plane,master   8m4s   v1.20.4
winw1    NotReady   <none>                 64s    v1.20.4

...

NAME     STATUS   ROLES                  AGE     VERSION
master   Ready    control-plane,master   16m     v1.20.4
winw1    Ready    <none>                 9m11s   v1.20.4

I have only tested this on one machine so if you run into trouble creating new issues (with info about your system) are very welcome.

Accessing the windows box

You obviously will want to run commands on the windows box, so, you can do this by noting the IP address during vagrant provision and running any RDP client (vagrant/vagrant for username/password)

To run a command on the windows boxes, without actually using the UI, you can use winrm that is integrated into vagrant. For example, you can run:

vagrant winrm winw1 --shell=powershell --command="ls"

Where did I steal all the stuff?

This guide is based on this very nice Vagrantfile and this very good guide on how install Kubernetes on Ubuntu Focal (20.04). For the Windows part is used this guide on how to install Docker on Win Server 2019) and another this this guide on how to install Kubernetes on Win Server 2019 .

About

I am trying to build a vagrantfile and collect further instructions to build a Kubernetes Cluster including a Windows (Server 2019) node.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 66.7%
  • Shell 29.2%
  • Makefile 4.1%