Skip to content

Commit 78c26ea

Browse files
Add detailed installation instructions and examples
1 parent 01ddad2 commit 78c26ea

File tree

1 file changed

+143
-12
lines changed

1 file changed

+143
-12
lines changed

docs/README.md

Lines changed: 143 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes-sigs/aws-file-cache-csi-driver)](https://goreportcard.com/report/github.com/kubernetes-sigs/aws-file-cache-csi-driver)
22

3-
**WARNING**: This driver is in pre ALPHA currently. This means that there may potentially be backwards compatible breaking changes moving forward. Do NOT use this driver in a production environment in its current state.
4-
5-
**DISCLAIMER**: This is not an officially supported Amazon product
6-
73
## Amazon File Cache CSI Driver
84
### Overview
95

@@ -44,13 +40,21 @@ The following sections are Kubernetes-specific. If you are a Kubernetes user, us
4440
* For dynamically provisioned volumes, only one subnet is allowed inside a storageclass's `parameters.subnetId`. This is a [limitation](https://docs.aws.amazon.com/fsx/latest/APIReference/API_FileCacheCreating.html#FSx-Type-FileCacheCreating-SubnetIds) that is enforced by Amazon File Cache.
4541

4642
### Installation
47-
#### 1. Set a few variables to use in the remaining steps. Replace `my-csi-file-cache` with the name of the test cluster you want to create and `region-code` with the AWS Region that you want to create your test cluster in.
43+
44+
#### Prerequisites
45+
You must have:
46+
* The AWS CLI installed and configured on your device or AWS CloudShell. You can check your current version with `aws --version | cut -d / -f2 | cut -d ' ' -f1`. Package managers such `yum`, `apt-get`, or Homebrew for macOS are often several versions behind the latest version of the AWS CLI. To install the latest version, see [Installing, updating, and uninstalling the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and [Quick configuration with aws configure](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config) in the AWS Command Line Interface User Guide. The AWS CLI version installed in the AWS CloudShell may also be several versions behind the latest version. To update it, see [Installing AWS CLI to your home directory](https://docs.aws.amazon.com/cloudshell/latest/userguide/vm-specs.html#install-cli-software) in the AWS CloudShell User Guide.
47+
* The `eksctl` command line tool installed on your device or AWS CloudShell. To install or update `eksctl`, see [Installing or updating eksctl](https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html).
48+
* The `kubectl` command line tool is installed on your device or AWS CloudShell. The version can be the same as or up to one minor version earlier or later than the Kubernetes version of your cluster. To install or upgrade `kubectl`, see [Installing or updating kubectl](https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html).
49+
50+
51+
1. Set a few variables to use in the remaining steps. Replace `my-csi-file-cache` with the name of the test cluster you want to create and `region-code` with the AWS Region that you want to create your test cluster in.
4852
```shell
4953
export cluster_name=my-csi-file-cache
5054
export region_code=region-code
5155
```
5256

53-
#### 2. Create a test cluster.
57+
2. Create a test cluster.
5458
```shell
5559
eksctl create cluster \
5660
--name $cluster_name \
@@ -60,7 +64,8 @@ eksctl create cluster \
6064
--ssh-public-key my-key
6165
```
6266

63-
#### 3. Set up driver permission
67+
3. Set up driver permission
68+
6469
The driver requires IAM permission to talk to Amazon File Cache service to create/delete the file cache on user's behalf. There are several methods to grant driver IAM permission:
6570

6671
* Create a Kubernetes service account for the driver and attach the `AmazonFSxFullAccess` AWS-managed policy to the service account with the following command. If your cluster is in the AWS GovCloud (US-East) or AWS GovCloud (US-West) AWS Regions, then replace `arn:aws:` with `arn:aws-us-gov:`.
@@ -173,20 +178,148 @@ eksctl create iamserviceaccount \
173178
}
174179
```
175180

176-
#### 4. Deploy driver
181+
4. Deploy driver
177182
```sh
178183
kubectl apply -k "github.com/kubernetes-sigs/aws-file-cache-csi-driver/deploy/kubernetes/overlays/stable/?ref=release-0.1"
179184
```
180185

181186
Alternatively, you could also install the driver using helm:
182187

183-
184188
```sh
185189
helm repo add aws-file-cache-csi-driver https://kubernetes-sigs.github.io/aws-file-cache-csi-driver/
186190
helm repo update
187191
helm upgrade --install aws-file-cache-csi-driver --namespace kube-system aws-file-cache-csi-driver/aws-file-cache-csi-driver
188192
```
189193

194+
#### To deploy a Kubernetes storage class, persistent volume claim, and sample application to verify that the CSI driver is working
195+
196+
1. Note the security group for your cluster. You can see it in the AWS Management Console under the Networking section or by using the following AWS CLI command.
197+
198+
```shell
199+
aws eks describe-cluster --name $cluster_name --query cluster.resourcesVpcConfig.clusterSecurityGroupId
200+
```
201+
202+
2. Create a security group for your Amazon FSx file cache according to the criteria shown in [Amazon VPC Security Groups](https://docs.aws.amazon.com/fsx/latest/FileCacheGuide/limit-access-security-groups.html#fsx-vpc-security-groups) in the Amazon File Cache User Guide. For the **VPC**, select the VPC of your cluster as shown under the **Networking** section. For "the security groups associated with your Lustre clients", use your cluster security group. You can leave the outbound rules alone to allow **All traffic**.
203+
204+
3. Download the storage class manifest with the following command.
205+
206+
```shell
207+
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-file-cache-csi-driver/main/examples/kubernetes/dynamic_provisioning/specs/storageclass.yaml
208+
```
209+
210+
4. Edit the parameters section of the `storageclass.yaml` file. Replace every `example value` with your own values.
211+
212+
For information about the other parameters, see [Edit StorageClass](https://github.com/kubernetes-sigs/aws-file-cache-csi-driver/tree/main/examples/kubernetes/dynamic_provisioning#edit-storageclass).
213+
214+
```shell
215+
parameters:
216+
subnetId: "subnet-0d7b5e117ad7b4961"
217+
securityGroupIds: "sg-05a37bfe01467059"
218+
dataRepositoryAssociations: "fileCachePath=/ns1/,dataRepositoryPath=nfs://10.0.92.69/fsx/"
219+
fileCacheType(Optional): "Lustre"
220+
fileCacheTypeVersion(Optional): "2.12"
221+
weeklyMaintenanceStartTime(Optional): "6:00:00"
222+
LustreConfiguration(Optional): "{DeploymentType=CACHE_1,MetadataConfiguration=2400,perUnitStorageThroughput=1000}"
223+
```
224+
* **subnetId** – The subnet ID that the Amazon FSx file cache should be created in. Amazon FSx file cache isn't supported in all Availability Zones. Open the Amazon FSx Caches page at https://console.aws.amazon.com/fsx/#fc/file-caches/ to confirm that the subnet that you want to use is in a supported Availability Zone. The subnet can include your nodes, or can be a different subnet or VPC:
225+
* You can check for the node subnets in the AWS Management Console by selecting the node group under the Compute section.
226+
* If the subnet that you specify isn't the same subnet that you have nodes in, then your VPCs must be connected, and you must ensure that you have the necessary ports open in your security groups.
227+
* **securityGroupIds** – The ID of the security group you created for the file cache.
228+
* **dataRepositoryAssociations** – A list of up to 8 configurations for data repository associations (DRAs) to be created during the cache creation. The DRAs link the cache to either an Amazon S3 data repository or a Network File cache (NFS) data repository that supports the NFSv3 protocol.
229+
* **other parameters (optional)** – For information about the other parameters, see Edit StorageClass on GitHub.
230+
231+
5. Create the storage class manifest.
232+
233+
```shell
234+
kubectl apply -f storageclass.yaml
235+
```
236+
The example output is as follows.
237+
```shell
238+
storageclass.storage.k8s.io/fc-sc created
239+
```
240+
241+
6. Download the persistent volume claim manifest.
242+
```shell
243+
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-file-cache-csi-driver/main/examples/kubernetes/dynamic_provisioning/specs/claim.yaml
244+
```
245+
246+
7. (Optional) Edit the `claim.yaml` file. Change `1200Gi` to an incremental value of **1.2 TiB**
247+
```shell
248+
storage: 1200Gi
249+
```
250+
251+
8. Create the persistent volume claim.
252+
```shell
253+
kubectl apply -f claim.yaml
254+
```
255+
256+
The example output is as follows.
257+
```shell
258+
persistentvolumeclaim/fc-claim created
259+
```
260+
261+
9. Confirm that the file cache is provisioned.
262+
263+
```shell
264+
kubectl describe pvc
265+
```
266+
267+
The example output is as follows.
268+
```shell
269+
Name: fc-claim
270+
Namespace: default
271+
StorageClass: fc-sc
272+
Status: Bound
273+
```
274+
275+
***Note:** The `Status` may show as `Pending` for 5-10 minutes, before changing to `Bound`. Don't continue with the next step until the `Status` is `Bound`. If the `Status` shows `Pending` for more than 10 minutes, use warning messages in the `Events` as reference for addressing any problems.*
276+
277+
10. Deploy the sample application.
278+
```shell
279+
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-file-cache-csi-driver/main/examples/kubernetes/dynamic_provisioning/specs/pod.yaml
280+
```
281+
282+
11. Verify that the sample application is running.
283+
```shell
284+
kubectl get pods
285+
```
286+
The example output is as follows.
287+
```shell
288+
NAME READY STATUS RESTARTS AGE
289+
fc-app 1/1 Running 0 9m38s
290+
```
291+
292+
12. Verify that the file cache is mounted correctly by the application.
293+
```shell
294+
kubectl exec -ti fc-app -- df -h
295+
```
296+
The example output is as follows.
297+
```shell
298+
Filesystem Size Used Avail Use% Mounted on
299+
overlay 80G 4.0G 77G 5% /
300+
tmpfs 64M 0 64M 0% /dev
301+
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
302+
192.168.100.210@tcp:/d4v2dbev 1.2T 11M 1.2T 1% /data
303+
/dev/nvme0n1p1 80G 4.0G 77G 5% /etc/hosts
304+
shm 64M 0 64M 0% /dev/shm
305+
tmpfs 7.0G 12K 7.0G 1% /run/secrets/kubernetes.io/serviceaccount
306+
tmpfs 3.8G 0 3.8G 0% /proc/acpi
307+
tmpfs 3.8G 0 3.8G 0% /sys/firmware
308+
```
309+
310+
13. Verify that data was written to the Amazon File Cache by the sample app.
311+
```shell
312+
kubectl exec -it fc-app -- ls /data
313+
```
314+
The example output is as follows.
315+
```shell
316+
out.txt
317+
```
318+
This example output shows that the sample app successfully wrote the out.txt file to the file cache.
319+
320+
***Note:**
321+
Before deleting the cluster, make sure to delete the Amazon File Cache. For more information, see [Clean up resources](https://docs.aws.amazon.com/fsx/latest/FileCacheGuide/getting-started-step4.html) in the Amazon File Cache User Guide.*
322+
190323
### Examples
191324
Before the example, you need to:
192325
* Get yourself familiar with how to setup Kubernetes on AWS and [create Amazon File Cache](https://docs.aws.amazon.com/fsx/latest/FileCacheGuide/getting-started.html) if you are using static provisioning.
@@ -215,6 +348,4 @@ To execute all unit tests, run: `make test`
215348

216349
## License
217350

218-
219-
This library is licensed under the Apache 2.0 License.
220-
351+
This library is licensed under the Apache 2.0 License.

0 commit comments

Comments
 (0)