Kubernetes
Setup Cluster
KubeadmSetup
V Upgrade

Kubernetes Release Format and Upgrade Process

Kubernetes Release Format

Kubernetes follows a semantic versioning format: vX.Y.Z, where:

  • X is the major version.
  • Y is the minor version.
  • Z is the patch version.

Note: ETCD and CoreDNS have separate versioning. All other Kubernetes components typically share the same version.


Upgrade Process

Key Points

  • Kubernetes upgrades should be done one minor version at a time (e.g., from v1.30 to v1.31).
  • The upgrade involves first upgrading the master node(s) and then the worker nodes.
  • During a master node upgrade, management operations are temporarily unavailable, but running pods remain unaffected.

Upgrade Steps

1. Upgrade Master Node

Find the Latest Patch Version

  1. Check for the latest version in your current minor release:
    sudo apt update
    sudo apt-cache madison kubeadm
    Look for the latest patch version in the format 1.31.x-*.

Upgrade kubeadm

  1. Upgrade kubeadm to the desired version:
    sudo apt-mark unhold kubeadm && \
    sudo apt-get update && sudo apt-get install -y kubeadm='1.30.2-1.1' && \
    sudo apt-mark hold kubeadm

Plan the Upgrade

  1. View the available upgrade plan:

    sudo kubeadm upgrade plan
  2. Apply the upgrade:

    sudo kubeadm upgrade apply vX.XX.0

Verify Node Versions

  1. Check the node versions:
    kubectl get nodes

Drain the Node

  1. Safely drain the node:
    kubectl drain <node-to-drain> --ignore-daemonsets

Upgrade kubelet and kubectl

  1. Update kubelet and kubectl:
    sudo apt-mark unhold kubelet kubectl && \
    sudo apt-get update && sudo apt-get install -y kubelet='1.30.2-1.1' kubectl='1.30.2-1.1' && \
    sudo apt-mark hold kubelet kubectl

Restart and Uncordon the Node

  1. Restart kubelet and uncordon the node:
    sudo systemctl daemon-reload
    sudo systemctl restart kubelet
    kubectl uncordon <node-to-uncordon>

2. Upgrade Worker Nodes

Follow the same process as for the master node. Alternatively, refer to the official documentation (opens in a new tab).

Drain the Node

  • Drain the worker node before the upgrade:
    kubectl drain <worker-node-name> --ignore-daemonsets

Perform the Upgrade

  • Upgrade kubeadm, kubelet, and kubectl on the worker node.

Restart and Uncordon the Node

  • Restart the services and uncordon the worker node:
    sudo systemctl daemon-reload
    sudo systemctl restart kubelet
    kubectl uncordon <worker-node-name>

Post-Upgrade Validation

  1. Verify that all nodes are in the Ready state:

    kubectl get nodes
  2. Ensure all pods are running as expected:

    kubectl get pods -A

https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/ (opens in a new tab)


🧙 AI Wizard - Instant Page Insights

Click the button below to analyze this page.
Get an AI-generated summary and key insights in seconds.
Powered by Perplexity AI!