If you intend to leverage autoscaling on Kubernetes, you may want the Cluster Autoscaler to expose some metrics for you. It’s pretty simple to a) enable access to the
/metrics route and b) instruct your Prometheus to scrape it:
a) Expose port 8085 for your Cluster Autoscaler deployment:
ports: --name: app containerPort: 8085
See line 50 in this gist of an example deployment manifest.
b) Add the following annotation to your Cluster Autoscaler service:
See this gist of an example service manifest. To get started, this is a pretty nice Grafana dashboard to make the exposed metrics instantly more useful for you. If you’re using Network Policies, which you should, use this as a starting point to allow the scraper to actually connect to the exposed metrics route.
You may need to edit the namespaces, depending on your configuration.
You’ll now be able to use the Cluster Autoscaler with much more confidence.
Hit me up on Twitter to let me know if and how autoscaling is working out for you. Don’t hesitate to contact me if you’re stuck somewhere.