This documentation explains how to run PaddlePaddle Cloud on the development computer using minikube.
-
Install minikube and kubectl.
-
Start a local minikube cluster. The reason we start a 1.6.4 in this case is paddle cloud currently has some dependency on TPR, which will be deprecated from 1.7.
minikube start --kubernetes-version v1.6.4
If you can't connect to minikube distribution server,add https_proxy like that:
https_proxy=YOURPROXY:PORT minikube start --kubernetes-version v1.6.4
-
Enable ingress addon:
minikube addons enable ingress
-
Create workspace directory:
mkdir $HOME/workspace
Mount this directory to
/workspce
minikube mount $HOME/workspace:/workspace
Please Note : minikube's
mount
might not work properly in Mac. In the other hand,/Users
directory is automatically mounted to VM'sUsers
path by default in Mac, so if you are using Mac, you can skip this step and find workspace directory from/Users/<your login name>/workspace
in VM instead. -
Copy
ca
and generateadmin
certificate:
(We must useca
under~/.minikube
rather than~/.minikube/certs
.)mkdir $HOME/workspace/certs && cd $HOME/workspace/certs openssl genrsa -out admin-key.pem 2048 openssl req -new -key admin-key.pem -out admin.csr -subj "/CN=kube-admin" openssl x509 -req -in admin.csr -CA ~/.minikube/ca.crt -CAkey ~/.minikube/ca.key \ -CAcreateserial -out admin.pem -days 365 cp ~/.minikube/ca.crt . cp ~/.minikube/ca.key .
-
Copy and update PaddlePaddle Cloud configurations:
In Mac
$WORKSPACE_PATH=$HOME/workspace
In other OS
$WORKSPACE_PATH=/workspace
git clone https://github.com/PaddlePaddle/cloud cp cloud/k8s/minikube/* $HOME/workspace sed -i'.bak' -e "s#<yourpath>#$WORKSPACE_PATH#g" $HOME/workspace/*.yaml
-
Edit
/etc/hosts
and add$(minikube ip) cloud.testpcloud.org
to it. -
Start all jobs:
kubectl create -f cloud_ingress.yaml kubectl create -f cloud_service.yaml kubectl create -f mysql_deployment.yaml kubectl create -f mysql_service.yaml kubectl create -f pfs_deployment.yaml kubectl create -f pfs_service.yaml kubectl create -f cloud_deployment.yaml
-
open
cloud.testpcloud.org
in your browser and sign up a user. -
To interact with PaddlePaddle Cloud instance, you need to use paddlecloud command line tool. Edit command line config file from
~/.paddle/config
like this:
datacenters:
- name: testpcloud
username: <username you just signed up>
password: <password of the user you just signed up>
endpoint: http://cloud.testpcloud.org
current-datacenter: testpcloud
Now PaddlePaddle Cloud command line is ready to use.
For further usage, please refer to the doc from here (in Chinese), and here (comming soon)
- There is nothing when open
cloud.testpcloud.org
in browser.
One possible cause is:default-http-backend
is not ready yet. Runminikube get po --all-namespaces
to check its status. If it's stuck at pulling the image, one alternative is to manually download the image and load it with minikube's docker.
- run
kubectrl describe po name --namespace=kube-system
to get docker image uri. docker save <docker-image-uri> > <tarname>.tar
to save the image to a tar file. You may need to use proxy with this step.minikube ssh
to login to Minikube's command line.docker load < <tarname>.tar
to load the image to Kubenetes' local docker image repo.
- I edited a file in host file system, but it remained unchanged in Minikube virtual machine sometimes.
That might be due to the files cache mechanism of Minikube. You can try to restart the Minikube withminikube stop
minikube start --kubernetes-version v1.6.4
to fix it.
-
Currently the
mysql
docker runsmysqld
under usermysql
instead ofroot
, which makes it difficult to savemysql
data to hostpath. -
Update TPR to CRD to be able to run on latest kubernetes