升级扩展组件

本节介绍如何升级扩展组件。

在升级扩展组件之前,您需要先更新扩展组件仓库以获取最新扩展组件。可以通过以下命令更新 ks-core 的扩展组件仓库:

bash -c '#!/bin/bash
set -e          # Exit immediately if a command exits with a non-zero status
set -o pipefail # Fail the entire pipeline if any command fails

# If CHART_VERSION is not set via environment variable, fetch it from the installed release
if [ -z "$CHART_VERSION" ]; then
  CHART_VERSION=$(helm -n kubesphere-system get metadata ks-core -o json | jq -r '.version')

  if [[ -z "$CHART_VERSION" || "$CHART_VERSION" == "null" ]]; then
    echo "❌ Failed to retrieve the Chart version of ks-core. Aborting."
    exit 1
  fi
fi

# Construct the Chart URL
CHART_URL="https://charts.kubesphere.io/main/ks-core-$CHART_VERSION.tgz"

# If EXTENSION_REPOSITORY_VERSION is not set via environment variable, fetch it from GitHub
if [ -z "$EXTENSION_REPOSITORY_VERSION" ]; then
  EXTENSION_REPOSITORY_VERSION=$(curl -s https://api.github.com/repos/kubesphere-extensions/ks-extensions/releases/latest | jq -r '.tag_name')

  if [[ -z "$EXTENSION_REPOSITORY_VERSION" || "$EXTENSION_REPOSITORY_VERSION" == "null" ]]; then
    echo "❌ Failed to retrieve the latest version of ks-extensions. Aborting."
    echo "You can manually visit the GitHub releases page to find the latest version: https://github.com/kubesphere-extensions/ks-extensions/releases"
    exit 1
  fi
fi

# Upgrade ks-core using the retrieved or provided versions
echo "✅ Preparing to upgrade ks-core to version $CHART_VERSION using extension repository version $EXTENSION_REPOSITORY_VERSION"
helm -n kubesphere-system upgrade ks-core "$CHART_URL" \
  --set ksExtensionRepository.image.tag="$EXTENSION_REPOSITORY_VERSION" \
  --wait --debug'

前提条件

您需要在 KubeSphere 平台具有 platform-admin 角色。有关更多信息,请参阅用户平台角色

操作步骤

  1. 以具有 platform-admin 角色的用户登录 KubeSphere Web 控制台。

  2. 点击扩展中心

  3. 点击已安装的组件名称,进入组件详情页。

  4. 点击组件图标下的more,选择更新

  5. 在更新对话框中,参照组件安装流程,完成升级。

通过邮件接收 KubeSphere 最新的技术博客与产品更新的通知


感谢您的反馈。如果您有关于如何使用 KubeSphere 的具体问题,请在 Slack 上提问。如果您想报告问题或提出改进建议,请在 GitHub 存储库中打开问题。