kubenetes(k8s)升级指南

kubenetes(k8s)升级指南

  1. 执行 kubeadm upgrade plan 检查升级计划,命令执行会得到类似以下结果
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: v1.25.0
[upgrade/versions] kubeadm version: v1.25.2
[upgrade/versions] Target version: v1.25.4
[upgrade/versions] Latest version in the v1.25 series: v1.25.4

Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT   CURRENT       TARGET
kubelet     2 x v1.25.2   v1.25.4

Upgrade to the latest version in the v1.25 series:

COMPONENT                 CURRENT   TARGET
kube-apiserver            v1.25.0   v1.25.4
kube-controller-manager   v1.25.0   v1.25.4
kube-scheduler            v1.25.0   v1.25.4
kube-proxy                v1.25.0   v1.25.4
CoreDNS                   v1.9.3    v1.9.3
etcd                      3.5.4-0   3.5.4-0

You can now apply the upgrade by executing the following command:

    kubeadm upgrade apply v1.25.4

Note: Before you can perform this upgrade, you have to update kubeadm to v1.25.4.

_____________________________________________________________________


The table below shows the current state of component configs as understood by this version of kubeadm.
Configs that have a "yes" mark in the "MANUAL UPGRADE REQUIRED" column require manual config upgrade or
resetting to kubeadm defaults before a successful upgrade can be performed. The version to manually
upgrade to is denoted in the "PREFERRED VERSION" column.

API GROUP                 CURRENT VERSION   PREFERRED VERSION   MANUAL UPGRADE REQUIRED
kubeproxy.config.k8s.io   v1alpha1          v1alpha1            no
kubelet.config.k8s.io     v1beta1           v1beta1             no
_____________________________________________________________________


  1. 升级之前需要先升级kubeadm,执行 apt-mark unhold kubelet kubeadm kubectl 解除版本固定(最好这三个都同步升级,kubelet kubeadm kubectl),在执行 apt-get install kubeadm 升级到最新版本,如果想升级到指定版本,则 apt-get install kubeadm=1.24.4

  2. 执行 kubeadm upgrade apply v1.25.4 升级k8s

  3. node 节点升级

    • 首先更新配置: sudo kubeadm upgrade node
    • 然后升级或者安装 sudo apt install kubelet kubectl kubeadm 如果是hold版本的就需要unhold
    • 最后重启 sudo systemctl daemon-reload && sudo systemctl restart kubelet
  4. reboot

本文版权归 123456.blog 所有
转载请附上原文出处链接和本声明
本文链接:
数字工·「」· https://123456.blog ip: 34.225.194.102
Copyright © 2022 Hotpot. All rights reserved. Made with ❤ , 3Q ; Deployed: Kubernetes(k8s),Docker
Design by HotpoT; VvE3 ,NuxT3 123456.blog@0.1.0