<p>I have a Kubernetes cluster running in AWS. I used <code>kops</code> to setup and start the cluster. </p>

<p>I defined a minimum and maximum number of nodes in the nodes instance group: </p>

<pre><code>apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
  creationTimestamp: 2017-07-03T15:37:59Z
  labels:
    kops.k8s.io/cluster: k8s.tst.test-cluster.com
  name: nodes
spec:
  image: kope.io/k8s-1.6-debian-jessie-amd64-hvm-ebs-2017-05-02
  machineType: t2.large
  maxSize: 7
  minSize: 5
  role: Node
  subnets:
  - eu-central-1b
</code></pre>

<p>Currently the cluster has 5 nodes running. After some deployments in the cluster, pods/containers cannot start because there are no nodes available with enough resources. </p>

<p>So I thought, when there is a resource problem, k8s scales automatically the cluster and start more nodes. Because the maximum number of nodes is 7.</p>

<p>Do I miss any configuration? </p>

<p><strong>UPDATE</strong></p>

<p>As @kichik mentioned, the autoscaler addon is already installed. Nevertheless, it doesn't work. Kube-dns is also often restarting because of resource problems. </p>

CPA
<p>Someone opened a <a href="https://github.com/kubernetes/kops/issues/341" rel="nofollow noreferrer">ticket for this on GitHub</a> and it suggests you have to install the <a href="https://github.com/kubernetes/kops/tree/master/addons/cluster-autoscaler" rel="nofollow noreferrer">autoscaler addon</a>. Check if it's already installed with:</p>

<pre><code>kubectl get deployments --namespace kube-system | grep autoscaler
</code></pre>

<p>If it's not, you can install it with the following script. Make sure <code>AWS_REGION</code>, <code>GROUP_NAME</code>, <code>MIN_NODES</code> and <code>MAX_NODES</code> have the right values.</p>

<pre><code>CLOUD_PROVIDER=aws
IMAGE=gcr.io/google_containers/cluster-autoscaler:v0.5.4
MIN_NODES=5
MAX_NODES=7
AWS_REGION=us-east-1
GROUP_NAME="nodes.k8s.example.com"
SSL_CERT_PATH="/etc/ssl/certs/ca-certificates.crt" # (/etc/ssl/certs for gce)

addon=cluster-autoscaler.yml
wget -O ${addon} https://raw.githubusercontent.com/kubernetes/kops/master/addons/cluster-autoscaler/v1.6.0.yaml

sed -i -e "s@{{CLOUD_PROVIDER}}@${CLOUD_PROVIDER}@g" "${addon}"
sed -i -e "s@{{IMAGE}}@${IMAGE}@g" "${addon}"
sed -i -e "s@{{MIN_NODES}}@${MIN_NODES}@g" "${addon}"
sed -i -e "s@{{MAX_NODES}}@${MAX_NODES}@g" "${addon}"
sed -i -e "s@{{GROUP_NAME}}@${GROUP_NAME}@g" "${addon}"
sed -i -e "s@{{AWS_REGION}}@${AWS_REGION}@g" "${addon}"
sed -i -e "s@{{SSL_CERT_PATH}}@${SSL_CERT_PATH}@g" "${addon}"

kubectl apply -f ${addon}
</code></pre>
