All Projects → pusher → k8s-spot-price-monitor

pusher / k8s-spot-price-monitor

Licence: Apache-2.0 License
Monitors the spot prices of instances in a Kubernetes cluster and exposes them as prometheus metrics

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to k8s-spot-price-monitor

k8s-spot-termination-handler
Monitors AWS for spot termination notices when run on spot instances and shuts down gracefully
Stars: ✭ 113 (+162.79%)
Mutual labels:  cloud-infrastructure, spot
py-spotme
A CLI tool that creates AWS spot instances on the fly
Stars: ✭ 16 (-62.79%)
Mutual labels:  spot
binance-connector-dotnet
Lightweight connector for integration with Binance API
Stars: ✭ 77 (+79.07%)
Mutual labels:  spot
Benzaiboten-spot-trading-bot
A trading bot easy to use to be linked to your favorite exchange to automatize the trading on cryptocurrencies
Stars: ✭ 20 (-53.49%)
Mutual labels:  spot
spot price machine learning
Machine Learning for Spot Prices
Stars: ✭ 25 (-41.86%)
Mutual labels:  spot
ecs-mesh-workshop
This handy workshop help the customers to quickly launch ECS with service mesh support on top of mixed type of instance in all commercial regions (include China), and also provides hands-on tutorials with best practices. It can be customized easily as per need.
Stars: ✭ 17 (-60.47%)
Mutual labels:  spot
huobi Cpp
C++ SDK for Huobi Spot API
Stars: ✭ 56 (+30.23%)
Mutual labels:  spot
introspector
A schema and set of tools for using SQL to query cloud infrastructure.
Stars: ✭ 61 (+41.86%)
Mutual labels:  cloud-infrastructure
s3bundler
ARCHIVED - see https://aws.amazon.com/about-aws/whats-new/2019/04/Amazon-S3-Introduces-S3-Batch-Operations-for-Object-Management/ Amazon S3 Bundler downloads billions of small S3 objects, bundles them into archives, and uploads them back into S3.
Stars: ✭ 26 (-39.53%)
Mutual labels:  spot
huobi CSharp
CSharp SDK for Huobi Spot API
Stars: ✭ 47 (+9.3%)
Mutual labels:  spot
Aws Cdk
The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
Stars: ✭ 7,963 (+18418.6%)
Mutual labels:  cloud-infrastructure
Oauth2 Proxy
A reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers.
Stars: ✭ 4,511 (+10390.7%)
Mutual labels:  cloud-infrastructure
oec-ng
OEC 现货交易助手(前端)
Stars: ✭ 14 (-67.44%)
Mutual labels:  spot

Spot Price Monitor

NOTE: this repository is currently UNMAINTAINED and is looking for new owner(s). See #19 for more information.

Table of contents

Introduction

Reads instance types and availability zones from Kubernetes labels to expose as Prometheus metrics, the current spot prices of spot instances within a cluster.

Usage

Deploy to Kubernetes

A docker image is available at quay.io/pusher/k8s-spot-price-monitor. These images are currently built on pushes to master. Releases will be tagged.

Sample Kubernetes manifests are available in the deploy folder.

To deploy in clusters using RBAC, please apply all of the manifests (Deployment, ClusterRole, ClusterRoleBinding and ServiceAccount) in the deploy folder but uncomment the serviceAccountName in the Deployment.

Requirements

For the K8s Spot Price Monitor to filter spot instances as expected; you will need an identifying label on your spot instances.

We add a label node-role.kubernetes.io/spot-worker to our spot instances and hence this is the default for the spot-label flag.

To achieve this, add the following flag to your Kubelet:

--node-labels="node-role.kubernetes.io/spot-worker=true"

Since the script uses a built-in, well-known label for looking up instance types (beta.kubernetes.io/instance-type), this project supports K8s v1.7+.

IAM

To fetch Spot Prices, the Spot Price Monitor will need the following IAM role policy.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1519813867626",
      "Action": [
        "ec2:DescribeSpotPriceHistory"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}

Product descriptions

For EC2 Classic accounts the default Linux/UNIX product description will only work for non-VPC instance types, and for VPC accounts it will only work for VPC instance types.

It's possible to override the product descriptions with the -p/--products flag to work around this:

spot_price_monitor.py --products "Linux/UNIX" "Linux/UNIX (Amazon VPC)"

Flags

usage: spot_price_monitor.py [-h] [--running-in-cluster RUNNING_IN_CLUSTER]
                             [-l SPOT_LABEL] [-i SCRAPE_INTERVAL]
                             [-m METRICS_PORT] [-r REGION]
                             [-p PRODUCTS [PRODUCTS ...]]

Monitors kubernetes for spot instances and exposes the current spot prices as
prometheus metrics

optional arguments:
  -h, --help            show this help message and exit
  --running-in-cluster RUNNING_IN_CLUSTER
                        Will load kubernetes config from the pod environment
                        if running within the cluster, else loads a kubeconfig
                        from the running environemnt (Default: False)
  -l LABEL, --spot-label LABEL
                        Specifies the label applied to all spot instances in
                        the cluster to identify these from other types of
                        instances (Default: node-role.kubernetes.io/spot-
                        worker)
  -i SCRAPE_INTERVAL, --scrape-interval SCRAPE_INTERVAL
                        How often (in seconds) should the prices be scraped
                        from AWS (Default: 60)
  -m METRICS_PORT, --metrics-port METRICS_PORT
                        Port to expose prometheus metrics on (Default: 8000)
  -r REGION, --region REGION
                        The region that the cluster is running in (Default:
                        us-east-1)
  -p PRODUCTS [PRODUCTS ...], --products PRODUCTS [PRODUCTS ...]
                        List of product (descriptions) to use for filtering
                        (Default: Linux/UNIX)

Related

Communication

  • Found a bug? Please open an issue.
  • Have a feature request. Please open an issue.
  • If you want to contribute, please submit a pull request

Contributing

Please see our Contributing guidelines.

License

This project is licensed under Apache 2.0 and a copy of the license is available here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].