容器是发展趋势,所以是时候从虚拟机中脱离出来,投入到容器化的怀抱中了。
曾经试过安装k8s,都没有成功,各种乱七八糟的报错,于是一拖再拖,这次总算发现一个可以快速部署的工具,终于安装成功了。
这个k8s快速部署工具就是kubekit
github地址是
https://github.com/Orientsoft/kubekit
直接按照以上这个地址的步骤部署也可以。
接下来我说一下具体的部署说明:
大体步骤是在关闭防火墙的Centos7.3上,下载解压kubekit安装包以及package压缩包,将package移入kubekit解压出来的文件夹中,同时对package中的sh文件添加可执行权限。进入kubekit文件夹,执行./kubekit init 服务器ip地址。正常情况下,安装成功的话会提示9000端口已监听。这个就是k8s的web界面。
系统环境:
Centos7.3
kubekit下载地址
https://kubekit.orientsoft.cn/kubekit-linux64-0.3.tar.gz
package下载地址
https://kubekit.orientsoft.cn/package-1.7.2.tar.gz
直接贴出我的命令执行历史,可以参考一下。加粗部分要额外注意
[root@bogon ~]# ls
anaconda-ks.cfg kubekit-linux64-0.3.tar.gz package-1.7..tar.gz
[root@bogon ~]# tar -xf kubekit-linux64-0.3.tar.gz
[root@bogon ~]# ls
anaconda-ks.cfg kubekit-linux64-0.3.tar.gz kubekit-release package-1.7..tar.gz
[root@bogon ~]# mv kubekit-release kubekit
[root@bogon ~]# tar -xf package-1.7..tar.gz
[root@bogon ~]# ls
anaconda-ks.cfg kubekit kubekit-linux64-0.3.tar.gz package package-1.7..tar.gz
[root@bogon ~]# mv package kubekit
[root@bogon ~]# cd kubekit
[root@bogon kubekit]# ls
assets kubekit LICENSE package README.md server.sh templates
[root@bogon kubekit]# cd package/
[root@bogon package]# ls
docker.sh images master.sh network node.sh rpms
[root@bogon package]# chmod +x *.sh
[root@bogon package]# ls
docker.sh images master.sh network node.sh rpms
[root@bogon package]# cd ..
[root@bogon kubekit]# ls
assets kubekit LICENSE package README.md server.sh templates
[root@bogon kubekit]# cat /etc/redhat-release
CentOS Linux release 7.3. (Core)
[root@bogon kubekit]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld() Dec :: localhost.localdomain systemd[]: Starting firewalld - dynamic firewall daemon...
Dec :: localhost.localdomain systemd[]: Started firewalld - dynamic firewall daemon.
Dec :: bogon systemd[]: Stopping firewalld - dynamic firewall daemon...
Dec :: bogon systemd[]: Stopped firewalld - dynamic firewall daemon.
[root@bogon kubekit]# getenforce
Enforcing
[root@bogon kubekit]# ip addre|grep inet
inet 127.0.0.1/ scope host lo
inet6 ::/ scope host
inet 192.168.2.133/ brd 192.168.2.255 scope global ens33
inet6 fe80::a59c::e68e:ae/ scope link
[root@bogon kubekit]# ./kubekit init 192.168.2.133 ___ __ ___ ___ ________ _______ ___ __ ___ _________
|\ \|\ \ |\ \|\ \ |\ __ \ |\ ___ \ |\ \|\ \ |\ \ |\___ ___\
\ \ \/ /|_ \ \ \\\ \ \ \ \|\ /_ \ \ __/| \ \ \/ /|_ \ \ \ \|___ \ \_|
\ \ ___ \ \ \ \\\ \ \ \ __ \ \ \ \_|/__ \ \ ___ \ \ \ \ \ \ \
\ \ \\ \ \ \ \ \\\ \ \ \ \|\ \ \ \ \_|\ \ \ \ \\ \ \ \ \ \ \ \ \
\ \__\\ \__\ \ \_______\ \ \_______\ \ \_______\ \ \__\\ \__\ \ \__\ \ \__\
\|__| \|__| \|_______| \|_______| \|_______| \|__| \|__| \|__| \|__| KubeKit V0. ⓒ OrientSoft Initialization process started, with kubernetes master IP: 192.168.2.133 ✔ HTTP file server listening at: 0.0.0.0: Start to install docker engine...
(/) Start to install docker...
(/) Start to config docker... ✔ Docker engine installed... Start to initialize Kubernetes master node... (/) Start to load images for Kubernetes master...
(/) Start to install components for Kubernetes master...
(/) Start to configure firewall...
(/) Start to initialize Kubernetes master...
✔ Master token .b275f2c2c6bb5e78 saved into .k8s.token file.
(/) Start to config Kubernetes network...
(/) Start to install Kubernetes dashboard... ✔ Kubernetes master node initialized... Remember to reload shell with: source ~/.bashrc before using kubectl!
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached. [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode) [GIN-debug] GET /assets/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] HEAD /assets/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] Loaded HTML Templates (3):
-
- index.html
- locale.html open ./.nodes: no such file or directory
[GIN-debug] GET / --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).IndexHandler-fm (4 handlers)
[GIN-debug] GET /ws --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).Initialize.func1 (4 handlers)
[GIN-debug] GET /node/list --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).ListNodesHandler-fm (4 handlers)
[GIN-debug] POST /node --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).CreateNodeHandler-fm (4 handlers)
[GIN-debug] PUT /node/remove/:id --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).RemoveNodeHandler-fm (4 handlers)
[GIN-debug] GET /node/refresh/:id --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).RefreshNodeHandler-fm (4 handlers)
[GIN-debug] GET /node/log/:id --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).GetInstallLog-fm (4 handlers)
[GIN-debug] POST /install --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).InstallNodeHandler-fm (4 handlers)
[GIN-debug] GET /install/progress/:id/:step --> github.com/Orientsoft/kubekit/controllers.(*MainRouter).NodeProgressHandler-fm (4 handlers) ✔ Toolkit server is listening at: 0.0.0.0:9000
[GIN-debug] Listening and serving HTTP on :9000
在浏览器中访问。可以看到k8s的界面了
以上是在我自己的电脑上测试的,但是换一台电脑好像不行,现在还在找原因,如果找到了,我再补充进来
12月10日补充:
关闭防火墙并且不修改默认的selinux,同时只在一个命令窗口执行?反正没报错