Skip to content
auto install latest k8s (kubeadm install)
Shell
Branch: master
Clone or download

Latest commit

Latest commit 0a283c7 Feb 20, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Create LICENSE Jul 19, 2019
README.md Change install url Feb 4, 2020
README_EN.md Change install url Feb 4, 2020
install.sh remove helm install Feb 20, 2020

README.md

k8s-install

中文 English

最新版 k8s 快速搭建脚本, 自适应国内外网络环境, 无法连接谷歌源自动切换成国内源(aliyun)来安装
支持 CentOS 7/Debian 9+/Ubuntu 16+

三步即可快速搭建k8s集群

1. master节点初始化

master 节点服务器运行:

# use flannel network
source <(curl -sL https://git.io/k8s-install) --flannel

或者

# use calico network
source <(curl -sL https://git.io/k8s-install) --calico

运行脚本会自动初始化(kubeadm init), 最后生成 'kubeadm join'命令

2. slave节点安装

slave 节点服务器运行:

source <(curl -sL https://git.io/k8s-install)

3. 加入集群

slave 节点运行第一步生成的 'kubeadm join xxx'


可以加入参数'--hostname xxx'来同时设置服务器的hostname, 举个栗子:

source <(curl -sL https://git.io/k8s-install) --flannel --hostname master_test

PS: 所有机器的hostname不一样集群才能搭建成功

验证结果

在master服务器上运行:

  1. kubectl get nodes, 所有节点都是ready
  2. kubectl get pods -n kube-system, 所有Pod READY状态都是1/1

同时符合以上两点即代表k8s集群搭建成功!

命令行参数列表

k8s_install.sh [-h|--help] [options]
    --flannel             使用flannel网络, 同时设置当前服务器为Master节点
    --calico              使用calico网络, 同时设置当前服务器为Master节点
    --hostname [hostname] 设置服务器hostname
You can’t perform that action at this time.