<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=521127644762074&amp;ev=PageView&amp;noscript=1">

How to Streamline Kubernetes Upgrades: How Often Should You Update

Kubernetes may well be the de facto standard for container orchestration, but keeping your clusters up-to-date can still be a difficult task. Figuring out how to streamline those Kubernetes cluster upgrades can be hard, but there are a few best practices that can make the Kubernetes upgrade process easier.

The Kubernetes Release Cycle

Kubernetes follows a fairly consistent release cycle, with new minor versions released approximately every four months. Kubernetes 1.19 and newer receive  about 1 year of patch support; an increase from the approximately nine months of patch support Kubernetes 1.18 and older received. The K8s project adheres to an N+2 support policy; in other words, the three most recent minor versions receive critical fixes, including security updates and bug fixes.

Update Frequency

Given the consistent release cycle, we recommend upgrading your Kubernetes clusters at least once every six months if possible. This ensures that you're running a supported version that has the latest security patches and bug fixes. However, the ideal frequency depends on several factors that are unique to your business:

  1. Cluster size and complexity
  2. Workload requirements
  3. Organizational risk tolerance
  4. Available resources for testing and implementing upgrades

For many organizations, updating once or twice a year strikes a good balance between staying current with patches and minimizing the operational overhead of upgrading K8s. For some teams, though, it makes sense to update more frequently to take advantage of new features or address specific security concerns.

7 Best Practices for Streamlined K8s Upgrades

To make your upgrade process smoother and more efficient, consider following these seven best practices:

1. Plan and Prepare

Before beginning the upgrade process, assess your current Kubernetes environment thoroughly. Review the K8s release notes, identify deprecated APIs, and understand the impact of the upgrade on your workloads. Make sure your upgrade plan includes:

  • Backup strategies
  • Testing procedures
  • Rollback plans

2. Use a Staging Environment

Always test your upgrades in a non-production environment that closely mirrors your production setup. This enables you to identify and resolve any potential issues well before they impact your live systems.

3. Implement Rolling Upgrades

Use a rolling upgrade strategy to minimize downtime and reduce risk. This involves upgrading nodes one at a time, ensuring that your applications remain available throughout the process.

4. Watch for API Deprecations

Pay close attention to API deprecations and removals. Update your manifests and custom resource definitions (CRDs) to use the latest supported API versions before upgrading. Watch for API’s moving between alpha/beta/stable states; these can often require changes to existing resource manifests. Tools like Fairwinds' Pluto can help easily identify deprecated resources in your clusters.

5. Optimize Workload Configurations

Ensure your applications follow overall Kubernetes best practices, such as implementing the appropriate liveness probes and readiness probes, using pod disruption budgets (PDBs), and setting your resource requests and limits correctly. Appropriately implementing PDBs can ensure that not all replicas of a workload become unavailable at the same time while new nodes are coming up.

6. Use Automation

Automate as much of the upgrade process as possible. Use tools such as Terraform or cloud-provider-specific automation to streamline your upgrades and reduce the potential for human error. There are a lot of moving parts, and it can be easy to lose track. Automation is your friend when it comes to consistent infrastructure deployment.

7. Monitor and Validate

Implement robust monitoring and logging to track the upgrade process and identify any issues quickly. After the upgrade, make sure to thoroughly validate your cluster's functionality and performance (in other words, don’t just assume everything went perfectly).

Regardless of how often you plan to upgrade Kubernetes, you still need to keep up with Kubernetes release notes, security advisories, and community discussions. This information can help you anticipate potential challenges in your next upgrade and plan for the time and effort required.

Environment Considerations

Your upgrade strategy may vary significantly based on the specific environment(s) you’re using. Here are the most common options and notes on what you may need to take into consideration in your upgrade process. 

Managed Kubernetes Services

If you're using a managed Kubernetes service, such as Amazon Elastic Kubernetes Service (EKS), Google Kubernetes Engine (GKE), or Azure Kubernetes Service (AKS), you should take advantage of their built-in upgrade capabilities. These services provide some automated upgrade paths and can simplify the process significantly. Keep in mind though, that even their Auto Modes don’t cover all the bases. You’ll still need to do important K8s management work (including implementing and maintaining updates for addons).

On-Premises Clusters

For on-premises clusters, consider using tools such as kubeadm or third-party solutions to manage your upgrades. Make sure that you have a robust testing pipeline. For critical environments, consider a blue-green deployment strategy. This can allow you to switch traffic to the new (green) environment only after you’ve thoroughly validated it. It also makes it easy to roll back to a stable environment, minimizing the risk of a prolonged outage. Plus, you can test the new environment more comprehensively with this approach—and safely test your unique configurations and dependencies. 

Large-Scale Deployments

Organizations with large-scale Kubernetes deployments may want to consider whether they’d benefit from a more gradual approach to Kubernetes upgrades. Consider upgrading a subset of clusters or nodes first, then progressively rolling out updates across your infrastructure. This can help mitigate risk and maximize stability.

For example, by rolling out changes incrementally, you can minimize the blast radius if a problem arises—impacting only a small subset of the cluster. It also reduces downtime risk (particularly if you use blue/green strategies or canary deployments) while improving observability. It’s easier to pinpoint specific issues with smaller, controlled changes too, increasing your confidence in the upgrade process.

Ready to Upgrade Kubernetes?

Regularly updating your Kubernetes clusters is the only way to maintain security and access to the latest features. The ideal upgrade frequency varies depending on your specific needs, but you should expect at least one major upgrade per year. It definitely requires time and effort, not just for the upgrade itself, but for conducting research beforehand and testing afterward. 

By following best practices and creating a well-defined upgrade strategy, you can streamline the K8s upgrade process and minimize disruptions to your applications and services. Just keep in mind that Kubernetes upgrades are an ongoing process, so you should use automation as much as possible.

If you don’t have the staff in-house to consistently upgrade Kubernetes, Fairwinds can help. Fairwinds has extensive experience with Kubernetes, and can make ongoing maintenance of infrastructure a simple process for your team.