Skip to content

Commit b11f7f0

Browse files
authored
📖 AWS S3 configuration docs for federated-learning-controller (open-cluster-management-io#82)
* OpenFL: run server job as uid 1001 for S3 PVC Signed-off-by: mrrr61 <mrrr61@outlook.com> * docs(aws-s3): update storage configuration examples and clarify S3 usage Signed-off-by: mrrr61 <mrrr61@outlook.com> * docs(federated-learning-controller): add guide for configuring AWS S3 storage Signed-off-by: mrrr61 <mrrr61@outlook.com> --------- Signed-off-by: mrrr61 <mrrr61@outlook.com>
1 parent 606ec26 commit b11f7f0

5 files changed

Lines changed: 133 additions & 7 deletions

File tree

federated-learning-controller/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,14 @@ spec:
177177
port: 8080
178178
type: NodePort
179179
storage:
180-
type: PersistentVolumeClaim
180+
type: PersistentVolumeClaim # switch to S3Bucket for S3-backed static volumes
181181
name: model-pvc
182182
path: /data/models
183183
size: 2Gi
184+
# s3:
185+
# bucketName: <your-bucket-name>
186+
# region: us-east-1
187+
# prefix: optional/prefix/
184188
client:
185189
image: <REGISTRY>/flower-app-torch:<IMAGE_TAG>
186190
placement:
@@ -288,4 +292,4 @@ make uninstall
288292

289293
```sh
290294
make undeploy
291-
```
295+
```

federated-learning-controller/config/samples/federation-ai.open-cluster-management.io_v1alpha1_federatedlearning.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ spec:
1313
port: 8080
1414
type: LoadBalancer
1515
storage:
16-
type: PersistentVolumeClaim
16+
type: PersistentVolumeClaim # set to S3Bucket to bind a pre-provisioned S3 PV
1717
name: model-pvc
1818
path: /data/models
1919
size: 2Gi
20+
# s3:
21+
# bucketName: <your-bucket-name>
22+
# region: us-east-1
23+
# prefix: optional/prefix/
2024
client:
2125
image: quay.io/open-cluster-management/flower-app-torch:latest
2226
placement:
@@ -27,4 +31,4 @@ spec:
2731
claimSelector:
2832
matchExpressions:
2933
- key: federated-learning-sample.client-data
30-
operator: Exists
34+
operator: Exists
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Configure AWS S3 Storage
2+
3+
This guide walks through configuring an Amazon S3 bucket as the model storage backend for the federated learning controller. The server runs on the hub cluster, so you only need to complete these steps on the hub cluster.
4+
5+
## Prerequisites
6+
7+
- An AWS account with permissions to create or reuse an S3 bucket.
8+
- An existing S3 bucket dedicated to model artifacts (the controller does not create it for you).
9+
- A Kubernetes cluster with cluster-admin access.
10+
- `kubectl` and `helm` configured against the hub cluster.
11+
- Network connectivity from cluster nodes to the S3 endpoint that hosts your bucket.
12+
13+
> **Tip:** This guide uses static credentials stored in a Kubernetes secret to authenticate to S3.
14+
15+
## 1. Create the AWS Credential Secret
16+
17+
The CSI driver reads AWS credentials from a secret that must exist before the driver starts. Create `aws-secret.yaml` with the following content (replace the placeholders with your credentials) and apply it to the `kube-system` namespace.
18+
19+
```yaml
20+
apiVersion: v1
21+
kind: Secret
22+
metadata:
23+
name: aws-secret
24+
namespace: kube-system
25+
stringData:
26+
key_id: <your-access-key-id>
27+
access_key: <your-secret-access-key>
28+
```
29+
30+
Apply the manifest:
31+
32+
```bash
33+
kubectl apply -f aws-secret.yaml
34+
```
35+
36+
## 2. Install the AWS S3 CSI Driver
37+
38+
Install the [aws-s3-csi-driver](https://github.com/awslabs/mountpoint-s3-csi-driver) on the hub cluster. The driver runs in the `kube-system` namespace.
39+
40+
```bash
41+
helm repo add aws-mountpoint-s3-csi-driver https://awslabs.github.io/mountpoint-s3-csi-driver
42+
helm repo update
43+
44+
helm upgrade --install aws-mountpoint-s3-csi-driver \
45+
--namespace kube-system \
46+
aws-mountpoint-s3-csi-driver/aws-mountpoint-s3-csi-driver
47+
```
48+
49+
Verify that the controller and node pods are running:
50+
51+
```bash
52+
kubectl -n kube-system get pods -l app.kubernetes.io/name=aws-mountpoint-s3-csi-driver
53+
```
54+
55+
For advanced installation and configuration scenarios, refer to the upstream Mountpoint S3 CSI driver documentation: [INSTALL.md](https://github.com/awslabs/mountpoint-s3-csi-driver/blob/main/docs/INSTALL.md) and [CONFIGURATION.md](https://github.com/awslabs/mountpoint-s3-csi-driver/blob/main/docs/CONFIGURATION.md).
56+
57+
## 3. Configure the Federated Learning Resource
58+
59+
With the driver in place, update the federated learning specification to reference S3-backed storage. The controller automatically creates a `PersistentVolume` and `PersistentVolumeClaim` that target the bucket.
60+
61+
```yaml
62+
apiVersion: federation-ai.open-cluster-management.io/v1alpha1
63+
kind: FederatedLearning
64+
metadata:
65+
name: federated-learning-sample
66+
spec:
67+
framework: flower
68+
server:
69+
image: <REGISTRY>/flower-app-torch:<IMAGE_TAG>
70+
rounds: 3
71+
minAvailableClients: 2
72+
listeners:
73+
- name: server-listener
74+
port: 8080
75+
type: NodePort
76+
storage:
77+
type: S3Bucket
78+
name: s3-pvc
79+
path: /data/models
80+
size: 2Gi
81+
s3:
82+
bucketName: <your-bucket-name>
83+
region: us-east-1 # optional but recommended
84+
prefix: models/round-1/ # optional logical folder within the bucket
85+
client:
86+
image: <REGISTRY>/flower-app-torch:<IMAGE_TAG>
87+
placement:
88+
clusterSets:
89+
- global
90+
predicates:
91+
- requiredClusterSelector:
92+
claimSelector:
93+
matchExpressions:
94+
- key: federated-learning-sample.client-data
95+
operator: Exists
96+
97+
```
98+
99+
Key points:
100+
101+
- `bucketName` is required and must match the existing bucket.
102+
- `region` adds a CSI mount option so the driver talks to the correct AWS endpoint.
103+
- `prefix` scopes writes to a folder-like prefix (omit it to use the bucket root).
104+
- The controller creates PV/PVC pairs named after `name` (for example `s3-pvc` and `s3-pvc-pv`); do not pre-create them.
105+
106+
After applying the CR, confirm that the controller provisioned the volume and claim:
107+
108+
```bash
109+
kubectl get pv | grep s3
110+
kubectl get pvc s3-pvc
111+
```

federated-learning-controller/docs/configure-environment-observability.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,14 @@ spec:
229229
port: 8080
230230
type: LoadBalancer
231231
storage:
232-
type: PersistentVolumeClaim
232+
type: PersistentVolumeClaim # or S3Bucket when using a static S3 PV
233233
name: model-pvc
234234
path: /data/models
235235
size: 2Gi
236+
# s3:
237+
# bucketName: <your-bucket-name>
238+
# region: us-east-1
239+
# prefix: optional/prefix/
236240
client:
237241
image: quay.io/open-cluster-management/flower-app-torch:latest
238242
placement:

federated-learning-controller/examples/openfl/openfl-README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,15 @@ spec:
174174
port: 31531
175175
type: NodePort
176176
storage:
177-
type: PersistentVolumeClaim
177+
type: PersistentVolumeClaim # change to S3Bucket for S3-backed storage
178178
name: model-pvc
179179
# If you are using the OpenFL framework, make sure to mount the model directory under /workspace
180180
path: /workspace/models
181181
size: 2Gi
182+
# s3:
183+
# bucketName: <your-bucket-name>
184+
# region: us-east-1
185+
# prefix: optional/prefix/
182186
client:
183187
image: <your-registry>/openfl-app:latest
184188
placement:
@@ -193,4 +197,3 @@ spec:
193197
```
194198
195199
Replace `<your-registry>` with your actual image registry/paths. Ensure the server and clients use the same OpenFL image. The data shard comes from the `ClusterClaim` value and is passed to clients as `--data-path` automatically by the controller. Apply this manifest on the hub with your preferred workflow (e.g., `kubectl apply -f -`).
196-

0 commit comments

Comments
 (0)