Windows containers can run in Kubernetes--but there is a catch

Yes, running Windows containers in Kubernetes can work. But it's not as simple as it seems.

How to create a Kubernetes security policy
2:26

The operating system container, which isolates just the essential parts of the operating system that are different, is quickly becoming the standard way for organizations to build and run applications.  Because container images are so small, they can be stored, tracked and versioned like any code fragment in version control. Programmers can trade them over the network like they are copying files. Because of the way Linux manages processes, nearly any modern Llinux can run any other version of Linux as a container. 

That just isn't so with Windows, where the operating system, down to the build number, needs to match. That means updating the server, or even adding a security patch, could stop the container components from running.

SEE: What is Kubernetes? (free PDF) (TechRepublic) 

While Microsoft Windows has been available to run in a Docker container for years, getting it into Kubernetes is a different story.

Fitting Windows into a container

Microsoft's Azure infrastructure has supported Docker, the default container format, since 2014. That meant running Linux in the Azure cloud, not actually running a windows container. It wasn't until last year that Microsoft offered Windows containers under Azure, and that was a "technology preview," meaning in beta.

This is no huge surprise. Weighing in at 3.4 Million files, Windows claims to be the largest git repository in the world. The codebase for Windows is, at the newest, 20 years old, as WindowsXP was a rewrite project. However, the software still provides backward compatibility to MS-DOS, released in 1981. For example, if you enter the command bar and type in cmd <enter>, you will see the white-on-black MS DOS command prompt.

Where Docker makes it possible to run a container on a machine, it is Kubernetes that is emerging as the standard "cloud" to run multiple containers. The details of Kubernetes are simple enough, in theory. Start up a server, attached CPU, memory, and disk, and let Kubernetes manage it. In the public cloud, provisioning hardware is even easier. Simply ask for the virtual hardware you need, pointing to the container to run.

But can you run Windows under Kubernetes? As usual, the answer is, it depends.

Kubernetes for Windows

On April 1, 2019, the Kubernetes authors announced support for running Windows containers. To be specific, now when you run Kubernetes, you can attach it to Windows machines, which can then become "nodes," making some of their memory, disk, and CPU available to run lightweight, virtual versions of Windows. The magic of Kubernetes is that you never really need to know where virtual hardware is. 

The bad news is, your worker nodes in Kubernetes need to be running Windows Server 2019. The containers running in Kubernetes need to be running Windows Server 2019. You can run Kubernetes itself on Linux or Windows, but still--Server 2019. 

SEE: Kubernetes security guide (free PDF) (TechRepublic)

Another piece of good news that comes from this must-match-operating-system model is a legal one. Because the child operating system is the same as the parent, you already have the license.  Microsoft does not require a second license for the virtual machines. If you ever worried about calling a toll-free number to pay by credit card to try to get a series of 25-characters, separated by dashes to get your cloud to work, you don't have to today. The very way the licensing is constructed makes that a non-issue.

As I mentioned earlier, it is possible to attach Windows Server 2019 machines to a Kubernetes cluster. Of course Microsoft has an easy front end to create, manage, monitor, and audit clusters in Azure. Amazon's Electric Kubernetes Services has a developer preview for Windows as well; IBM also has Windows in preview. While Amazon could not have comments prepared in time for this article, Christophe Rosen, IBM program director for Kubernetes and Openshift, did give a very simple response: The IBM Kubernetes Cloud does not support Windows Containers at this time. The company does not see a market demand, and without it, does not have plans to add that support. 

A better solution for now

Containers may be shiny and fun, but to have any business value, they need to do something. The practical place for Windows Containers today is to run legacy .NET applications. If you have Windows 10, in any edition, and have some version of Visual Studio, you can create and run a Windows container locally. Once you've done that, you can run that container in Azure Service Fabric right now, without having to spin up a Kubernetes cluster.

If you are a betting person, right now, the smart money for Windows containers is on Azure Service Fabric.

And make no mistake. If you are writing or deploying software, you are a betting person.

Also see

Kubernetes emblem white helm on blue back

Getty Images/iStockphoto