It’s easy to regard bare metal computing as a dying trend. Especially considering how corporate and personal computing services have migrated to the cloud in droves. Not owning any hardware and the introduction of orchestration technologies such as Kubernetes certainly make deploying in the cloud very attractive.
Be that as it may, you might want to consider deploying Kubernetes on bare metal as a viable strategy. It comes with advantages such as better security, less network complexity, and above all, the lavish control of your entire architecture. Running bare metal gives you control that you simply cannot have in a cloud setting.
This article explores the concept and motivation for the bare metal Kubernetes movement, pointing out the advantages and disadvantages. You’ll also experience a step-by-step process of deploying a bare-metal Kubernetes application. Think of the latter as proof of concept.
What is bare metal Kubernetes?
When you take the bare metal route, Kubernetes implements clusters across physical nodes. This means your applications are deployed on the infrastructure you create: without hypervisors and the bells and whistles consistent with managed Kubernetes services.
The actual hardware can either be rented from a local data center or safely locked up in your server room on location. So, to clear a misconception up really quick, you can still technically be “bare metal” if you contract an IaaS company just for their hardware provisions.
On the surface, going bare metal may seem counter-intuitive, especially given how the cloud packs a plethora of advantages over running a fancy server from your office. But there are a number of reasons why some engineers still favour this approach.
Bare metal vs. virtual machine deployments
You’ve got two main options of running Kubernetes: bare metal and virtual machines.
1. Kubernetes on bare metal
This option is analogous to back in the day when you’d install your server and have every other machine accessing your applications on actual computers. Each with access to altering both hardware and network parameters to affect performance when required.
This means when you’re scaling horizontally, each node would need its own operating system. You’d also manage the entire cluster (to the smallest variable detail.) Keep in mind that this could be in the cloud or on-premise.
2. Kubernetes on virtual machines
This is the lazy, yet efficient way of running Kubernetes. It entails springing up virtual machines with provisioned environments already ready for scale. The obvious upside to this model is the fewer tangible cost points to deploy your applications.
Why bare metal Kubernetes makes sense
To start with, it’s less technically demanding to run Kubernetes on bare metal. At least compared to many engineers’ expectations. In fact, you could start off your bare metal installation of Kubernetes on your laptop. Give it a try on either macOS, Windows, or Linux.
Advantages of bare metal Kubernetes
- Better security outlook: Once you’ve gone bare metal, your security options increase. From entire security pipelines encrypting all nodes, to custom applications.
- Full resource utilization: Unlike the case where hypervisors compete for resources, bare metal installations reserve every last drop to Kubernetes and your applications.
- Total control of the bone: Bare metal implementations make it easy for you to append any hardware requirements to your infrastructure when needed.
- Cost planning friendly: The notion that bare metal is cheaper is always a debatable rabbit hole. What you won’t rebut is that you gain control over the acquiring of any extra components. You can predict the cost associated with scaling with more precision than with other models.
- Less complex networking: The lack of a virtualization layer implies an entire array of protocols also gets stripped from the picture. What’s left is a more straightforward network configuration.
Good as all these benefits sound, you should expect the following disadvantages when going the bare metal route.
- Node creation strain: When you pit bare metal against virtual machine models, the latter has a quicker setup process. Scaling virtual machines takes considerably less time and effort as you call up an orchestration tool to create machines in hordes.
- No default failover mechanism: Another feature you’ll envy VMs for is the snapshot and state rollover safety mechanism. It essentially makes sure you don’t lose everything in the event of a crash. This is not to say you can’t absolutely have such a feature. But it then becomes a task to consider, configure, and control forever.
- The compatibility conundrum: By virtue of being in your total control, you could run into mismatch cases when building new clusters. Your Kubernetes configurations and those of your networking interface could set you back some time aligning. Whereas VMs adhere to infrastructure as code. This makes it easy to update configurations and attain blanket compatibility across entire clusters.
As much as the bare metal regime lacks all sorts of automation, I’m sure by the time you have read through both sides of the coin you understand its lure effect. The next step after gathering this much knowledge about the model is getting your hands dirty setting up a bare metal Kubernetes installation.
Getting started with bare metal Kubernetes
The moment you feel you’re ready to get started is the best time to start considering a few concerts to avoid bottlenecks down the line.
- How many nodes are you building? The more nodes you intend to build, the smaller you should make their initial partitions. It’s like cutting pieces from a full circle pie, but here you’re looking to reduce management complexity right off the bat.
- 2. Are you using mainstream hardware? The compatibility disadvantage previously outlined has a habit of creeping on overly confident engineers. Check with the community-maintained cluster network configuration record before installation.
- How many OS variants will you run? As yourself, if any of your nodes will need a different operating system than the rest, or maybe they’ll all run different builds. If that’s the case you may be in for some tough administration tasks. Ideally, you want to run the same OS (the same kernel build too) across your entire cluster. But things happen, right?
- Look into bare metal management options. The best time to hook in metrics, events, and cluster monitoring tools, is when you’re just starting out. (for context building) Some tools will imply moving to the cloud. Are you ready to make the decision and use hybrid models for their sake?
Having considered these, you can now go ahead and try a bare metal Kubernetes installation.
Bare metal Kubernetes installation guide
Installation of Kubernetes to a bare metal setup is easier done with Kubespray.io. To avoid smothering you with information readily documented, we’ll breeze through the process.
To start with, you need to install Kubespray. For this, you’ll need either Vagrant or Ansible. Both packages install the dependencies that make your environment cluster deployment ready. As such you need to have configured your environment for an internet connection beforehand.
When all dependencies have been installed, make sure to match network plugins of the hardware and those stipulated by the latest Kubernetes distribution. Essentially, you should make sure all environments allow an IPV4 networking protocol as the basis of all bare networking transactions.
The next step is to create a cluster deployment plan.
This involves: DNS configurations, a strategy for certificate generation, and picking out the right plugins to support the network you’re building. After which you can deploy and confirm your first cluster with Ansible.
As you will appreciate by this point, both the creation and maintenance processes of running bare metal Kubernetes are anything but a walk in the park. You must approach the concept with an open mind willing to negotiate terms with other models for the best outcome. The installation process has long been perfected, but you’ll still need to decide on a few configurations to match your requirements. The same settings are the ones you’ll need to keep an eye on as your instances scale. For that, you’re better off using container monitoring tools.
Knowing which tools to use can make all the difference when it comes to appreciating the decision to go bare metal. Staying with a balanced mindset throughout the process should help you pivot or even stop if the instance-specific downsides outweigh the benefits of using bare metal Kubernetes.
If you're looking to monitor your Kubernetes deployments, then check out Airplane. Airplane allows you to transform scripts, queries, APIs, and more into powerful workflows and UIs. With Airplane Views, you can build custom UIs quickly that help you monitor and troubleshoot your deployments in real-time. Build internal tools quickly for your engineering workflows using Airplane.