<p>Using AWS EC2 to install Rancher cluster. Then setup Kubernetes cluster from Rancher server.</p>

<p>About auto scaling, there are some ways to do:</p>

<h2>Use Rancher cattle webhook service</h2>

<blockquote>
  <p><a href="https://rancher.com/docs/rancher/v1.6/en/cattle/webhook-service/" rel="nofollow noreferrer">https://rancher.com/docs/rancher/v1.6/en/cattle/webhook-service/</a></p>
</blockquote>

<p>This way should use monitoring tool Prometheus to monitor CPU usage, then add or delete nodes due to alerting.</p>

<h2>Use terraform to generate rancher-master-ha, rancher-nodes, networking, database dynamictly</h2>

<blockquote>
  <p><a href="http://rancher.com/aws-rancher-building-resilient-stack/" rel="nofollow noreferrer">http://rancher.com/aws-rancher-building-resilient-stack/</a></p>
</blockquote>

<p>This can well done for Rancher cluster.</p>

<h2>Horizontal Pod Autoscaling Walkthrough</h2>

<blockquote>
  <p><a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/</a></p>
</blockquote>

<p>It's official horizontal pod autoscaling way.</p>

<h2>Kubernetes Autoscaler</h2>

<blockquote>
  <p><a href="https://github.com/kubernetes/autoscaler" rel="nofollow noreferrer">https://github.com/kubernetes/autoscaler</a></p>
</blockquote>

<p>It's also a official auto scaling way for Kubernets cluster.</p>

<h2>Use AWS Auto Scaling</h2>

<blockquote>
  <p><a href="https://aws.amazon.com/autoscaling/" rel="nofollow noreferrer">https://aws.amazon.com/autoscaling/</a></p>
</blockquote>

<p>About this way, how to connect it to Rancher cluster and Kubernetes cluster running on EC2?</p>

<hr>

<p>There are many ways to do the auto scaling, but which is the best way? And the very important thing is, how to use AWS Auto Scaling for this architecture?</p>

<p>Since you deployed Kubernetes with Rancher, you should use Rancher webhooks for this operation.
Use Prometheus/Grafana to set up webhook when CPU utilization is over some %.</p>
