Metric based autoscaler in a container

  1. Build the image and push it in registry
  2. Create a service account for your deployment
  3. Your service account needs the edit role for your project to scale replication controllers and the cluster reader role to access the heapster API service: oc policy add-role-to-user edit system:serviceaccount:<project>:<service account> -n <project> oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:<project>:<service account>
  4. You have to deploy the heapster metrics stack. See
  5. Deploy using the template in you project:
    • It’s recommended to create a file with your template parameters: oc process -n <project> -f pod-scaler-deployment-template.json -v=`cat variables.txt` | oc create -n <project> -f -

The parameters are:

Template Parameter Meaning
NAMESPACE Project/Namespace
REPL_CTRL Name of the replication controller
MASTER_URL URL of the OSE Master API Server. Has to match the URL of the CA Certificate
METRICS_SVC Service Name of the used metrics service
MIN_POD Minimal amount of pods. Should be at least 1
MAX_POD Maximal amount of pods
STEP_POD Amount of pods to scale up or down
SERVICE_ACCOUNT Name of the service accoun to be used. See above
LOOP_WAIT Wait number of seconds until the next scaling decisionis checked against the threshold
SCAN_INTV Bucket length in seconds of the hawkular scan windows
SCAN_METRIC metricstring of the metric service
THRESHOLD_METRIC Threshold when reached new pods are scaled up or down otherwise
APPLICATION_NAME Used in labels to identify objects
IMAGE_STREAM Image change trigger on the pod scaling image
DOCKER_IMAGE Use this image