The strength of Kubernetes is its ability to quickly deploy applications that are scalable and replicable. We’ve made using Kubernetes easy with our intuitive interface, but there are some best practices and principles for Kubernetes you should keep in mind when designing your cluster. The number of nodes, node size and other cluster considerations are essential for performance and scalability.

When creating a Kubernetes cluster, you have to decide about the initial setup. A Kubernetes cluster consists of at least one master and multiple worker nodes. Your pods and container will run on one of the nodes in your cluster and can automatically be replicated to other nodes in your cluster. The number of nodes and node size should be adjusted to the number of pods, available resources and the desired level of replication.

Determining the best size of your Kubernetes cluster nodes

One of the main advantages of Kubernetes is its scalability. If you need more nodes after setting up your cluster, you can easily add them. Keep in mind that your master node will not automatically scale and cannot be resized when you are expanding your cluster. Therefore, we have written some guidelines for determining the size of your master node. When you are using Cloudlets Kubernetes Cluster, we recommend you to use our pre-defined instance sizes, which are identical to the instance types you can find on AWS. The instance sizes we recommend, based on our experiences and recommendations made by Kubernetes:

  • 1-5 nodes: t2.medium (2 vCPU, 4 GB RAM)
  • 6-10 nodes: t3.large (2 vCPU, 8 GB RAM)
  • 11-100 nodes: t3.xlarge (4 vCPU, 16 GB RAM)
  • 101-250 nodes: t3.2xlarge (8 vCPU, 32 GB RAM)
  • 251-500 nodes: c4.4xlarge (16 vCPU, 30GB RAM)
  • more than 500 nodes: c4.8xlarge (36 vCPU, 60 GB RAM)

How many nodes should you have?

The number of nodes mainly depends on the resource usage of the applications you are deploying to your cluster and the number of replicas. When specifying a pod, we advise you to set resource limits. With specified resource limits Kubernetes can better determine which nodes the pods should be deployed on. This will positively affect your performance and stability. Also, when exposing limits, bugs in application code can not cause overconsumption of resources in your cluster.

When using Kubernetes, your cluster should be seen as a whole, there is no need to worry about individual nodes. This means you could make an estimation of the total usage of the applications running in your cluster and add the required number of nodes to meet the resources you are expecting to need. Always start with a few more nodes then strictly necessary, because Kubernetes itself needs some resources too and to make sure you have enough resources at your disposal. You can easily increase or decrease the number of nodes afterward, without any downtime.

Monitoring your cluster

Getting insight into the status, resource usage and performance of your cluster, nodes, pods and deployments is your key to optimizing your resource utilization, performance and stability. The number of monitoring tools for Kubernetes and containers is growing on a daily basis. We recommend you to use Heapster, a community initiative with an excellent REST API that enables you to monitor your cluster with tools like InfluxDB and Grafana.