Centos7.3之K8S安裝初體驗


容器是發展趨勢,所以是時候從虛擬機中脫離出來,投入到容器化的懷抱中了。

曾經試過安裝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.2.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.2.tar.gz
[root@bogon ~]# mv kubekit-release kubekit
[root@bogon ~]# tar -xf package-1.7.2.tar.gz
[root@bogon ~]# ls
anaconda-ks.cfg  kubekit  kubekit-linux64-0.3.tar.gz  package  package-1.7.2.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.1611 (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(1) Dec 09 15:46:23 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... Dec 09 15:46:24 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. Dec 09 07:53:04 bogon systemd[1]: Stopping firewalld - dynamic firewall daemon... Dec 09 07:53:04 bogon systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@bogon kubekit]# getenforce Enforcing
[root@bogon kubekit]# ip addre|grep inet
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
    inet 192.168.2.133/24 brd 192.168.2.255 scope global ens33
    inet6 fe80::a59c:93:e68e:ae/64 scope link 
[root@bogon kubekit]# ./kubekit init 192.168.2.133

 ___  __        ___  ___      ________      _______       ___  __        ___      _________   
|\  \|\  \     |\  \|\  \    |\   __  \    |\  ___ \     |\  \|\  \     |\  \    |\___   ___\ 
\ \  \/  /|_   \ \  \\\  \   \ \  \|\ /_   \ \   __/|    \ \  \/  /|_   \ \  \   \|___ \  \_| 
 \ \   ___  \   \ \  \\\  \   \ \   __  \   \ \  \_|/__   \ \   ___  \   \ \  \       \ \  \  
  \ \  \\ \  \   \ \  \\\  \   \ \  \|\  \   \ \  \_|\ \   \ \  \\ \  \   \ \  \       \ \  \ 
   \ \__\\ \__\   \ \_______\   \ \_______\   \ \_______\   \ \__\\ \__\   \ \__\       \ \__\
    \|__| \|__|    \|_______|    \|_______|    \|_______|    \|__| \|__|    \|__|        \|__|


KubeKit V0.3 ⓒ  OrientSoft 2018

Initialization process started, with kubernetes master IP: 192.168.2.133

✔ HTTP file server listening at: 0.0.0.0:8000

Start to install docker engine...
(1/2) Start to install docker...
(2/2) Start to config docker...

✔ Docker engine installed...

Start to initialize Kubernetes master node...

(1/6) Start to load images for Kubernetes master...
(2/6) Start to install components for Kubernetes master...
(3/6) Start to configure firewall...
(4/6) Start to initialize Kubernetes master...
✔ Master token 733899.b275f2c2c6bb5e78 saved into .k8s.token file.
(5/6) Start to config Kubernetes network...
(6/6) 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,同時只在一個命令窗口執行?反正沒報錯


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM