Tags: azure, cost


Overview


By default Kublr creates all master and worker instance groups using regular Azure on-demand instances.


At the same time, Azure allow using and Kublr allows customizing the instance group configuration to implement extended use-cases such as using less expensive spot instances.


Virtual Machine Scale Set groups configuration


The following cluster specification snippet shows an example of such customization with both master and worker node groups of VirtualMachineScaleSet type using spot instances.


spec:
  master:
    ...
    locations:
      - locationRef: azure1
        azure:
          groupType: VirtualMachineScaleSet
          ...
          armTemplateExtras:
            scaleSet:
              apiVersion: '2021-07-01'
              properties:
                singlePlacementGroup: false
                virtualMachineProfile:
                  priority: Spot
                  evictionPolicy: Delete
                  billingProfile:
                    maxPrice: -1
                spotRestorePolicy:
                  enabled: true
                  restoreTimeout: P2D
  nodes:
    - name: group1
      ...
      locations:
        - locationRef: azure1
          azure:
            groupType: VirtualMachineScaleSet
            ...
            armTemplateExtras:
              scaleSet:
                apiVersion: '2021-07-01'
                properties:
                  singlePlacementGroup: false
                  virtualMachineProfile:
                    priority: Spot
                    evictionPolicy: Delete
                    billingProfile:
                      maxPrice: -1
                  spotRestorePolicy:
                    enabled: true
                    restoreTimeout: P2D


Virtual Machine groups configuration


For all other (non-VirtualMachineScaleSet) group types - namely VirtualMachine - the group customization should be as follows:


spec:
  master:
    ...
    locations:
      - locationRef: azure1
        azure:
          groupType: VirtualMachine
          ...
          armTemplateExtras:
            virtualMachine:
              apiVersion: '2021-07-01'
              properties:
                priority: Spot
                evictionPolicy: Deallocate
                billingProfile:
                  maxPrice: -1
  nodes:
    - name: group1
      ...
      locations:
        - locationRef: azure1
          azure:
            groupType: VirtualMachine
            ...
            armTemplateExtras:
              virtualMachine:
                apiVersion: '2021-07-01'
                properties:
                  priority: Spot
                  evictionPolicy: Deallocate
                  billingProfile:
                    maxPrice: -1