其實有時候安裝搭建這個東西是費時費力的事情,若是有腳本爲何不能使用腳本呢?花100分鐘在搭建上還不如用100分鐘去研究怎麼使用html
Kubekit是一個部署工具包,它爲kubernetes提供離線安裝解決方案。您能夠使用它將Kubernetes部署到OFFLINE生產環境。node
Kubekit將安裝linux
https://github.com/Orientsoft/kubekit
git
首先官方支持下面兩個操做系統,並且都要是最小化安裝支持的github
我使用是1708,k8s版本是V1.9.2,具體的能夠看github上的readmeweb
wget http://111.1.50.85/files/1128000004BF9EC9/linux.cc.lehigh.edu/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1708.iso
docker
在虛擬機裏面正常安裝,注意是最小化安裝,我給虛擬機的內存是2g,但願有一天我也能夠買臺mac book pro吧 安裝完成以後關閉防火牆shell
systemctl stop firewalld
vim
systemctl disable firewalld
centos
關閉selinux
setenforce 0
vim /etc/selinux/config
修改成
SELINUX=disabled
最好還能夠同步一下時間什麼的
yum install ntpdate
ntpdate 0.cn.pool.ntp.org
yum install wget
wget https://kubekit.orientsoft.cn/kubekit-linux64-0.3.tar.gz
解壓
tar -zxvf kubekit-linux64-0.3.tar.gz
mv kubekit-release/ kubekit
wget https://kubekit.orientsoft.cn/package-1.9.2.tar.gz
tar -zxvf package-1.9.2.tar.gz
mv package kubekit
給腳本賦予可執行權限
cd kubekit/package/
chmod +x ./*.sh
最後安裝並初始化master節點
./kubekit init 192.168.38.166
到下面這步就說明節點初始化成功了
[root@kubekit kubekit]# ./kubekit init 192.168.38.166 ___ __ ___ ___ ________ _______ ___ __ ___ _________ |\ \|\ \ |\ \|\ \ |\ __ \ |\ ___ \ |\ \|\ \ |\ \ |\___ ___\ \ \ \/ /|_ \ \ \\\ \ \ \ \|\ /_ \ \ __/| \ \ \/ /|_ \ \ \ \|___ \ \_| \ \ ___ \ \ \ \\\ \ \ \ __ \ \ \ \_|/__ \ \ ___ \ \ \ \ \ \ \ \ \ \\ \ \ \ \ \\\ \ \ \ \|\ \ \ \ \_|\ \ \ \ \\ \ \ \ \ \ \ \ \ \ \__\\ \__\ \ \_______\ \ \_______\ \ \_______\ \ \__\\ \__\ \ \__\ \ \__\ \|__| \|__| \|_______| \|_______| \|_______| \|__| \|__| \|__| \|__| KubeKit V0.3 ⓒ OrientSoft 2018 Initialization process started, with kubernetes master IP: 192.168.38.166 ✔ 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 3826ab.fef296d97de13f83 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
接着ctrl+c退出來,而後從新啓動kubekit的dashboard而且放在後臺
./kubekit server &
瀏覽器訪問ip:9000
建立一個一樣安裝着centos 1708最小化安裝的機器,以後打開修改主機名
hostnamectl set-hostname kubekit-node1
接着點擊web界面上的add node,輸入ssh帳號密碼等信息,最後選中點擊start deploy就能夠了
以後你就會在kubernetes的dashboard看到這個節點的詳細信息了
歡迎關注Bboysoul的博客www.bboysoul.com Have Fun