Reputation: 3053
I have a Kubernetes cluster running in AWS. I used kops
to setup and start the cluster.
I defined a minimum and maximum number of nodes in the nodes instance group:
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
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.
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.
Do I miss any configuration?
UPDATE
As @kichik mentioned, the autoscaler addon is already installed. Nevertheless, it doesn't work. Kube-dns is also often restarting because of resource problems.
Upvotes: 1
Views: 1088
Reputation: 34704
Someone opened a ticket for this on GitHub and it suggests you have to install the autoscaler addon. Check if it's already installed with:
kubectl get deployments --namespace kube-system | grep autoscaler
If it's not, you can install it with the following script. Make sure AWS_REGION
, GROUP_NAME
, MIN_NODES
and MAX_NODES
have the right values.
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}
Upvotes: 1