KubeSphere在线安装单节点Kubernetes集群

目录

1. 前置条件准备

2. KubeKey文件下载

3. 创建k8s集群并安装KubeSphere

3.1 安装命令

3.2 KubeSphere 与 Kubernetes 版本的兼容性建议

3.3 安装结果

3.4 POD容器列表

3.5 镜像列表

3.6 KubeSphere控制台

4. 参考链接


1. 前置条件准备

        本文以CentOS 7.9系统安装k8s为例,具体配置见下文:

Shell脚本一键部署KubeSphere前置环境_kubesphere的shell脚本-优快云博客

2. KubeKey文件下载

curl -sfL https://get-kk.kubesphere.io | sh -

cat  downloadKubekey.sh

#!/bin/sh

# Copyright 2020 The KubeSphere Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ISLINUX=true
OSTYPE="linux"

if [ "x$(uname)" != "xLinux" ]; then
  echo ""
  echo 'Warning: Non-Linux operating systems are not supported! After downloading, please copy the tar.gz file to linux.'  
  ISLINUX=false
fi

# Fetch latest version
if [ "x${VERSION}" = "x" ]; then
  VERSION="$(curl -sL https://api.github.com/repos/kubesphere/kubekey/releases |
    grep -o 'download/v[0-9]*.[0-9]*.[0-9]*/' |
    sort --version-sort |
    tail -1 | awk -F'/' '{ print $2}')"
  VERSION="${VERSION##*/}"
fi

if [ -z "${ARCH}" ]; then
  case "$(uname -m)" in
  x86_64)
    ARCH=amd64
    ;;
  armv8*)
    ARCH=arm64
    ;;
  aarch64*)
    ARCH=arm64
    ;;
  *)
    echo "${ARCH}, isn't supported"
    exit 1
    ;;
  esac
fi

if [ "x${VERSION}" = "x" ]; then
  echo "Unable to get latest Kubekey version. Set VERSION env var and re-run. For example: export VERSION=v1.0.0"
  echo ""
  exit
fi

DOWNLOAD_URL="https://github.com/kubesphere/kubekey/releases/download/${VERSION}/kubekey-${VERSION}-${OSTYPE}-${ARCH}.tar.gz"
if [ "x${KKZONE}" = "xcn" ]; then
  DOWNLOAD_URL="https://kubernetes.pek3b.qingstor.com/kubekey/releases/download/${VERSION}/kubekey-${VERSION}-${OSTYPE}-${ARCH}.tar.gz"
fi

echo ""
echo "Downloading kubekey ${VERSION} from ${DOWNLOAD_URL} ..."
echo ""

curl -fsLO "$DOWNLOAD_URL"
if [ $? -ne 0 ]; then
  echo ""
  echo "Failed to download Kubekey ${VERSION} !"
  echo ""
  echo "Please verify the version you are trying to download."
  echo ""
  exit
fi

if [ ${ISLINUX} = true ]; then
  filename="kubekey-${VERSION}-${OSTYPE}-${ARCH}.tar.gz"
  ret='0'
  command -v tar >/dev/null 2>&1 || { ret='1'; }
  if [ "$ret" -eq 0 ]; then
    tar -xzf "${filename}"
  else
    echo "Kubekey ${VERSION} Download Complete!"
    echo ""
    echo "Try to unpack the ${filename} failed."
    echo "tar: command not found, please unpack the ${filename} manually."
    exit
  fi
fi

echo ""
echo "Kubekey ${VERSION} Download Complete!"
echo ""

如果当前服务器无法下载,可以在有网络权限的服务器下载包后上传到当前服务器:

wget  https://github.com/kubesphere/kubekey/releases/download/v3.1.11/kubekey-v3.1.11-linux-amd64.tar.gz

解压后即得到kk文件

[root@operation-k8s-test kubesphere]# ll
total 119696
-rwxr-xr-x  1 root root 84046978 Aug 19 01:06 kk
-rw-r--r--  1 root root 38518611 Aug 20 15:08 kubekey-v3.1.11-linux-amd64.tar.gz

3. 创建k8s集群并安装KubeSphere

3.1 安装命令

[root@operation-k8s-test kubesphere]# export KKZONE=cn
[root@operation-k8s-test kubesphere]# ./kk create cluster --with-kubernetes v1.24.1 --container-manager containerd   --with-kubesphere v3.4.1

备注:

  • 如果不能访问 https://storage.googleapis.com, 需要首先执行 export KKZONE=cn.
  • --with-kubernetes   指定k8s版本
  • --with-kubesphere  指定kubesphere版本
  • 注意KubeSphere 与 Kubernetes 版本的兼容性

3.2 KubeSphere 与 Kubernetes 版本的兼容性建议

KubeSphere 版本推荐 Kubernetes 版本兼容性说明
v3.3.x1.23.5+适合长期使用 1.23.x 的场景,需手动指定版本。
v3.4.x1.24.x/1.25.x支持更广泛的 Kubernetes 版本,适合未来升级。
v4.1.x1.28.x修复了与预发布版本的兼容性问题,适合需要最新功能的企业用户。
v4.2.x1.29.x/1.30.x(推测)企业版最新版本,支持边缘计算和可观测性增强,适合高要求场景。

3.3 安装结果

显示如下输出结果,表明集群安装成功

3.4 POD容器列表

3.5 镜像列表

[root@operation-k8s-test ~]# crictl   images
IMAGE                                                                         TAG                 IMAGE ID            SIZE
registry.cn-beijing.aliyuncs.com/kubesphereio/alertmanager                    v0.23.0             ba2b418f427c0       26.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/cni                             v3.27.4             dc6f84c32585f       88.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/coredns                         1.8.6               a4ca41631cc7a       13.6MB
registry.cn-beijing.aliyuncs.com/kubesphereio/defaultbackend-amd64            1.4                 846921f0fe0e5       1.82MB
registry.cn-beijing.aliyuncs.com/kubesphereio/k8s-dns-node-cache              1.22.20             ff71cd4ea5ae5       30.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/ks-apiserver                    v3.4.1              c486abe6f1cc8       65.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/ks-console                      v3.4.1              aa81987f764d3       51.7MB
registry.cn-beijing.aliyuncs.com/kubesphereio/ks-controller-manager           v3.4.1              2a2294b6c6af0       50.3MB
registry.cn-beijing.aliyuncs.com/kubesphereio/ks-installer                    v3.4.1              d6ce52546e1c3       156MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-apiserver                  v1.24.1             e9f4b425f9192       33.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controller-manager         v1.24.1             b4ea7e648530d       31MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers                v3.27.4             6b1e38763f401       33.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy                      v1.24.1             beb86f5d8e6cd       39.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-rbac-proxy                 v0.11.0             29589495df8d9       19.2MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-scheduler                  v1.24.1             18688a72645c5       15.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-state-metrics              v2.6.0              ec6e2d871c544       12MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kubectl                         v1.22.0             30c7baa8e18c0       26.6MB
registry.cn-beijing.aliyuncs.com/kubesphereio/linux-utils                     3.3.0               e88cfb3a763b9       26.9MB
registry.cn-beijing.aliyuncs.com/kubesphereio/nginx-ingress-controller        v1.3.1              b7c8e5e285c0a       107MB
registry.cn-beijing.aliyuncs.com/kubesphereio/node-exporter                   v1.3.1              1dbe0e9319764       10.3MB
registry.cn-beijing.aliyuncs.com/kubesphereio/node                            v3.27.4             3dd4390f2a85a       117MB
registry.cn-beijing.aliyuncs.com/kubesphereio/notification-manager-operator   v2.3.0              7ffe334bf3772       19.3MB
registry.cn-beijing.aliyuncs.com/kubesphereio/notification-manager            v2.3.0              2c35ec9a2c185       21.6MB
registry.cn-beijing.aliyuncs.com/kubesphereio/notification-tenant-sidecar     v3.2.0              4b47c43ec6ab6       14.7MB
registry.cn-beijing.aliyuncs.com/kubesphereio/pause                           3.7                 221177c6082a8       311kB
registry.cn-beijing.aliyuncs.com/kubesphereio/pod2daemon-flexvol              v3.27.4             72bfa61e35b35       7.64MB
registry.cn-beijing.aliyuncs.com/kubesphereio/prometheus-config-reloader      v0.55.1             7c63de88523a9       4.84MB
registry.cn-beijing.aliyuncs.com/kubesphereio/prometheus-operator             v0.55.1             b30c215b787f5       14.3MB
registry.cn-beijing.aliyuncs.com/kubesphereio/prometheus                      v2.39.1             6b9895947e9e4       88.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/provisioner-localpv             3.3.0               739e82fed8b2c       28.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/snapshot-controller             v4.0.0              f1d8a00ae690f       19MB

    3.6 KubeSphere控制台

    4. 参考链接

    https://github.com/kubesphere/kubekey

    评论
    成就一亿技术人!
    拼手气红包6.0元
    还能输入1000个字符
     
    红包 添加红包
    表情包 插入表情
     条评论被折叠 查看
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值