· Cloud

Running Kubernetes next to virtual machines

Containers and virtual machines will share most datacenters for years. Whether that makes one platform or two depends mostly on how many teams have to operate it.

Kubernetes and virtual machines are going to share your datacenter for as long as anyone can plan. The databases and the packaged applications stay in VMs. New services arrive as containers. The argument I keep hearing is whether that should be one platform or two, and I think the answer depends mostly on how many teams have to operate the result. Count the teams before you compare architectures.

The two are different in a way that matters for operations. The Kubernetes documentation describes a VM as "a full machine running all the components, including its own operating system, on top of the virtualized hardware." Containers, it says, "have relaxed isolation properties to share the Operating System (OS) among the applications." A VM is managed as a long-lived machine with a name. A container is managed as a disposable copy of an image. The tooling and the habits around each grew up separately, and so did the people.

Three ways to arrange them

Kubernetes inside VMs. The cluster's nodes are virtual machines on the hypervisor you already run. This is common in enterprises because it adds Kubernetes without changing what sits underneath. The VM boundary separates one cluster from another, and the people who run the virtualization layer keep doing what they already do. It leaves you with two layers to upgrade, and with two schedulers placing workloads without knowledge of each other. The hypervisor decides which host a node runs on, and Kubernetes decides which node a pod runs on.

VMs inside Kubernetes. The open-source KubeVirt project, hosted by the Cloud Native Computing Foundation, adds virtual machines to a Kubernetes cluster as another kind of resource. Its documentation says it adds new resource types to the Kubernetes API, along with controllers and node agents that themselves run as pods. The design is stated in one line: "Scheduling, networking, and storage are all delegated to Kubernetes." The VM itself runs under KVM on a cluster node. The project's rule for new features is "If something is useful for Pods, we should not implement it only for VMs." With this arrangement a VM is declared in the same kind of manifest as everything else, goes through the same pipeline and lands on the same network and storage. The features a VM administrator takes for granted, such as live migration and snapshots, then depend on what the cluster's storage and network can do.

Two estates. A hypervisor cluster and a separate Kubernetes cluster on its own hardware, with the network between them. Each is run in the way that suits it. You pay for that in spare capacity, since headroom in one pool cannot help the other, and in having two of everything else.

All three work, and all three are in production in large organizations. Which one is best for you depends on who has to run it.

What operating it means

"One platform" gets used loosely. It can mean one API, one hardware pool, one vendor or one support contract. I count platforms by on-call rotations. Each of these jobs exists once per platform:

  • patching and version upgrades
  • network policy and load balancing
  • storage provisioning
  • backup and restore, including a restore somebody has tested
  • monitoring and alerting
  • access control and audit
  • capacity planning

That is seven jobs. For each one, ask whether one team does it for both containers and VMs or two teams do it separately.

If the same four people already do all seven for the VM estate and are now being handed Kubernetes as well, you are a one-team shop. If a platform engineering group runs Kubernetes and an infrastructure group runs virtualization, with separate managers and separate budgets, you are a two-team shop. No product will merge those two groups for you, and buying one in the hope that it will does not end well.

How I would decide

For one small team, put both workloads on the layer the team already understands.

A team with years of virtualization experience will usually do better running Kubernetes clusters as VMs. Every node is an ordinary guest that their existing backup, monitoring and patching already cover, so the new thing they have to learn is Kubernetes and nothing else.

A team that lives in Kubernetes and has a few dozen VMs left will usually do better pulling those VMs into the cluster. One more resource type costs them less than a second platform would.

In both cases the team takes on one new thing at a time. Small teams get into trouble when they take on a new control plane and a new way of running the old workloads in the same quarter.

For two established teams, the layered arrangement and the two-estate arrangement are both reasonable, and the real work goes into the boundary. Write down who owns the node operating system, who owns the network path between pods and VMs, and who decides when the layer underneath gets upgraded. In the layered arrangement, the hypervisor is the virtualization team's problem and the cluster is the platform team's problem. The node VMs in between need a named owner, because that is where upgrades stall.

Some things stay shared whichever arrangement you pick. The physical servers have one lifecycle. The physical network is one network. Identity, the backup target and the logging pipeline should be common to both sides. If those are split as well, you have two datacenters that happen to share a building.

Here is the test I use. A containerized service cannot reach its database, and the database runs in a VM. Who gets paged? If the answer is one team, you have one platform, whatever the architecture diagram shows. If the answer is two teams and a conference bridge, you have two, and you should design the handoff between them on purpose.

One platform or two, counted by the teams that run it
One team

The same people do all seven jobs for VMs and containers

Put both workloads on the layer the team already understands

Take on one new thing at a time

One team is paged when a service cannot reach its VM database

Two teams

Separate groups, managers and budgets for Kubernetes and VMs

Kubernetes inside VMs or two estates are both reasonable

Write down who owns the boundary, including the node VMs

Two teams and a conference bridge handle the same failure

The seven jobs are patching, network, storage, backup, monitoring, access control and capacity planning.

The software inside the VM limits your choice as well. Whatever runs there has a vendor too, and that vendor decides which virtualization layers it will support. Before you move a commercial database or a packaged application to a different way of running VMs, check with the software vendor and get the support position in writing. A workload that runs fine and is unsupported is a problem you find out about during an outage.

Before any product evaluation starts, I would fill in a table with the seven jobs down the side and, for each, the team that does it today for VMs and the team that does it for containers. The architecture choice usually falls out of that table. So does the list of jobs nobody currently owns, and I would want that list in front of the people approving the budget.

Views are my own.