main
ROOT /
pages /
k8s-windows-node.md
45 lines | ISO-8859-1 | 2 KB

Usage Scenario

Run builds on Windows node in Kubernetes cluster

How to Set Up

Windows requires that the OS version of your image needs to be compatible with that of worker node. For instance, worker node of OS version 1903 can only run images with OS version 1903 or earlier. In practice, we suggest to use same OS version for image and worker node to avoid potential issues.

Let's go through an example to demonstrate this process:

  1. Create a Kubernetes cluster containing Windows node on Azure following this tutorial (At the time writing this doc, Kubernetes version 1.14.6 used in the tutorial is no longer available in the region. You may need to use a later version such as 1.14.8)
  2. Deploy OneDev server into created cluster following this guide (no need to set up ingress and letsencrypt for our demonstration purpose)
  3. Visit job executors page in administration menu of OneDev, delete the default auto-discover executor, and add a Kubernetes executor with below label selectors (assume name of Windows node pool is npwin):
Label NameLabel Value
kubernetes.io/oswindows

4. Get build number of one of the Windows node with below command:

kubectl get node <node name> -o jsonpath={.status.nodeInfo.kernelVersion} | awk -F'.' '{print $3}'

Node name can be listed by running command kubectl get nodes 5. Map build number to OS version with below table:

Build NumberOS Version
143931607
162991709
171341803
177631809
183621903
183631909
190412004
1904220H2

6. Create a project in OneDev, and add file with name .onedev-buildspec from web UI directly 7. Add a demonstration CI job, with below settings:

ImageCommand
mcr.microsoft.com/windows/servercore:<OS version from above step>echo hello world
  1. Save and run the job. The job may take much longer than Linux based jobs for the first run, due to the fact that Windows image is much larger

NOTE: For fields accepting variables in build spec, make sure to use double slash as Windows path separator as single back slash is treated as escape character

Please wait...
Page is in error, reload to recover