We want to make it possible to deploy MAAS in an existing datacenter, and have it keep track of machines that already have a deployed workload — without disturbing machine or workload. Currently, in order to get a machine into MAAS, with correct hardware information, you have to network boot the machine and let MAAS inspect the machine in an ephemeral environment.
This isn’t feasible if a machine is already running a workload — but there’s still value in having the machine in MAAS:
We’re working on some solutions; though they may not all get fully implemented right away (or ever), we do plan to provide some level of deployed machine enlistment with the release of MAAS 3.1. We’d like to share our thinking. We welcome your feedback, so please comment directly in reply to this blog.
Thinking like MAAS users, based on a lot of discourse feedback, we made some assumptions to help us scope this problem.
MAAS users have expressed a desire to add already-deployed machines to MAAS, so that they can use MAAS to keep track of existing workloads If a user has an already-deployed machine that they want to see in MAAS, they can create the machine in MAAS as normal, but set the initial status to Deployed, to prevent MAAS from rebooting and/or reloading it.
We thought about this problem, and decided that this kind of a feature should probably play out like this:
Users most likely want to update hardware information for deployed machines to MAAS — without rebooting the machine — so that they can use MAAS to keep track of running workloads. If a user has machines in MAAS that are deployed, they should be able to update the hardware information, without having to reboot the machine.
Here’s how we envisioned this feature coming together:
We assumed it’s okay for users to use SSH to connect to a machine, and then run a script that will (1) add the machine to MAAS, and (2) update the commissioning data, without disturbing the machine’s workload. This builds on the last assumption, but like our enlistment scripts, it will register the machine in MAAS as a deployed machine.
Some ideas about how we wanted to implement this feature:
We understand that MAAS users want to release a machine that’s been added to MAAS, and then deploy another workload — without having MAAS reboot the machine in an ephemeral environment to gather commissioning data. If you added a deployed machine, MAAS hasn’t run its commissioning scripts, so information might be missing. We should encourage the user to re-run commissioning in that case, but what kinds of compromises can we make to avoid rebooting the machine?
Well, we’ve considered these points:
MAAS users probably want to add already-deployed machines for which they have no SSH permissions. We assumed earlier that users would be okay logging in to the running machine and collecting hardware information from the system. There are ways, though, of using out-of-band management (like Redfish) to get the hardware information.
This is useful not only for machines where you don’t have SSH permissions, but also machines where you can’t collect hardware info in the normal way (e.g, Windows). While having MAAS collect the information itself would be great, it’s just too far out of scope for this first effort. Instead, we’ll document how to update the hardware information, so that someone can write a script that queries the BMC, or run on a Windows host, to collect the information and send it to MAAS.
In other words, we’d be happy here just to post an example script that queries a Redfish BMC and updates a machine in MAAS.
We would think that a MAAS user would want machines deployed as controllers to show up in the machine listing. That way, they can be reused, if desired. Currently when you add a controller in MAAS, we either link it to an existing machine (which might be Deployed, or in any other state, really), or we create a new machine in the New state.
It would be good to unify the way we update machines and controllers. This means showing the machine in the machine listing, since it’s no different than other workloads. If you need machines for a workload, you might choose to re-use a controller that’s not really needed, or you might choose to replace the controller with a different machine.
Here’s how that feature might play out:
We expect that MAAS users would want write script that can periodically update hardware information for a deployed machine. When you have a running machine, you might want to have something running on that machine that periodically checks the hardware information and tells MAAS about it if it has changed.
While this should already be possible if some of the above features are implemented, in this case, you wouldn’t make use of your own credentials. Instead, you would generate a set of credentials that are limited to one machine only. This is important, since everyone with root on the machine will be able to see those credentials — so they need to be as restrictive as possible.
Feature considerations include the following:
We’ve made some progress toward 3.1 features, which we’ll summarize here. Understand that we’re just getting started, and as mentioned before, there’s no guarantee we’ll implement all these features — but here’s how we’re doing at the moment.
In order to add machine that’s already running a workload, there are three options:
UI: In the “Add machine” form on the machine listing page, add the machine as normal, but check the “Deployed” checkbox (this work hasn’t been done yet, but it’s on our list).
API: Create a machine passing the deployed flag:
$ maas $profile machines create deployed=true
hostname=mymachine architecture=amd64
mac_addresses=00:16:3e:df:35:bb power_type=manual
On the machine itself: If the machine is running Ubuntu, you can download a helper script from MAAS and create the machine that way. This is the way we’d recommend that users depend on:
$ wget http://$MAAS_IP:5240/MAAS/maas-run-scripts
$ chmod 755 maas-run-scripts
$ ./maas-run-scripts register-machine --hostname mymachine
http://$MAAS_IP:5240/MAAS $MAAS_API_TOKEN
Now you have a machine in MAAS that’s in the deployed state, with no hardware information yet.
The best way to update the hardware information for a deployed machine is to download the maas-run-scripts script, as shown above, and run it on the machine itself:
$ wget http://$MAAS_IP:5240/MAAS/maas-run-scripts
$ chmod 755 maas-run-scripts
$ ./maas-run-scripts register-machine --hostname mymachine
http://$MAAS_IP:5240/MAAS $MAAS_API_TOKEN
If you created the machine with the maas-run-scripts, you should have such a mymachine-creds.yaml file already. If not, it should look like this:
reporting:
maas:
consumer_key: YGT6QKSH65aap4tGnw
endpoint: http://10.5.32.98:5240/MAAS/metadata/status/wxwwga
token_key: Lyy9BS4tKsQakDQScy
token_secret: V8vta8Azwn6FZVkfHnuTvLGLScAvEufB
In this example, 10.5.32.98 is the IP/hostname of the MAAS deployment, wxwwga is the system id of the machine in MAAS, and the rest are the API token for the machine. You can get the credentials from the MAAS API like this:
$ maas $profile machine get-token wxwwga
Success.
Machine-readable output follows:
{
"token_key": "Lyy9BS4tKsQakDQScy",
"token_secret": "V8vta8Azwn6FZVkfHnuTvLGLScAvEufB",
"consumer_key": "YGT6QKSH65aap4tGnw"
}
So we just wanted to share what we’re thinking, and some of the directions we’re taking to support using deployed machines without bringing them down or hampering their workload. We really would welcome some feedback here.
Photo by Jeton Bajrami on Unsplash Date: December 4-5th, 2024 Location: Geneva, Switzerland In just…
Who will win the race to the perfect SDV? The automotive industry is experiencing a…
Software developers spend a huge amount of effort working on optimization – extracting more speed…
Welcome to the Ubuntu Weekly Newsletter, Issue 866 for the week of November 10 –…
Debian and Ubuntu are two popular Linux distributions. In this deep dive we will guide…
In this article, we will see how to Install Google Cloud BigQuery Python client library…