Halyard is a tool for horizontal autoscaling with Kubernetes (K8S). It leverages a metrics backend to determine the current value of a metric, and linearly scales the number of pods so the metric approaches a given target value. This enables dynamic scaling in response to changes in load.
Currently supported backends:
- docker run -d -v Config.json:/config/Config.json:ro patientcoeng/halyard
- curl -o deployment.yaml https://raw.githubusercontent.com/patientcoeng/halyard/master/manifests/deployment.yaml
- Edit deployment.yaml to replace the placeholder values with those specific to your setup
- kubectl apply -f deployment.yaml
- Clone the halyard repository
- Install govendor "go install github.com/kardianos/govendor"
- Run "govendor sync"
- Run "go build"
- Run halyard
Halyard expects a JSON-encoded configuration file to be present in the same directory as the Halyard binary. You can use the config command line option to use a different file. An example file is listed below, for reference:
{
"period": 30,
"namespace": "default",
"backendEndpoints": {
"prometheus": "https://my-prometheus-server"
},
"alertConfig": {
"slack": {
"webhookURL": "https://hooks.slack.com/services/YOUR_SERVICE_ID",
"channel": "#yourchannel"
}
}
}
Halyard works by reading annotations on Kubernetes. The following annotations are supported. All values are strings.
- halyard.patientco.com/query
- A query string, recognized by the designated backend
- halyard.patientco.com/backend
- The name of the backend to process the given query
- halyard.patientco.com/target-value
- The target value to set the query result to, as a string.
- halyard.patientco.com/min-replicas
- The minimum number of allowed replicas
- halyard.patientco.com/max-replicas
- The maximum number of allowed replicas
- halyard.patientco.com/scaling-policy
- Currently only "linear" is supported
-config string
Location of JSON-encoded config file (default "Config.json")