1 安装Docker(master和node都安装)
2 安装Go
- 下载Go语言压缩包
cd /usr/local
wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz - 解压压缩包
tar -zxvf go1.12.5.linux-amd64.tar.gz - 添加环境变量到/etc/profile
vim /etc/profile
输入:
export PATH=$PATH:/usr/local/go/bin
source /etc/profile
4) 编写hello.go文件,填写下列内容,放到 /usr/local/go/src/hello文件夹中
cd /usr/local/go/src/
vim hello.go
- 测试Go语言环境,$HOME/go/默认为/root/go/
go run /usr/local/go/src/hello.go
3 安装Etcd
- 下载Etcd压缩包
mkdir -p /opt/etcd
cd /opt/etcd
wget https://github.com/coreos/etcd/releases/download/v3.1.8/etcd-v3.1.8-linux-amd64.tar.gz
2) 解压Etcd压缩包
tar -xzf etcd-v3.1.8-linux-amd64.tar.gz
添加环境变量到/etc/profile
vim /etc/profile
输入:
export PATH=$PATH:/opt/etcd
source /etc/profile
3) 拷贝Etcd可执行程序
cd etcd-v3.1.8-linux-amd64
cp etcd etcdctl /usr/bin
4 安装Flannel
- 下载Flannel压缩包
mkdir -p /opt/flannel
cd /opt/flannel
wget https://github.com/coreos/flannel/releases/download/v0.7.1/flannel-v0.7.1-linux-amd64.tar.gz - 解压Flannel压缩包
tar -xzf flannel-v0.7.1-linux-amd64.tar.gz
rm flannel-v0.7.1-linux-amd64.tar.gz
3) 拷贝Flannel可执行程序
cd flannel
cp flannelid mk-docker-opts.sh /usr/bin
5 安装K8S
- 获取K8S Master版本
mkdir -p /opt/kubernetes/{bin,cfg}
cd /opt/kubernetes
wget https://dl.k8s.io/v1.8.13/kubernetes-node-linux-amd64.tar.gz - 编译K8S
cd kubernetes
make quick-release
编译完成后:
K8S Server文件:~/go/src/kubernetes/_output/release-stage/server/linux-amd64/kubernetes/server/bin
K8S Client文件: ~/go/src/kubernetes/_output/release-stage/client/linux-amd64/kubernetes/client/bin