一、目标
这边文章主要是Kubefade的Build_Two_Parties_FATE_Cluster_in_One_Linux_Machine_with_MiniKube入手实验和实验记录。本实验将从头搭建一个两个parties的FATE集群,每个集群有独立的namespace。基于这个环境,我们可以run 联邦学习,以及通过FATE-Dashboard来查看学习任务的状态。
二、环境准备
2.1 新建工作目录
export version=v1.3.0-a && cd ~ && mkdir demo && cd demo
2.2 需要安装的工具
1. MiniKube: v1.7.3
安装minikube需要看一下当前机器是否支持。minikube安装指导
2. kubectl: v1.17.3
3. kubefate:
Release: v1.3.0-a
Service version: v1.0.2
* Commandline version: v1.0.2
2.3 安装kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.3/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/bin
验证
root@machine:~/demo$ kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.3", GitCommit:"06ad960bfd03b39c8310aaf92d1e7c12ce618213", GitTreeState:"clean", BuildDate:"2020-02-11T18:14:22Z", GoVersion:"go1.13.6", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
2.4 安装Minikube
curl -LO https://github.com/kubernetes/minikube/releases/download/v1.7.3/minikube-linux-amd64 && mv minikube-linux-amd64 minikube && chmod +x minikube && sudo mv ./minikube /usr/bin
验证
root@machine:~/demo$ minikube version
minikube version: v1.7.3
commit: 436667c819c324e35d7e839f8116b968a2d0a3ff
2.5 安装KubeFATE
curl -LO https://github.com/FederatedAI/KubeFATE/releases/download/${version}/kubefate-k8s-${version}.tar.gz && tar -xzf ./kubefate-k8s-${version}.tar.gz
#ls查看有如下文件
cluster.yaml config.yaml kubefate kubefate-k8s-v1.3.0-a.tar.gz kubefate.yaml rbac-config.yaml
放置kubefate到/usr/bin
chmod +x ./kubefate && sudo mv ./kubefate /usr/bin
2.6 用Minikube安装Kubernetes
sudo minikube start --vm-driver=none --docker-env http_proxy=http://{proxyid}:{proxyport} --docker-env https_proxy=http://{proxyid}:{proxyport} --registry-mirror=https://registry.docker-cn.com --image-mirror-country=cn --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers
开启Minikube的Ingress addon
sudo minikube addons enable ingress
2.7 部署KubeFATE Service
通过apply rbac-config.yaml 文件来创建 kube-fate namespace,同时创建一个service account。
kubectl apply -f ./rbac-config.yaml
启动service
kubectl apply -f ./kubefate.yaml
验证一下:
kubectl get all,ingress -n kube-fate
2.8 添加kubefate.net到host文件
sudo -- sh -c "echo \"192.168.100.123 kubefate.net\" >> /etc/hosts"
验证kubefate version
kubefate version
准备工作完成!