Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit f1c7485

Browse files
committed
Adds Spot Instance use in docs
Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com>
1 parent f4a4d3a commit f1c7485

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

docs/user-guide.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,39 @@ policy permissions. `Information on how to correctly set these permissions can
700700
be found here
701701
<https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy>`_.
702702

703+
Spot Instances
704+
~~~~~~~~~~~~~~
705+
Tarmak gives the ability to attempt to request spot instances for use in
706+
instance pools. Spot instances are very cheap, spare AWS instances that can be
707+
revoked by AWS at any time, given a 2 minute notification. `More information
708+
here <https://aws.amazon.com/ec2/spot/>`_.
709+
710+
Spot instances can be requested cluster-wide by giving the ``--spot-pricing``
711+
flag to ``cluster apply``. Tarmak will then attempt a best effort spot price for
712+
each instance pool in the cluster, calculated as the average spot price in the
713+
last 3 days for that instance type in each zone plus 25%.
714+
715+
Manual spot prices can be applied to each instance pool within the
716+
``tarmak.yaml`` which will override the Tarmak best effort for that instance
717+
pool. This is done through the ``spotPrice`` attribute under the instance pool,
718+
given as a number in USD. This can be added like so:
719+
720+
.. code-block:: yaml
721+
722+
- image: centos-puppet-agent
723+
maxCount: 3
724+
metadata:
725+
creationTimestamp: "2018-07-27T09:33:15Z"
726+
name: worker
727+
minCount: 3
728+
size: medium
729+
spotPrice: 0.015
730+
731+
732+
Note that Tarmak will only attempt to create spot instances for instance pools
733+
with the ``spotPrice`` attribute or spot pricing flag during a cluster apply.
734+
735+
703736
Cluster Services
704737
----------------
705738

@@ -721,3 +754,4 @@ Do the following steps to access Grafana:
721754
.. code-block:: none
722755
723756
http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy/
757+

pkg/tarmak/instance_pool/instance_pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (n *InstancePool) SpotPrice() string {
173173
}
174174

175175
func (n *InstancePool) CalculateSpotPrice() error {
176-
if n.spotPrice != "" {
176+
if n.spotPrice == "" {
177177
p, err := n.cluster.Environment().Provider().SpotPrice(n)
178178
if err != nil {
179179
return err

pkg/tarmak/provider/amazon/spot_price.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (a *Amazon) SpotPrice(instancePool interfaces.InstancePool) (float64, error
6868
total /= float64(len(prices))
6969
}
7070

71-
total *= 1.10
71+
total *= 1.25
7272

7373
return total, result.ErrorOrNil()
7474
}

0 commit comments

Comments
 (0)