由于国内网络问题,Kubeflow 通常安装都是各种磕磕碰碰,以一颗为广大人民谋福利的心,这里提供中国的本地镜像版(阿里云镜像/dockerhub)的安装。
步骤一、安装Docker
Step 1: 安装必要工具
$ sudo apt-get install apt-transport-https ca-certificates software-properties-common curl
Step 2: 安装GPG证书(密钥),并且添加Docker-ce软件源信息
# 阿里云软件源(推荐)
$ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
Step 3: 更新并安装Docker-ce
$ sudo apt-get update
$ sudo apt-get install docker-ce
Step 4: 将当前用户添加到 docker 组,可以不用sudo运行docker
# 将当前用户添加到 docker 组
$ sudo gpasswd -a ${USER} docker
# 重新登录或者用以下命令切换到docker组
$ newgrp - docker
# 指定存储位置(可选)
$ cat << EOF >>/etc/docker/daemon.json
{
"data-root": "/data"
}
EOF
# 不加sudo直接执行docker命令检查效果
$ docker ps
安装kubectl
$ sudo apt install snap
$ cat << EOF >>/etc/profile
export PATH=$PATH:/snap/bin
EOF
$ source /etc/profile
$ snap install kubectl --classic
# 查看kubectl版本
$ kubectl version --client
步骤二、安装kind
$ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
$ sudo chmod +x ./kind
# 把kind mv到/usr/bin
$ sudo mv ./kind /usr/bin/kind
步骤三、安装kubeflow
$ git clone https://www.aiqianji.com/openoker/kubeflow-manifests.git
$ cd kubeflow-manifests
# 创建一个单节点的k8s环境
$ kind create cluster --config=kind/kind-config.yaml --name=kubeflow --image=kindest/node:v1.17.17
# 启动成功后可以看到开了一个30000端口:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f67af713e28 kindest/node:v1.19.1 "/usr/local/bin/entr…" 3 minutes ago Up 3 minutes 0.0.0.0:30000->30000/tcp, 127.0.0.1:56682->6443/tcp kubeflow-control-plane
由于 kubeflow 实验组件较多,最好准备机器的最低配置能够大于*CPU8核,内存32G*以上。
$ python install.py
# 等待镜像拉取,由于涉及的镜像比较多,要20~30分钟左右,可以通过命令查看是否就绪:
$ kubectl get pod -nkubeflow
NAME READY STATUS RESTARTS AGE
admission-webhook-deployment-6fb9d65887-pzvgc 1/1 Running 0 19h
cache-deployer-deployment-7558d65bf4-jhgwg 2/2 Running 1 3h54m
cache-server-c64c68ddf-lx7xq 2/2 Running 0 3h54m
centraldashboard-7b7676d8bd-g2s8j 1/1 Running 0 4h46m
jupyter-web-app-deployment-66f74586d9-scbsm 1/1 Running 0 3h4m
katib-controller-77675c88df-mx4rh 1/1 Running 0 19h
katib-db-manager-646695754f-z797r 1/1 Running 0 19h
katib-mysql-5bb5bd9957-gbl5t 1/1 Running 0 19h
katib-ui-55fd4bd6f9-r98r2 1/1 Running 0 19h
kfserving-controller-manager-0 2/2 Running 0 19h
kubeflow-pipelines-profile-controller-5698bf57cf-dhtsj 1/1 Running 0 3h52m
metacontroller-0 1/1 Running 0 4h52m
metadata-envoy-deployment-76d65977f7-rmlzc 1/1 Running 0 4h52m
metadata-grpc-deployment-697d9c6c67-j6dl2 2/2 Running 3 4h52m
metadata-writer-58cdd57678-8t6gw 2/2 Running 1 4h52m
minio-6d6784db95-tqs77 2/2 Running 0 4h45m
ml-pipeline-85fc99f899-plsz2