Day 34/40 - Step-By-Step Guide To Upgrade a Multi Node Kubernetes Cluster With Kubeadm

About this video

### Final Comprehensive Summary This document provides a detailed overview of upgrading Kubernetes clusters, focusing on strategies, processes, and best practices for maintaining system stability and compatibility. The content is part of the "CIES CK 2024" series, emphasizing the importance of regular Kubernetes upgrades to ensure security, performance, and access to the latest features. --- #### **Key Concepts and Strategies** 1. **Node Maintenance and Workload Management**: - The `drain` command is essential for removing workloads (Pods) from a node during maintenance, ensuring they are rescheduled elsewhere. - The `cordon` command marks a node as unschedulable, preventing new Pods from being deployed to it. - Pods managed by deployments are automatically rescheduled, but standalone Pods (e.g., MySQL) require manual intervention to avoid permanent deletion. 2. **Upgrade Strategies**: - **Rolling Update**: Nodes are upgraded one at a time, minimizing downtime and ensuring continuous service availability. - **Bulk Upgrade**: All nodes are upgraded simultaneously, causing temporary unavailability. This approach is faster but riskier. - **Blue-Green Deployment**: A new infrastructure is created alongside the old one. Once the new nodes are ready, traffic is gradually shifted, and the old nodes are decommissioned. This strategy reduces downtime but requires additional resources. 3. **Versioning and Compatibility**: - Kubernetes follows a Major.Minor.Patch versioning format. - Upgrades must progress one minor version at a time (e.g., 1.28 → 1.29 → 1.30). - Only the latest three minor versions are supported, making regular upgrades mandatory to avoid losing official support and bug fixes. - Backward compatibility is ensured within supported versions, allowing incremental upgrades. 4. **High Availability**: - High availability setups with multiple master nodes are recommended to prevent downtime during upgrades. - The control plane should be upgraded first, followed by additional control nodes, and finally worker nodes. --- #### **Step-by-Step Upgrade Process** 1. **Preparation**: - Identify the target version using tools like `apt` or `kubeadm`. - Ensure all components (e.g., `kubeadm`, `kubelet`) are compatible with the target version. - Verify the health of critical components (e.g., API server, controller manager) before proceeding. 2. **Control Plane Upgrade**: - Use commands like `kubeadm upgrade apply` to update the control plane. - Validate the upgrade through manifest files and ensure the API server and other components are functioning correctly. 3. **Worker Node Upgrade**: - Use the `drain` command to remove workloads from each node before upgrading. - Exclude DaemonSets from draining to avoid disrupting essential services. - Update `kubeadm` and `kubelet` on each worker node, then restart the `kubelet` service to apply changes. - Re-enable scheduling on the node once the upgrade is complete. 4. **Post-Upgrade Verification**: - Confirm that all components are running the desired version. - Test the cluster's functionality to ensure no issues arose during the upgrade. --- #### **Challenges and Considerations** - **Cloud vs. On-Premises**: - Cloud-managed environments (e.g., GKE, EKS) simplify upgrades due to automated resource provisioning. - On-premises setups may face challenges in acquiring additional resources, requiring approvals and hardware purchases. - **Automation and Scalability**: - Frequent releases (every 2–3 months) necessitate automation or dedicated teams for large-scale environments. - Regular upgrades are critical to maintaining compatibility and avoiding unsupported versions. - **Component Compatibility**: - API server, controller manager, and scheduler must operate within compatible version ranges (e.g., API server at version X, controller at X-1, and other components at X-2). --- #### **Best Practices and Recommendations** - Perform upgrades incrementally to minimize risks and ensure backward compatibility. - Use high availability setups to maintain service continuity during upgrades. - Leverage blue-green deployments when additional resources are available to reduce downtime. - Practice upgrades in test environments before applying them to production systems. - Engage with the Kubernetes community and utilize resources like GitHub repositories for troubleshooting and learning. --- #### **Conclusion** Upgrading Kubernetes clusters is a complex but essential process that requires careful planning and execution. By understanding key concepts like versioning, compatibility, and upgrade strategies, administrators can ensure smooth transitions with minimal disruption. Whether using rolling updates, bulk upgrades, or blue-green deployments, the focus should always be on maintaining system availability and performance. Regular upgrades, combined with automation and high availability setups, are crucial for managing Kubernetes environments effectively.


Course: Certified Kubernetes Administrator Full Course For beginners | CKA 2025

This playlist contains the complete CKA series for beginners, based on the latest 2025 curriculum. It includes 40+ videos with hands-on demos, assignments, and exam-based scenarios. We will cover everything from the basics to the Advanced, including fundamental concepts such as Docker, containers, Docker storage and networking, DNS, etc.

View Full Course