Skip to main content

Best Practices

When setting up and managing Kubernetes clusters, there are a number of best practices that can help to ensure high availability and scalability, and to avoid common issues. Here is a summary of some of these best practices:

Using replicas instead of bare pods

  • Use of replicas: Always deploy your applications in a high-availability configuration by using multiple stable replicas of your applications and avoiding the use of bare pods.

  • Application specifications: Use the replicas field in your application specification to define at least three replicas.

Choose an appropriate node size

  • Choose an appropriate node size: For production clusters, nodes should be large enough (2.5 GB or more) to absorb the workload of a failed node.

  • Node plan: When creating a cluster, select a node plan that meets the requirements of your project.

Sizing node pools for high availability

  • Minimum number of nodes: Node pools containing production workloads should comprise at least three nodes.

  • Autoscaling: Configure the autoscaling feature to ensure a minimum cluster size of three nodes.

Setting queries and limits

  • Efficient use of resources: Define the requests and limits objects in your application specification for all deployments to optimise resource utilisation.

Setting up Pod Disruption Budgets

  • Preventing disruptions: Set up a Pod Disruption Budget (PDB) that limits the number of replicated pods that can fail simultaneously.

  • PDB specification: Create a PodDisruptionBudget policy specification to define the minimum number of available pods for an application.

Enable automatic upgrades

  • Latest features and security patches: Enable automatic upgrades to ensure your cluster is running the latest features, security patches and stability improvements.

Enable Surge Upgrades

  • Minimising the impact of upgrades: Enable Surge Upgrades to minimise overall downtime and the impact on applications during an upgrade.

Check cluster linter messages

  • Early identification of issues: Use Clusterlint regularly to identify issues in your cluster that might otherwise not be immediately apparent.

These best practices help to maximise the stability, scalability and availability of Kubernetes clusters, whilst minimising potential issues and downtime.