KubeSphere 社区与 51openlab 合作联合推出 KubeSphere 云原生课程以及实验平台, 为希望体验ks的用户提供免费的学习服务器和官方镜像来在线安装。接下来我们还将会提供系统化的教学课程及视频, 并设计了手动实验学习, 在实验中可以降低用户的学习难度和学习成本, 让你体验开机即用的感觉,敬请期待。
一、环境配置
二、51OPENLAB平台操作
1.登录地址:https://51openlab.com/login/
2.登录方式可选择第三方或者直接注册
3.选择顶部进入开放实验室
4.选择创建实验
5.填写实验名称
6.进入后选择左侧设备列表(由于为了达到搭建ks平台的目的,这边就选择两台云主机和一个子网来作为演示效果)
6.1云主机和子网连接(否则两台云主机不能通信)
6.2设备开启
7.界面功能介绍
8.终端登录
注意(登录默认是user权限,如需root权限请输入 su 默认root账号:root,密码root@openlab)
三、KubeSphere搭建
一、环境配置
1.更改hostname(每台都要)
[root@localhost ~]# hostnamectl set-hostname k8s-master
2.查看内核版本
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
3.添加hosts文件(每台都要)
[root@localhost ~]# cat >> /etc/hosts << EOF
> 30.1.0.17 k8s-master
> 30.1.0.168 k8s-node1
> EOF
3.1验证
[root@localhost ~]# ping k8s-node1
PING k8s-node1 (30.1.0.168) 56(84) bytes of data.
64 bytes from k8s-node1 (30.1.0.168): icmp_seq=1 ttl=64 time=0.662 ms
64 bytes from k8s-node1 (30.1.0.168): icmp_seq=2 ttl=64 time=0.453 ms
4.关闭防火墙 (每台都要)
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
5.关闭Selinux (每台都要改)
vi /etc/sysconfig/selinux
SELINUX=disabled
6.替换阿里源 (每台都要)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#备份
#下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum update(可选)
7.安装常用软件 (每台都要)
[root@localhost ~]# yum -y install epel-release.noarch conntrack ipvsadm ipset jq sysstat curl iptables libseccomp vim lrzsz bash-completion
8.关闭swap分区 (每台都要改)
[root@localhost ~]# swapoff -a
[root@localhost ~]# sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
二、搭建KubeShere3.0
由于官网实时更新请参照
https://kubesphere.io/zh/docs/installing-on-linux/on-premises/install-kubesphere-on-vmware-vsphere/
1.下载 KubeKey 安装程序
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.0.1 sh -
2.添加kk权限
chmod +x kk
3.创建配置文件(一个示例配置文件)
./kk create config --with-kubesphere v3.0.0 --with-kubernetes v1.17.9
4.默认文件 config-sample.yaml
创建后,根据您的环境修改该文件。
vi ~/config-sample.yaml
5.执行创建集群
./kk create cluster -f config-sample.yaml
6.验证安装结果
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
7.如果最后返回Welcome to KubeSphere
,则表示已安装成功。
**************************************************
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://30.1.0.17:30880
Account: admin
Password: P@88w0rd
NOTES:
1. After logging 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 ready.
2. Please modify the default password after login.
#####################################################
https://kubesphere.io 2020-08-15 23:32:12
#####################################################
三、访问KubeSphere
1.打开自带浏览器
2.输入刚才返回的IP+端口,登录账号:admin 登录密码:p@88w0rd
3.登录成功画面