Kubesphere社区版安装

环境介绍

  在VMware VSan8 虚拟机环境中搭建Kubesphere社区版。操作系统采用Centos7.9,需升级内核≥5.4版本。本文只做kubesphere搭建,不涉及kubesphere使用。

  注:若使用虚拟机安装KubeSphere,虚拟机高级参数EnableUUID一定要设置。

kubesphere官方链接:3.4.1 版本说明

虚拟机配置

  配置虚拟机高级参数,使操作系统识别到硬盘UUID

# 创建虚拟机时设置高级参数
disk.EnableUUID=1     or   disk.EnableUUID=true

# 进系统后查看是否识别到硬盘UUID
# sda为硬盘编号,根据实际情况调整
/usr/lib/udev/scsi_id -g -u -d /dev/sda

 

操作系统基本设置

1、更改yum源

wget http://mirrors.aliyun.com/repo/Centos-7.repo
cp Centos-7.repo /etc/yum.repos.d/
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-base.bak
mv /etc/yum.repos.d/Centos-7.repo /etc/yum.repos.d/Centos-Base.repo
yum clean all
yum makecache
yum update

2、升级内核

# 升级内核
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
yum -y --enablerepo=elrepo-kernel install kernel-lt

grubby --info=ALL | grep ^kernel
grubby --default-kernel
grubby --set-default "/boot/vmlinuz-5.4.261-1.el7.elrepo.x86_64"

grubby --default-kernel
reboot

uname -rs
rpm -qa | grep kernel

# 卸载旧版本的 kernel-tools 相关软件包
yum remove kernel-tools-3.10.0-1160.95.1.el7.x86_64 kernel-tools-libs-3.10.0-1160.95.1.el7.x86_64

# 安装新版本的 kernel-tools 相关软件包
yum --enablerepo=elrepo-kernel install kernel-lt-tools kernel-lt-tools-libs

3、工具安装及关闭防火墙

# 安装基本工具
yum install -y curl socat conntrack vim ebtables ipset ipvsadm vmtools
# 关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
# 禁用SELinux
setenforce 0
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

4、更改操作系统主机名

# 主机名格式
主机 IP              主机名    
192.167.2.11      master
192.167.2.12      node01
192.167.2.13      node02
192.167.2.14      node03
192.167.2.15      node04

hostnamectl set-hostname <主机名>

# 修改hosts文件
vim /etc/hosts
192.167.2.11 master
192.167.2.12 node01
192.167.2.13 node02
192.167.2.14 node03
192.167.2.15 node04

5、时间同步

# 安装时间同步工具
timedatectl    # 查看本地时间
timedatectl set-timezone Asia/Shanghai # 切换时区
timedatectl   # 检验时区是否更改
yum install -y chrony    # 安装时间同步工具
chronyc -n sources -v     # 查看时间同步服务器列表
chronyc tracking      # 查看本机时间的同步状态
timedatectl status   # 查看本地时间状态
systemctl enable chronyd --now

# 时间同步服务器设置方法
vi /etc/chrony.conf
# 删除所有的 server 配置
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
# 增加国内的 ntp 服务器,或是指定其他常用的时间服务器
pool cn.pool.ntp.org iburst
chronyc sourcestats -v     查看同步状态

部署Kubesphere

以下操作只在其中master节点上操作

  • 下载KubeKey

# 墙内使用以下命令
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.13 sh -
chmod +x kk

  • 修改配置文件

 

# 创建配置文件
./kk create config --with-kubernetes v1.23.10 --with-kubesphere v3.4.0
# 修改配置文件
vim ~/config-sample.yaml

根据实际情况修改配置文件

apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
  name: sample
spec:
  hosts:
  - {name: master, address: 192.167.2.11, internalAddress: 192.167.2.11, user: root, password: 1234.com}
  - {name: node01, address: 192.167.2.12, internalAddress: 192.167.2.12, user: root, password: 1234.com}
  - {name: node02, address: 192.167.2.13, internalAddress: 192.167.2.13, user: root, password: 1234.com}
  - {name: node03, address: 192.167.2.14, internalAddress: 192.167.2.14, user: root, password: 1234.com}
  - {name: node04, address: 192.167.2.15, internalAddress: 192.167.2.15, user: root, password: 1234.com}
  roleGroups:
    etcd:
    - master
    control-plane:
    - master
    worker:
    - node01
    - node02
    - node03
    - node04
  controlPlaneEndpoint:
    ## Internal loadbalancer for apiservers
    # internalLoadbalancer: haproxy

    domain: lb.kubesphere.local
    address: ""
    port: 6443
  kubernetes:
    version: v1.23.10
    clusterName: sszx
    autoRenewCerts: true
    containerManager: docker
  etcd:
    type: kubekey
  network:
    plugin: calico
    kubePodsCIDR: 10.233.64.0/18
    kubeServiceCIDR: 10.233.0.0/18
    ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
    multusCNI:
      enabled: false
  registry:
    privateRegistry: ""
    namespaceOverride: ""
    registryMirrors: []
    insecureRegistries: []
  addons: []


...
#
其他配置可以在安装后根据需要修改

  • 执行创建集群

 ./kk create cluster -f config-sample.yaml

如果最后返回Welcone to KubeSphere,则表示安装成功。

**************************************************

#####################################################

###              Welcome to KubeSphere!           ###

#####################################################

Console: http://192.167.2.11:30880

Account: admin

Password: P@88w0rd

NOTES


  1. After you log into the console, please check the

     monitoring status of service components in

     the "Cluster Management". If any service is not

     ready, please wait patiently until all components

     are up and running.

  2. Please change the default password after login.

#####################################################

https://kubesphere.io             2023-11-23 14:25:12

#####################################################

使用上述日志中给定的访问地址进行访问,进入到 KubeSphere的登陆界面并使用默认账户(用户名admin,密码P@88w0rd)即可登录平台。

  • 28
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值