Instructions for deploying a GPU cluster with Kubernetes
- Control system to run the install process
- One or more servers on which to install Kubernetes
-
Install a supported operating system on all nodes.
Install a supported operating system on all servers via a 3rd-party solution (i.e. MAAS, Foreman) or utilize the provided OS install container.
-
Set up your provisioning machine.
This will install Ansible and other software on the provisioning machine which will be used to deploy all other software to the cluster. For more information on Ansible and why we use it, consult the Ansible Guide.
# Install software prerequisites and copy default configuration ./scripts/setup.sh -
Create the server inventory.
Ansible uses an inventory which outlines the servers in your cluster. Use the script below to create the server inventory by supplying host IP addresses as argument inputs.
# Specify IP addresses of Kubernetes nodes ./scripts/k8s_inventory.sh 10.0.0.1 10.0.0.2 10.0.0.3A
k8s-configinventory directory should now exist. Optionally, modify thek8s-config/hosts.inito configure hosts for specific roles (ex: master node vs worker node).# (optional) Modify `k8s-config/hosts.ini` to configure hosts for specific roles # Make sure the [etcd] group has an odd number of hosts
-
Install Kubernetes using Ansible and Kubespray.
# NOTE: If SSH requires a password, add: `-k` # NOTE: If sudo on remote machine requires a password, add: `-K` # NOTE: If SSH user is different than current user, add: `-u ubuntu` ansible-playbook -i k8s-config/hosts.ini -b playbooks/k8s-cluster.yml
More information on Kubespray can be found in the official Getting Started Guide
-
Verify that the Kubernetes cluster is running.
# You may need to manually run: `sudo cp ./k8s-config/artifacts/kubectl /usr/local/bin` kubectl get nodesOptionally, test a GPU job to ensure that your Kubernetes setup can tap into GPUs.
kubectl run gpu-test --rm -t -i --restart=Never --image=nvidia/cuda --limits=nvidia.com/gpu=1 -- nvidia-smi
The following components are completely optional and can be installed on an existing Kubernetes cluster.
Run the following script to create an administrative user and print out the dashboard URL and access token:
./scripts/k8s_deploy_dashboard_user.shDeploy a Ceph cluster running on Kubernetes for services that require persistent storage (such as Kubeflow):
./scripts/k8s_deploy_rook.shPoll the Ceph status by running:
./scripts/ceph_poll.shDeploy Prometheus and Grafana to monitor Kubernetes and cluster nodes:
./scripts/k8s_deploy_monitoring.shThe services can be reached from the following addresses:
- Grafana: http://mgmt:30200
- Prometheus: http://mgmt:30500
- Alertmanager: http://mgmt:30400
Follow the ELK Guide to setup logging in the cluster.
The service can be reached from the following address:
- Kibana: http://mgmt:30700
The default container registry hostname is registry.local. To set another hostname (for example,
one that is resolvable outside the cluster), add -e container_registry_hostname=registry.example.com.
ansible-playbook -i k8s-config/hosts.ini -b --tags container-registry playbooks/k8s-services.ymlKubeflow is a popular way for multiple users to run ML workloads. It exposes a Jupyter Notebook interface where users can request access to GPUs via the browser GUI. Deploy Kubeflow with a convenient script:
./scripts/k8s_deploy_kubeflow.shFor more on Kubeflow, please refer to the official documentation.
Now that Kubernetes is installed, consult the Kubernetes Usage Guide for examples of how to use Kubernetes.