目录

    1. 安装基础环境

    • 安装 Kubernetes

    参考链接:使用 Kubeadm 安装 Kubernetes 集群 。值得注意的是 Kubeflow 并不是对每个版本的 Kubernetes 兼容,system-requirements

    kubectl version
    
    Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.12", GitCommit:"e2a822d9f3c2fdb5c9bfbe64313cf9f657f0a725", GitTreeState:"clean", BuildDate:"2020-05-06T05:17:59Z", GoVersion:"go1.12.17", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.12", GitCommit:"e2a822d9f3c2fdb5c9bfbe64313cf9f657f0a725", GitTreeState:"clean", BuildDate:"2020-05-06T05:09:48Z", GoVersion:"go1.12.17", Compiler:"gc", Platform:"linux/amd64"}
    
    • 安装 kustomize
    curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash
    mv kustomize /usr/local/bin/
    
    kustomize version
    
    {Version:kustomize/v3.5.5 GitCommit:897e7b6e61e65188d846c32bd3af9ef68b0f746a BuildDate:2020-05-11T16:51:33Z GoOs:linux GoArch:amd64}
    

    2. 安装 Kubefolow

    • 确保有默认的 StorageClass
    kubectl get sc
    
    NAME                   PROVISIONER                                       AGE
    nfs-client (default)   cluster.local/nfs-client-nfs-client-provisioner   8m57s
    

    参考链接:使用-StorageClass-提供-PV-动态存储

    • 下载 kfctl
    wget https://github.com/kubeflow/kubeflow/releases/download/v1.0/kfctl_v1.0-0-g94c35cf_linux.tar.gz
    
    tar -xvf *_linux.tar.gz
    mv kfctl /usr/local/bin/
    
    • 安装环境变量
    mkdir /home/kubeflow
    
    export KF_NAME="mykubeflow"
    export BASE_DIR="/home/kubeflow"
    export KF_DIR=${BASE_DIR}/${KF_NAME}
    
    export CONFIG_URI="https://raw.githubusercontent.com/kubeflow/manifests/v1.0-branch/kfdef/kfctl_k8s_istio.v1.0.2.yaml"
    
    • 开始安装
    mkdir -p ${KF_DIR}
    cd ${KF_DIR}
    kfctl apply -V -f ${CONFIG_URI}
    
    • 查看部署状态,等待完成
    kubectl -n kubeflow get pod --watch
    

    3. 查看 UI 页面

    Kubeflow 通过 istio-ingressgateway 提供访问入口。由于没有 LoadBalancer ,这里将服务的 type 改为 NodePort ,执行命令:

    for i in 'istio-ingressgateway'; do kubectl patch service $i -p '{"spec":{"type":"NodePort"}}' -n istio-system; done
    

    查看访问端口:

    kubectl get svc -n istio-system | grep istio-ingressgateway
    
    istio-ingressgateway       NodePort    10.233.27.126   <none>        15020:32305/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:31128/TCP,15030:32594/TCP,15031:31617/TCP,15032:31969/TCP,15443:32559/TCP                                                1h
    

    打开页面,http://{HOST_IP}:31380