Set Up Elastigroup Commitments
Cloud service provider relevance: Azure Kubernetes.
Before you can enable commitments for your group, you need to:
- Purchase Azure commitments (see Azure documentation).
- Get your Azure credentials.
- Connect Commitments to Spot Products.
Once you have your Azure credentials, you can enable commitments using either the Spot console or the Spot API.
Get the Azure Credentials Required to Connect Commitments to Spot Products
Follow the instructions below while referring to the Azure documentation:
App Registration
-
Log in to your Azure account.
-
Go to App registrations.
-
Register a new application.
-
Set the Redirect URI to
https://spot.ionoteSpot requires this URI for authentication purposes.
-
Copy the following IDs (you will need them later to connect to Spot):
- Application (client) ID.
- Directory (tenant) ID.
Certificates & Secrets
- In Azure, under the newly created application, click Certificates & secrets.
- Create a new client secret and set its expiration to 24 months.
- Copy the following details (you will need them later to connect to Spot):
- Application secret expiration date.
- Client secret value.
Connect Commitments to Spot Products
- Obtain the credentials from your Azure app. See Get your Azure credentials
If you have already configured commitments for either Ocean or Stateful Node, you already have your credentials for Elastigroup. Continue with Step 5 of this procedure.
-
Set these credentials for the Azure tenant in Spot API-Accounts:
- Application (client) ID -
clientId - Client secret -
clientSecret - Directory (tenant) ID -
tenantId - Application secret expiration date -
expirationDate
- Application (client) ID -
-
Use the following Azure PowerShell script to assign the Reservation Reader / Savings Plan Reader roles at the tenant level:
Import-Module Az.Accounts
Import-Module Az.Resources
Connect-AzAccount -Tenant {TENANT_ID}
## Assign Reservation Reader role
New-AzRoleAssignment -Scope "/providers/Microsoft.Capacity" -ApplicationId {CLIENT_ID} -RoleDefinitionName "Reservations Reader"
## Assign Savings Plan Reader role (optional)
New-AzRoleAssignment -Scope "/providers/Microsoft.BillingBenefits" -ApplicationId {CLIENT_ID} -RoleDefinitionName "Savings plan Reader" -
Use the following Azure PowerShell script to assign the Custom Reader role:
# Replace with your principal's object ID (user, group, or service principal)
$principalId = "<YOUR-PRINCIPAL-ID>"
# Replace with your custom role name (from your JSON)
$roleName = "Custom Reader Role"
# Path to your custom role definition JSON file
$roleFile = "custom-role.json"
# Create the custom role
az role definition create --role-definition $roleFile
# Assign the custom role to all subscriptions
$subscriptions = az account list --query "[].id" -o tsv
foreach ($sub in $subscriptions) {
Write-Host "Assigning role to subscription: $sub"
az role assignment create `
--assignee $principalId `
--role $roleName `
--scope "/subscriptions/$sub"
}
# For management groups, use the following:
$managementGroups = az account management-group list --query "[].name" -o tsv
foreach ($mg in $managementGroups) {
Write-Host "Assigning '$roleName' to principal at MG: $mg"
az role assignment create `
--assignee $principalId `
--role $roleName `
--scope "/providers/Microsoft.Management/managementGroups/$mg"
} -
In the Spot API, the
shouldUtilizeCommitmentsattribute controls utilization commitments.When set to
True(false is default), and there are free reserved instances / savings plans within the Azure account, Elastigroup will utilize them before launching spot instances.To enable the commitments feature:
In the Spot API - Create Elastigroup or Update Elastigroup (under strategy), set the
shouldUtilizeCommitmentsattribute toTrue.