pai icon indicating copy to clipboard operation
pai copied to clipboard

can deployment in Single node cluster?

Open MaPing01 opened this issue 6 years ago • 4 comments

Organization Name:

Short summary about the issue/question:

Brief what process you are following:

How to reproduce it:

OpenPAI Environment:

  • OpenPAI version:
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Hardware (e.g. core number, memory size, storage size, GPU type etc.):
  • Others:

Anything else we need to know:

MaPing01 avatar Jun 11 '20 03:06 MaPing01

@MaPing01 - thanks for raising the question, I noticed you had several issue request. Very glad you are following OpenPAI and provide feedbacks.

Would you mind provide more context for us as reference? like the questions in the issue template: Organization Name: OpenPAI version: Cloud provider or hardware configuration: OS (e.g. from /etc/os-release): Kernel (e.g. uname -a): Hardware (e.g. core number, memory size, storage size, GPU type etc.): Others:

scarlett2018 avatar Jun 15 '20 07:06 scarlett2018

Hi @MaPing01,

OpenPAI could be deployed on a single node, but quick-start.sh haven't supported it yet. I will provide you a simple tutorial, following which, you could deploy openpai on a single node.

1: Prepare configuration

config.yml master.csv empty worker.csv

2: Generate configuration.

cd pai/contrib/kubespray
python3 script/k8s-generator.py -m path/to/master.csv -w path/to/worker.csv -c path/to/config.yml -o path/to/output

get the following 2 files

hosts.yml
openpai.yml

3: Setup k8s

  • env
git clone https://github.com/kubernetes-sigs/kubespray.git
cd kubespray
git checkout release-2.11
sudo apt-get -y update
sudo apt-get -y install software-properties-common python3 python3-dev
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
sudo apt-get -y install sshpass
sudo pip3 install -r requirements.txt
  • install
cp -rfpinventory/sample inventory/pai
cp path/to/hosts.yml inventory/pai
cp path/to/openpai.yml inventory/pai
ansible-playbook -i inventory/pai/hosts.yml cluster.yml --become --become-user=root -e "@inventory/pai/openpai.yml" 
  • kubectl
cp -rf inventory/pai/artifacts/admin.conf ~/.kube/config
sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl

4: write openpai configuration

svn cat https://github.com/NVIDIA/k8s-device-plugin.git/tags/1.0.0-beta4/nvidia-device-plugin.yml \
  | kubectl apply --overwrite=true -f -
svn cat https://github.com/RadeonOpenCompute/k8s-device-plugin.git/trunk/k8s-ds-amdgpu-dp.yaml \
  | kubectl apply --overwrite=true -f -

commnet 185,186 lines in this script https://github.com/microsoft/pai/blob/master/contrib/kubespray/script/openpai-generator.py#L185

python3 script/openpai-generator.py -m path/to/master.csv -w path/to/worker.csv -c path/to/config.yml -o path/to/output

you will get following files

layout.yaml
services-configuration.yaml

5: Modify configuration

  • layout.yaml Add pai-worker: "true" for your master node
  • services-configuration.yaml Modify the hivedScheduler based on your master node capacity. https://github.com/microsoft/pai/blob/master/contrib/kubespray/quick-start/services-configuration.yaml.template#L59

And the copy these to a path. Here I will assume the path is /path/configuration

6: start dev-box-container.

sudo docker run -itd
-e COLUMNS=$COLUMNS -e LINES=$LINES -e TERM=$TERM
-v /var/run/docker.sock:/var/run/docker.sock
-v /path/configuration:/cluster-configuration
-v ~/.kube:/root/.kube
--pid=host
--privileged=true
--net=host
--name=dev-box-quick-start
openpai/dev-box:v1.0.1

And then in the dev-box.

kubectl create namespace pai-storage
echo -e "pai\n" | python paictl.py config push -p /cluster-configuration -m service
echo -e "pai\n" | python paictl.py service start

ydye avatar Jun 16 '20 07:06 ydye

The discussion in #4654 and this thread should be able to resolve the problem. I hereby close the issue. Feel free to reopen it if having further problems.

fanyangCS avatar Jul 09 '20 03:07 fanyangCS

Thanks this works for me but there are also some problems. Several comments here to setup single node just FYI.

  1. both local dev machine and the node requires to install sshpass, otherwise kuberspray may fail. If you hit the ansible 2.7 error with parsing yaml file, then either select a plugin or switch to 2.8. The latter version works for me,
  2. If you have GPU on your machine, please make sure to check the installation guide for the "worker" section, otherwise openpai-generator won't generate configuration file since the docker image may be incorrect.
  3. When calling the openpai-generator, the template path also needs to be modified as per your needs.
  4. And then in the dev-box. -> should be And then in the dev container. dev-box will be the localhost or please rename it to avoid confusion

xiaolul avatar Aug 20 '20 09:08 xiaolul