|
| 1 | +# Cluster Setup |
| 2 | + |
| 3 | +The cluster setup installs OpenShift AI and Coscheduler, configures Kueue, |
| 4 | +cluster roles, and priority classes. |
| 5 | + |
| 6 | +If MLBatch is deployed on a cluster that used to run earlier versions of ODH, |
| 7 | +[MCAD](https://github.com/project-codeflare/mcad), OpenShift AI, or Coscheduler, |
| 8 | +make sure to scrub traces of these installations. In particular, make sure to |
| 9 | +delete the following custom resource definitions (CRD) if present on the |
| 10 | +cluster. Make sure to delete all instances prior to deleting the CRDs: |
| 11 | +```sh |
| 12 | +# Delete old appwrappers and crd |
| 13 | +oc delete appwrappers --all -A |
| 14 | +oc delete crd appwrappers.workload.codeflare.dev |
| 15 | + |
| 16 | +# Delete old noderesourcetopologies and crd |
| 17 | +oc delete noderesourcetopologies --all -A |
| 18 | +oc delete crd noderesourcetopologies.topology.node.k8s.io |
| 19 | +``` |
| 20 | + |
| 21 | +## Priorities |
| 22 | + |
| 23 | +Create `default-priority`, `high-priority`, and `low-priority` priority classes: |
| 24 | +```sh |
| 25 | +oc apply -f setup.RHOAI-v2.13/mlbatch-priorities.yaml |
| 26 | +``` |
| 27 | + |
| 28 | +## Coscheduler |
| 29 | + |
| 30 | +Install Coscheduler v0.28.9 as a secondary scheduler and configure packing: |
| 31 | +```sh |
| 32 | +helm install scheduler-plugins --namespace scheduler-plugins --create-namespace \ |
| 33 | + scheduler-plugins/manifests/install/charts/as-a-second-scheduler/ \ |
| 34 | + --set-json pluginConfig='[{"args":{"scoringStrategy":{"resources":[{"name":"nvidia.com/gpu","weight":1}],"requestedToCapacityRatio":{"shape":[{"utilization":0,"score":0},{"utilization":100,"score":10}]},"type":"RequestedToCapacityRatio"}},"name":"NodeResourcesFit"}]' |
| 35 | +``` |
| 36 | +Patch Coscheduler pod priorities: |
| 37 | +```sh |
| 38 | +oc patch deployment -n scheduler-plugins --type=json --patch-file setup.RHOAI-v2.13/coscheduler-priority-patch.yaml scheduler-plugins-controller |
| 39 | +oc patch deployment -n scheduler-plugins --type=json --patch-file setup.RHOAI-v2.13/coscheduler-priority-patch.yaml scheduler-plugins-scheduler |
| 40 | +``` |
| 41 | + |
| 42 | +## OpenShift AI |
| 43 | + |
| 44 | +Create the OpenShift AI subscription: |
| 45 | +```sh |
| 46 | +oc apply -f setup.RHOAI-v2.13/mlbatch-subscription.yaml |
| 47 | +```` |
| 48 | +Identify install plan: |
| 49 | +```sh |
| 50 | +oc get ip -n redhat-ods-operator |
| 51 | +``` |
| 52 | +``` |
| 53 | +NAMESPACE NAME CSV APPROVAL APPROVED |
| 54 | +redhat-ods-operator install-kmh8w rhods-operator.2.10.0 Manual false |
| 55 | +``` |
| 56 | +Approve install plan replacing the generated plan name below with the actual |
| 57 | +value: |
| 58 | +```sh |
| 59 | +oc patch ip -n redhat-ods-operator --type merge --patch '{"spec":{"approved":true}}' install-kmh8w |
| 60 | +``` |
| 61 | +Create DSC Initialization: |
| 62 | +```sh |
| 63 | +oc apply -f setup.RHOAI-v2.13/mlbatch-dsci.yaml |
| 64 | +``` |
| 65 | +Create Data Science Cluster: |
| 66 | +```sh |
| 67 | +oc apply -f setup.RHOAI-v2.13/mlbatch-dsc.yaml |
| 68 | +``` |
| 69 | +The provided DSCI and DSC are intended to install a minimal set of OpenShift |
| 70 | +AI managed components: `codeflare`, `kueue`, `ray`, and `trainingoperator`. The |
| 71 | +remaining components such as `dashboard` can be optionally enabled. |
| 72 | + |
| 73 | +The configuration of the managed components differs from the default OpenShift |
| 74 | +AI configuration as follows: |
| 75 | +- Kubeflow Training Operator: |
| 76 | + - `gang-scheduler-name` is set to `scheduler-plugins-scheduler`, |
| 77 | +- Kueue: |
| 78 | + - `manageJobsWithoutQueueName` is enabled, |
| 79 | + - `batch/job` integration is disabled, |
| 80 | + - `waitForPodsReady` is disabled, |
| 81 | + - `LendingLimit` feature gate is enabled, |
| 82 | + - `enableClusterQueueResources` metrics is enabled, |
| 83 | +- Codeflare operator: |
| 84 | + - the AppWrapper controller is enabled and configured as follows: |
| 85 | + - `userRBACAdmissionCheck` is disabled, |
| 86 | + - `schedulerName` is set to `scheduler-plugins-scheduler`, |
| 87 | + - `queueName` is set to `default-queue`, |
| 88 | +- pod priorities, resource requests and limits have been adjusted. |
| 89 | + |
| 90 | +To work around https://issues.redhat.com/browse/RHOAIENG-7887 (a race condition |
| 91 | +in OpenShift AI installation), do a rolling restart of the Kueue manager. |
| 92 | +```sh |
| 93 | +oc rollout restart deployment/kueue-controller-manager -n redhat-ods-applications |
| 94 | +``` |
| 95 | + |
| 96 | +After doing the restart, verify that you see the following lines in the |
| 97 | +kueue-controller-manager's log: |
| 98 | +```sh |
| 99 | +{"level":"info","ts":"2024-06-25T20:17:25.689638786Z","logger":"controller-runtime.builder","caller":"builder/webhook.go:189","msg":"Registering a validating webhook","GVK":"kubeflow.org/v1, Kind=PyTorchJob","path":"/validate-kubeflow-org-v1-pytorchjob"} |
| 100 | +{"level":"info","ts":"2024-06-25T20:17:25.689698615Z","logger":"controller-runtime.webhook","caller":"webhook/server.go:183","msg":"Registering webhook","path":"/validate-kubeflow-org-v1-pytorchjob"} |
| 101 | +{"level":"info","ts":"2024-06-25T20:17:25.689743757Z","logger":"setup","caller":"jobframework/setup.go:81","msg":"Set up controller and webhook for job framework","jobFrameworkName":"kubeflow.org/pytorchjob"} |
| 102 | + |
| 103 | +``` |
| 104 | + |
| 105 | +## Kueue Configuration |
| 106 | + |
| 107 | +Create Kueue's default flavor: |
| 108 | +```sh |
| 109 | +oc apply -f setup.RHOAI-v2.13/default-flavor.yaml |
| 110 | +``` |
| 111 | + |
| 112 | +## Cluster Role |
| 113 | + |
| 114 | +Create `mlbatch-edit` role: |
| 115 | +```sh |
| 116 | +oc apply -f setup.RHOAI-v2.13/mlbatch-edit-role.yaml |
| 117 | +``` |
| 118 | + |
| 119 | +## Slack Cluster Queue |
| 120 | + |
| 121 | +Create the designated slack `ClusterQueue` which will be used to automate |
| 122 | +minor adjustments to cluster capacity caused by node failures and |
| 123 | +scheduler maintanence. |
| 124 | +```sh |
| 125 | +oc apply -f- << EOF |
| 126 | +apiVersion: kueue.x-k8s.io/v1beta1 |
| 127 | +kind: ClusterQueue |
| 128 | +metadata: |
| 129 | + name: slack-cluster-queue |
| 130 | +spec: |
| 131 | + namespaceSelector: {} |
| 132 | + cohort: default-cohort |
| 133 | + preemption: |
| 134 | + withinClusterQueue: LowerOrNewerEqualPriority |
| 135 | + reclaimWithinCohort: Any |
| 136 | + borrowWithinCohort: |
| 137 | + policy: Never |
| 138 | + resourceGroups: |
| 139 | + - coveredResources: ["cpu", "memory", "nvidia.com/gpu", "nvidia.com/roce_gdr", "pods"] |
| 140 | + flavors: |
| 141 | + - name: default-flavor |
| 142 | + resources: |
| 143 | + - name: "cpu" |
| 144 | + nominalQuota: 8000m |
| 145 | + - name: "memory" |
| 146 | + nominalQuota: 128Gi |
| 147 | + - name: "nvidia.com/gpu" |
| 148 | + nominalQuota: 8 |
| 149 | + - name: "nvidia.com/roce_gdr" |
| 150 | + nominalQuota: 1 |
| 151 | + - name: "pods" |
| 152 | + nominalQuota: 100 |
| 153 | +EOF |
| 154 | +``` |
| 155 | +Edit the above quantities to adjust the quota to the desired |
| 156 | +values. Pod counts are optional and can be omitted from the list of |
| 157 | +covered resources. The `lendingLimit` for each resource will be |
| 158 | +dynamically adjusted by the MLBatch system to reflect reduced cluster |
| 159 | +capacity. See [QUOTA_MAINTENANCE.md](../QUOTA_MAINTENANCE.md) for a |
| 160 | +detailed discussion of the role of the slack `ClusterQueue`. |
0 commit comments