nanovms / nanos

A kernel designed to run one and only one application in a virtualized environment
https://nanos.org
Apache License 2.0
2.58k stars 133 forks source link

Support Azure VM Agent #2014

Closed jsommr closed 3 months ago

jsommr commented 5 months ago

It's pretty cool that Nanos runs on Azure. It's the only unikernel able to do that so far.

I'd like to put it in a VM Scale Set with autoscaling based on cpu and memory usage, but memory metrics are only available with an agent.

Surely this is easier said than done, but now there's an issue on it.

Thanks for a great product!

francescolavra commented 4 months ago

Guest OS metrics such as memory usage are only available for a given VM or VM Scale Set if the Azure diagnostic extension has been enabled in that VM or VMSS. Otherwise, such metrics cannot be viewed in the Metrics section of the Azure portal, and cannot be used in autoscale trigger rules, even if the VM is correctly sending metrics data; one of the reasons for this is that metrics data is stored in tables in a given storage account, and the Azure portal needs to know what storage account is being used and takes this information from the configuration settings of the diagnostic extension. Enabling an extension (either via a deployment template for a VMSS, or via the Azure portal or the Azure client for a VM) requires communication with the VM agent running in a VM, which is instructed to download, install, configure, and run the extension; if no agent is running, enabling the extension fails, and guest OS metrics are not available. So if we want this to work on Nanos, we have to implement (in addition to the code that sends the metrics to a storage account) an agent that responds to requests to enable extensions (and possibly to requests for configuration settings of a given extension).

francescolavra commented 3 months ago

2022 implements an Azure VM agent and a diagnostic extension that publishes memory metrics. Please note that the extension is enabled and configured via manifest options when creating a Nanos image; it sends metrics regardless of whether the diagnostic extension is enabled in the Azure portal, but in order for these metrics to show up in the charts you need to enable the extension (in fact, without enabling the extension you cannot even select guest OS metrics in the charts).

jsommr commented 3 months ago

Awesome! Thanks!