aks-engine custom image for node - azure

On the aks-engine github there is an example for a custom image for a node as follows:
"agentPoolProfiles": [
{
"name": "agentpool1",
"count": 3,
"imageReference": {
"name": "stretch",
"resourceGroup": "debian"
},
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet"
}
]
When I use this in my aks-engine generated ARM it can't find the resource group because I have not created it and not uploaded an a debian VHD as an Image in Azure.
Is there a way of using pre-made images on Azure instead of having to upload our own?

If you mean to create a custom image without upload your own VHD file in Azure when you say using the pre-made images. Then the answer is yes. You can create the image from the base images that Azure provided in the marketplace through the Packer tool or Capture the image from the Azure VM.
As you see in the aks-engine custom image, you need to create the custom image in the resource group first, and then use both resource group name and image to quote the custom image to create the agent pool. The description in agentPoolProfiles of aks-engine.

If you are using Azure Kubernetes Service(AKS) to create a managed AKS cluster, you won't be able to use the custom image or the gke-engine.
See the comment from Microsoft's employee on Aug 3, 2018:
Currently, AKS does not support deploying custom VM image as agent
nodes. You can use ACS-Engine. Here is the link to open source version
of ACS-Engine: https://github.com/Azure/acs-engine

Related

ARM Template deploymentScripts custom container instance fileshare name

I have created a template which deploys a deploymentScripts to do some work in SQL. Since we locked down SQL on a network level I needed to create a custom container instance which is connected to my vnet. That Container Instance needs to have a volume mounted on an Azure Storage Account. The fileshare on that is created by the deploymentScripts deployment but you don't seem to be able to set that. How do I reliably get to that value so I can create that myself and mount? Here's the part of the container instance I'm talking about. Its the "shareName": "hvtqyj3nqhygoazscripts" I'm looking for. Seems to be using the uniqueString() function concatenated with 'azscripts'. What is the input to the uniqueString() function?
"volumes": [
{
"name": "azscripts",
"azureFile": {
"shareName": "hvtqyj3nqhygoazscripts",
"storageAccountName": "<storename>",
"storageAccountKey": "<key>"
}
}
]
In DeploymentScripts (DS), ACI is not seen as a shared resource, so you cannot create it in advance and use it in DS (there's 1 ACI per DS), but you can use an existing Storage Account as seen here. File shares are controlled by DS to isolate script content and outputs so you cannot control the name.

Azure VM image does not have Source Blob URI

After following the instructions for creating a managed image in Azure, I'm trying to create a VM from the managed image inside the ARM template. The ARM template requires a source blob URI which should be listed on the VM image page within the Azure portal, but it's blank (see screen shot below).
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource
Did I miss a step somewhere?
yes, to create a vm from the managed disk image you need its resource id, not its uri (because it doesnt have one). Here's an ARM Template bit to create a VM from the managed disk image:
"storageProfile": {
"imageReference": {
"id": "[resourceId('Microsoft.Compute/images', concat(parameters('vmPrefix'), '-gateway-osImage'))]"
},
"osDisk": {
"name": "[concat(parameters('vmPrefix'), '-gateway-os-vhd')]",
"createOption": "FromImage"
}
},

Azure image has no uri - Cant create auto scale from it

I have successfully created an image of a VM using packer. The instance is an Ubuntu machine installed with nginx.
Now, when i want to fire up a ressource group with a load balancer and Auto-Scaling, i need to refer this image using a URI; but when i go to the image in Azure, the URI field is empty.
How do i get this URI, so i can set up my Auto Scale enviornment, with the template below?
Best,
Jonas
i need to refer this image using a URI; but when i go to the image in
Azure, the URI field is empty.
This is because that your Image is managed. With Managed Image, you wouldn't see the URI, just like manged disk.
How do i get this URI, so i can set up my Auto Scale enviornment, with
the template below?
Since your Image is managed , you cannot get the URI. However, you can still create VMSS from the managed Image with template.
You can use
"imageReference": {
"id": "[variables('managedImageId')]"
}
You can refer to this template. This template uses the Name and Group of the image to deploy VMSS.
Hope this helps!

creating new VM in azure that uses existing vhd

Is it possible to create a new VM (Azure RM) that uses an existing vhd disk (where everything is already set up) that is already on a storage account? In the new portal, I can't find any option for doing that. But can it be done by editing a template or by using PowerShell? Can anyone point me to any docs about this?
You can deploy an existing Vhd from both PowerShell and ARM Templates.
There are two methods of using an existing image. You can either directly attach that disk or you can use that disk as an image source.
If you look at the Create a Virtual Machine from a User Image template on Github. There is both a template and a PowerShell script.
Both of those are currently configured to make a copy of the Vhd and use that. If you want to directly attach your Vhd you would need to change this line (currently line 168) in the template
"createOption": "FromImage",
to
"createOption": "Attach",
You would do the same for the createoption of Add-AzureVMDataDisk
Yes you can create a Resource Manager VM from a VHD. It is possible through aRMT template. in Github there is a reference template, please edit and deploy that.
Thanks!
Sabha Mahadevan

Configuring Azure Batch using an Azure Resource Manager template

I'm looking for any examples of configuring Azure Batch using an Azure Resource Manager template. Googling yielded nothing, and the Azure QuickStart Templates do not yet have any Batch examples, however this SO question implies that it has been done.
What I would like to achieve is, via an ARM template, to create a Batch account and configure a pool (with a minimum number of compute nodes, auto expanding to a maximum number of nodes), and then set the resulting pool ID into my API server's appsettings resource.
I'm about to start reverse engineering it using the Azure Resource Explorer, but any pre-existing examples would be very much appreciated.
Update
So far I've managed to create the resource:
{
"name": "[variables('batchAccountName')]",
"type": "Microsoft.Batch/batchAccounts",
"location": "[resourceGroup().location]",
"apiVersion": "2015-07-01",
"dependsOn": [ ],
"tags": {
"displayName": "BatchInstance"
}
}
And to configure the account settings in the appsettings of my API server:
"BATCH_ACCOUNT_URL": "[concat('https://', reference(concat('Microsoft.Batch/batchAccounts/', variables('batchAccountName'))).accountEndpoint)]",
"BATCH_ACCOUNT_KEY": "[listKeys(resourceId('Microsoft.Batch/batchAccounts', variables('batchAccountName')), providers('Microsoft.Batch', 'batchAccounts').apiVersions[0]).primary]",
"BATCH_ACCOUNT_NAME": "[variables('batchAccountName')]"
I still haven't managed to create a pool and fetch the pool ID via ARM, mainly because the pool I created using Batch Explorer never showed up in either the Azure Portal or the Azure Resource Explorer. I'll update this if I find the solution.
Unfortunately we don't have a way today to create a pool using ARM templates. The Azure Portal should show the pools created under your account (even if you didn't created them using ARM).
This is supported, please see the reference docs here: https://learn.microsoft.com/azure/templates/microsoft.batch/2019-04-01/batchaccounts/pools

Resources