一、目标

这边文章主要是Kubefade的Build_Two_Parties_FATE_Cluster_in_One_Linux_Machine_with_MiniKube入手实验和实验记录。本实验将从头搭建一个两个parties的FATE集群,每个集群有独立的namespace。基于这个环境,我们可以run 联邦学习,以及通过FATE-Dashboard来查看学习任务的状态。

二、环境准备

2.1 新建工作目录

  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

  1. curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.3/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/bin

验证

  1. root@machine:~/demo$ kubectl version
  2. 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"}
  3. The connection to the server localhost:8080 was refused - did you specify the right host or port?

2.4 安装Minikube

  1. 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

验证

  1. root@machine:~/demo$ minikube version
  2. minikube version: v1.7.3
  3. commit: 436667c819c324e35d7e839f8116b968a2d0a3ff

2.5 安装KubeFATE

  1. curl -LO https://github.com/FederatedAI/KubeFATE/releases/download/${version}/kubefate-k8s-${version}.tar.gz && tar -xzf ./kubefate-k8s-${version}.tar.gz
  2. #ls查看有如下文件
  3. cluster.yaml config.yaml kubefate kubefate-k8s-v1.3.0-a.tar.gz kubefate.yaml rbac-config.yaml

放置kubefate到/usr/bin

  1. chmod +x ./kubefate && sudo mv ./kubefate /usr/bin

2.6 用Minikube安装Kubernetes

  1. 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

image.png
开启Minikube的Ingress addon

  1. sudo minikube addons enable ingress

2.7 部署KubeFATE Service

通过apply rbac-config.yaml 文件来创建 kube-fate namespace,同时创建一个service account。

  1. kubectl apply -f ./rbac-config.yaml

启动service

  1. kubectl apply -f ./kubefate.yaml

验证一下:

  1. kubectl get all,ingress -n kube-fate

2.8 添加kubefate.net到host文件

  1. sudo -- sh -c "echo \"192.168.100.123 kubefate.net\" >> /etc/hosts"

验证kubefate version

  1. kubefate version

准备工作完成!

三、测试