You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-29Lines changed: 42 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,14 @@
2
2
3
3
[](https://www.mathworks.com/matlabcentral/fileexchange/167676-matlab-parallel-server-in-kubernetes)
4
4
5
-
This repository contains utilities for using MATLAB® Parallel Server in a Kubernetes® cluster.
5
+
This repository contains utilities for using MATLAB® Parallel Server™ in a Kubernetes® cluster.
6
6
7
7
## Introduction
8
8
9
9
This guide explains how to deploy MATLAB Job Scheduler onto your Kubernetes cluster.
10
10
You can then connect to the MATLAB Job Scheduler and use it to run MATLAB Parallel Server jobs on the Kubernetes cluster.
11
11
12
-
For more information on MATLAB Job Scheduler and MATLAB Parallel Server, see the MathWorks documentation on [MATLAB Parallel Server](https://www.mathworks.com/help/matlab-parallel-server/index.html).
12
+
For more information on MATLAB Job Scheduler and MATLAB Parallel Server, see the MathWorks® documentation on [MATLAB Parallel Server](https://www.mathworks.com/help/matlab-parallel-server/index.html).
13
13
14
14
## Requirements
15
15
@@ -20,7 +20,6 @@ Before you start, you need the following:
20
20
- Uses Kubernetes version 1.21.1 or later.
21
21
- Meets the system requirements for running MATLAB Job Scheduler. For details, see the MathWorks documentation for [MATLAB Parallel Server Product Requirements](https://www.mathworks.com/support/requirements/matlab-parallel-server.html).
22
22
- Configured to create external load balancers that allow traffic into the cluster.
23
-
- Docker® installed on your computer. For help with installing Docker, see [Get Docker](https://docs.docker.com/get-docker/).
24
23
- Kubectl installed on your computer and configured to access your Kubernetes cluster. For help with installing Kubectl, see [Install Tools](https://kubernetes.io/docs/tasks/tools/) on the Kubernetes website.
25
24
- Helm® version 3.8.0 or later installed on your computer. For help with installing Helm, see [Quickstart Guide](https://helm.sh/docs/intro/quickstart/).
26
25
- Network access to the MathWorks Container Registry, `containers.mathworks.com`, and the GitHub® Container registry, `ghcr.io`.
@@ -51,14 +50,11 @@ Create these volumes using your preferred storage medium.
51
50
For instructions, see the [Kubernetes PersistentVolume documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/).
52
51
53
52
The software requires three PersistentVolumes to retain job data and logs.
54
-
You can also use a PersistentVolume to mount your own MATLAB Parallel Server installation onto the MATLAB Job Scheduler pods.
55
-
If you do not create a PersistentVolume containing a MATLAB Parallel Server installation, you must use a Docker image that has MATLAB Parallel Server installed.
56
53
57
54
Create a PersistentVolume for each of the following applications:
58
55
- An empty PersistentVolume with access mode `ReadWriteOnce` for MATLAB Job Scheduler's checkpoint folder, which retains job data after exiting the session
59
56
- An empty PersistentVolume with access mode `ReadWriteOnce` to retain logs from the MATLAB Job Scheduler job manager
60
57
- An empty PersistentVolume with access mode `ReadWriteMany` to retain logs from the MATLAB Job Scheduler workers
61
-
- A PersistentVolume with access mode `ReadOnlyMany` containing a MATLAB Parallel Server installation
62
58
63
59
Now create a *PersistentVolumeClaim* for each PersistentVolume.
64
60
You can create a PersistentVolumeClaim by using the following example configuration file.
@@ -82,25 +78,6 @@ spec:
82
78
storage: <capacity>
83
79
```
84
80
85
-
### Build MATLAB Parallel Server Docker Image (Optional)
86
-
87
-
The MATLAB Job Scheduler pods require a MATLAB Parallel Server installation.
88
-
By default, you mount this from a PersistentVolume, as described in the previous step.
89
-
If you do not have a MATLAB Parallel Server installation to mount, you can build a Docker image containing a MATLAB Parallel Server installation instead.
90
-
91
-
Build a Docker image that contains a MATLAB Parallel Server installation.
92
-
- Specify `<release>` as a MATLAB release number with a lowercase `r`. For example, to install MATLAB R2024a, specify `<release>` as `r2024a`. The MATLAB release must be version R2024a or later.
93
-
- Specify `<other-products>` as a space-separated list of MATLAB toolboxes you want to install. The toolbox names must match the product names listed on the MathWorks® product page with any spaces replaced by underscores. For example, to install Parallel Computing Toolbox and Deep Learning Toolbox, specify `<other-products>` as `Parallel_Computing_Toolbox Deep_Learning_Toolbox`. For a complete list of product names, see [MathWorks Products](https://www.mathworks.com/products.html).
94
-
- Specify `<my-tag>` as the Docker tag to use for the image.
Push the image to a repository that is visible to your Kubernetes cluster.
100
-
101
-
For more information on building a MATLAB Docker image, see [Create a MATLAB Container Image](https://github.com/mathworks-ref-arch/matlab-dockerfile) in the GitHub repository.
102
-
103
-
104
81
### Create Administrator Password Secret
105
82
106
83
By default, MATLAB Job Scheduler in Kubernetes runs at security level 2.
@@ -123,24 +100,30 @@ Copy the following lines into a YAML file, `values.yaml`, and modify the values
123
100
```yaml
124
101
matlabRelease: r2024a
125
102
maxWorkers: 100
126
-
matlabPVC: "matlab-pvc"
103
+
104
+
# Licensing settings
105
+
useOnlineLicensing: true
106
+
networkLicenseManager: ""
107
+
108
+
# PersistentVolumeClaim settings
127
109
checkpointPVC: "checkpoint-pvc"
128
110
logPVC: "log-pvc"
129
111
workerLogPVC: "worker-log-pvc"
112
+
113
+
# Security settings
130
114
jobManagerUserID: 0
131
115
jobManagerGroupID: 0
132
-
matlabImage: ""
133
116
```
134
117
Modify the following values:
135
118
-`matlabRelease`— Specify the release number of the MATLAB Parallel Server installation.
136
119
-`maxWorkers`— Specify the maximum number of MATLAB Parallel Server workers to run in the cluster. The cluster starts with zero workers and automatically scales up to this number as the cluster becomes busy.
137
-
-`matlabPVC`— Specify the name of a PersistentVolumeClaim that is bound to the PersistentVolume with a MATLAB Parallel Server installation.
120
+
-`useOnlineLicensing`— Option to use MathWorks online licensing. Set this parameter to true to use online licensing to manage licensing for your cluster users. When enabled, users must log in to their MathWorks account to connect to the cluster, and their account must be linked to a MATLAB Parallel Server license that is managed online. For more information about online licensing, see [Use Online Licensing for MATLAB Parallel Server](https://www.mathworks.com/products/matlab-parallel-server/online-licensing.html) on the MathWorks website. To learn how to set up online licensing, see the MathWorks documentation [Configure MATLAB Parallel Server Licensing for Cloud Platforms](https://www.mathworks.com/help/matlab-parallel-server/configure-matlab-parallel-server-licensing-for-cloud-platforms.html).
121
+
-`networkLicenseManager`— To use a network license manager to manage licensing for your cluster users, specify the address of your network license manager in the format `port@host`. The license manager must be accessible from the Kubernetes cluster. You can install or use an existing network license manager running on-premises or on AWS®. To install a network license manager on-premises, see the MathWorks documentation [Install License Manager on License Server](https://www.mathworks.com/help/install/ug/install-license-manager-on-license-server.html). To deploy a network license manager reference architecture on AWS, select a MATLAB release from [Network License Manager for MATLAB on AWS](https://github.com/mathworks-ref-arch/license-manager-for-matlab-on-aws).
138
122
-`checkpointPVC`— Specify the name of a PersistentVolumeClaim that is bound to a PersistentVolume used to retain job data.
139
123
-`logPVC`— Specify the name of a PersistentVolumeClaim that is bound to a PersistentVolume used to retain job manager logs.
140
124
-`workerLogPVC`— Specify the name of a PersistentVolumeClaim that is bound to a PersistentVolume used to retain worker logs.
141
125
-`jobManagerUserID`— Specify the user ID of the user account that MATLAB Job Scheduler should use to run the job manager pod. The user must have write permission for the checkpoint and log PersistentVolumes. To find the user ID, on a Linux machine, run `id -u`.
142
126
-`jobManagerGroupID`— Specify the group ID of the user account that MATLAB Job Scheduler should use to run the job manager pod. The user must have write permission for the checkpoint and log PersistentVolumes. To find the group ID, on a Linux machine, run `id -g`.
143
-
-`matlabImage`— Specify the URI of a Docker image that contains a MATLAB Parallel Server installation. Specify a URI only if you built a Docker image instead of mounting a MATLAB Parallel Server installation from a PersistentVolume. If you specify this parameter, set the `matlabPVC` parameter to an empty string (`""`).
144
127
145
128
For a full list of the configurable Helm values that you can set in this file, see the [Helm Values](helm_values.md) page.
146
129
@@ -228,6 +211,13 @@ If you created a custom load balancer service, delete the service:
228
211
kubectl delete service mjs-ingress-proxy --namespace mjs
229
212
```
230
213
214
+
If you want to reinstall MATLAB Job Scheduler, you must ensure that the load balancer service is deleted first.
215
+
To check the status of the load balancer service, run:
216
+
```
217
+
kubectl get service mjs-ingress-proxy --namespace mjs
218
+
```
219
+
If the load balancer service appears, wait for some time, then run the command again to confirm that the load balancer service is not found before proceeding with the MATLAB Job Scheduler reinstallation.
220
+
231
221
## Examples
232
222
233
223
Create a cluster object using your cluster profile `<name>`:
@@ -311,6 +301,29 @@ end
311
301
312
302
## Advanced Setup Steps
313
303
304
+
### Customize Worker Image
305
+
306
+
The MATLAB Parallel Server workers run on an image that contains MATLAB, Simulink, all MathWorks toolboxes, and the Deep Learning Support Packages by default.
307
+
If you want to increase the performance of creating worker pods or customise the toolboxes or support packages used, you have two options:
308
+
1. Build a custom Docker image with only the toolboxes you need
309
+
2. Mount the MATLAB installation from a PersistentVolume
310
+
311
+
#### Build Custom Docker Image
312
+
313
+
To build a custom Docker image, see [Create a MATLAB Parallel Server Container Image](images/worker/README.md).
314
+
Push the image to a repository that is visible to your Kubernetes cluster.
315
+
316
+
Modify your `values.yaml` file to set the `workerImage` and `workerImageTag` parameters to the URI and tag of your image before installating the Helm chart.
317
+
318
+
#### Mount MATLAB from a PersistentVolume
319
+
320
+
To mount MATLAB from a PersistentVolume, create a PersistentVolume and PersistentVolumeClaim with access mode `ReadOnlyMany` containing a MATLAB Parallel Server installation.
321
+
For example, if your Kubernetes cluster runs on-premise, you could create a PersistentVolume from an NFS server containing the MATLAB Parallel Server installation.
322
+
For details on creating the PersistentVolumeClaim, see the [Create Persistent Volumes](#create-persistent-volumes) section.
323
+
324
+
Modify your `values.yaml` file to set the `matlabPVC` parameter to the name of your PersistentVolumeClaim before installating the Helm chart.
325
+
The worker pods will now use the image URI specified in the `matlabDepsImage` parameter instead of the `workerImage` parameter.
326
+
314
327
### Customize Load Balancer
315
328
316
329
MATLAB Job Scheduler in Kubernetes uses a Kubernetes load balancer service to expose MATLAB Job Scheduler to MATLAB clients running outside of the Kubernetes cluster.
0 commit comments