Skip to content

Commit

Permalink
Add SpotVM doc
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelSpeed committed May 13, 2020
1 parent b5c0260 commit d7177a5
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions docs/topics/spot-vms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Spot Virtual Machines

[Azure Spot Virtual Machines](https://azure.microsoft.com/en-gb/pricing/spot/) allow users to reduce the costs of their
compute resources by utilising Azure's spare capacity for a lower price.

With this lower cost, comes the risk of preemption.
When capacity within a particular Availability Zone is increased,
Azure may need to reclaim Spot Virtual Machines to satisfy the demand on their data centres.

## When should I use Spot Virtual Machines?

Spot Virtual Machines are ideal for workloads that can be interrupted.
For example, short jobs or stateless services that can be rescheduled quickly,
without data loss, and resume operation with limited degradation to a service.

## How do I use Spot Virtual Machines?

**Note**: This feature is only available on Machines at present and not on the
experimental MachinePools.

To enable a Machine to be backed by a Spot Virtual Machine, add `spotMarketOptions`
to your `AzureMachineTemplate`:

```yaml
apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3
kind: AzureMachineTemplate
metadata:
name: capz-mp-0
spec:
location: westus2
template:
osDisk:
diskSizeGB: 30
managedDisk:
storageAccountType: Premium_LRS
osType: Linux
sshPublicKey: ${YOUR_SSH_PUB_KEY}
vmSize: Standard_D2s_v3
spotMarketOptions: {}
```
You may also add a `maxPrice` to the options to limit the maximum spend for the
instance. It is however, recommend **not** to set a `maxPrice` as Azure will
cap your spending at the on-demand price if this field is left empty and you will
experience fewer interruptions.

```yaml
spec:
template:
spotMarketOptions:
maxPrice: "0.04" Price in USD per hour (up to 5 decimal places)
```

0 comments on commit d7177a5

Please sign in to comment.