Giter VIP home page Giter VIP logo

kubernetesonwindows's Introduction

KubernetesOnWindows

This is a fully batteries-included development for Windows on Kubernetes, including:

  • Vagrant file for launching a two-node cluster
  • the latest containerd
  • NetworkPolicy support for Windows and Linux provided by Antrea
  • Windows binaries for kube-proxy.exe and kubelet.exe that are fully built from source (K8s main branch)

Soon to be integrated into kubernetes-sigs/windows-dev-environment!

We welcome contributions. We'd especially love to see:

  • More CNI providers (calico, cillium, ...)
  • More Container Runtime ideas
  • More vagrant infrastructures (Vsphere, VMWare Fusion, EC2, GCE, and so on)
  • E2Es or scripts which exercise privileged containers or LDAP / AD
  • CSI or other storage/volume add-ons
  • other ideas!

Goal

Our goal is to make Windows ridiculously easy to contribute to, play with, and learn about for anyone interested in using or contributing to the ongoing Kubernetes-on-Windows story. Windows is rapidly becoming an increasingly viable alternative to Linux thanks to the recent introduction of Windows HostProcess containers and Windows support for NetworkPolicies + Containerd integration.

Prerequisites

  • vagrant
  • vagrant reload plugin
  • some vagrant provider (we only have virtualbox automated here, but these recipes have been used with others, like HyperV)

Lets run it!

Ok let's get started...

1) Pre-Flight checks...

For the happy path, just:

  1. Install vagrant, and then vagrant-reload
vagrant plugin install vagrant-reload
  1. Modify cpu/memory. We advise 8GB RAM for Windows. If your system has less than 16GB RAM, adjust the Vagrantfile:
    winw1.vm.provider :virtualbox do |vb|
      vb.memory = 4096

change the 4096 to 2048.

2) Run it!

There are two use cases for these Windows K8s dev environments: Quick testing, and testing K8s from source.

3) 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 up the Linux and Windows VMs
  • ... 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 THAT'S 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. If you run into trouble, you're very welcome to create a new issue and include info about your system.

Accessing the Windows box

You'll obviously want to run commands on the Windows box. 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, which 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 to install Kubernetes on Ubuntu Focal (20.04). The Windows part is informed by this guide on how to install Docker on Win Server 2019, this guide on adding Windows nodes, and this guide on how to install Kubernetes on Win Server 2019.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.