Skip to content

Commit 7b82991

Browse files
committed
Made formatting changes
1 parent a967ecd commit 7b82991

File tree

2 files changed

+1
-239
lines changed

2 files changed

+1
-239
lines changed

Solutions/FSxN-as-PVC-for-EKS/README-san.md

Lines changed: 0 additions & 238 deletions
Original file line numberDiff line numberDiff line change
@@ -1,225 +1,3 @@
1-
# FSx for NetApp ONTAP as persistent storage
2-
3-
## Table of Contents
4-
* [Introduction](#introduction)
5-
* [Installation Oveerview](#Installation-Overview)
6-
* [Detailed Instructions](#Detailed-instructions)
7-
* [Clone the "NetApp/FSx-ONTAP-samples-scripts" repo from GitHub](#Clone-the-NetAppFSx-ONTAP-samples-scripts-repo-from-GitHub)
8-
* [Make any desired changes to the variables.tf file](#Make-any-desired-changes-to-the-variables.tf-file)
9-
* [Initialize the Terraform environment](#Initialize-the-Terraform-environment)
10-
* [Deploy the resources](#Deploy-the-resources)
11-
* [SSH to the jump server to complete the setup](#SSH-to-the-jump-server-to-complete-the-setup)
12-
* [Configure the 'aws' CLI](#Configure-the-'aws'-CLI)
13-
* [Allow access to the EKS cluster for your user id](#Allow-access-to-the-EKS-cluster-for-your-user-id)
14-
* [Configure kubectl to use the EKS cluster](#Configure-kubectl-to-use-the-EKS-cluster)
15-
* [Confirm Astra Trident is up and running](#Confirm-Astra-Trident-is-up-and-running)
16-
* [Configure the Trident CSI backend to use FSx for NetApp ONTAP](#Configure-the-Trident-CSI-backend-to-use-FSx-for-NetApp-ONTAP)
17-
* [Create a Kubernetes storage class](#Create-a-Kubernetes-storage-class)
18-
* [Create a stateful application](#Create-a-stateful-application)
19-
* [Create a Persistent Volume Claim](#Create-a-Persistent-Volume-Claim)
20-
* [Deploy a MySQL database using the storage created above](#Deploy-a-MySQL-database-using-the-storage-created-above)
21-
* [Populate the MySQL database with data](#Populate-the-MySQL-database-with-data)
22-
* [Create a snapshot of the MySQL data](#Create-a-snapshot-of-the-MySQL-data)
23-
* [Install the Kubernetes Snapshot CRDs and Snapshot Controller](#Install-the-Kubernetes-Snapshot-CRDs-and-Snapshot-Controller)
24-
* [Create a snapshot class based on the CRD instsalled](#Create-a-snapshot-class-based-on-the-CRD-installed)
25-
* [Create a snapshot of the MySQL data](#Create-a-snapshot-of-the-MySQL-data)
26-
* [Clone the MySQL data to a new storage persistent volume](#Clone-the-MySQL-data-to-a-new-storage-persistent-volume)
27-
* [Create a new MySQL database using the cloned volume](#Create-a-new-MySQL-database-using-the-cloned-volume)
28-
* [To confirm that the new database is up and running, log into it and check the data](#To-confirm-that-the-new-database-is-up-and-running,-log-into-it-and-check-the-data)
29-
* [Final steps](#Final-steps)
30-
* [Author Information](#author-information)
31-
* [License](#license)
32-
33-
## Introduction
34-
35-
In this sample you'll find the instructions, and the code, necessary to deploy an AWS EKS
36-
cluster with an Amazon FSx for NetApp ONTAP File System (FSxN) to provide persistent storage
37-
for it. It will leverage NetApp's Astra Trident to provide the interface between EKS to FSxN.
38-
39-
## Prerequisites
40-
41-
A Unix based system with the following installed:
42-
- HashiCorp's Terraform
43-
- AWS CLI, authenticated with an account that has privileges necessary to:
44-
- Deploy an EKS cluster
45-
- Deploy an FSx for Netapp ONTAP File System
46-
- Create security groups
47-
- Create policies and roles
48-
- Create secrets in AWS SecretsManager
49-
- Create a VPC and subnets
50-
- Create a NAT Gateway
51-
- Create a Internet Gateway
52-
- Create an EC2 instance
53-
54-
## Installation Overview
55-
The overall process is as follows:
56-
- Ensure the prerequisites have been installed and configured.
57-
- Clone this repo from GitHub.
58-
- Make changes to the variables.tf file.
59-
- Run 'terraform init' to initialize the terraform environment.
60-
- Run 'terraform apply -auto-approve' to:
61-
- Create a new VPC with public and private subnets.
62-
- Deploy a FSx for NetApp ONTAP File System.
63-
- Create a secret in AWS SecretsManager to hold the FSxN password.
64-
- Deploy an EKS cluster.
65-
- Deploy an EC2 Linux based instance.
66-
- Create policies, roles and security groups to protect the new environment.
67-
- SSH to the Linux based instance to complete the setup:
68-
- Install the FSx for NetApp ONTAP Trident CSI driver.
69-
- Configure the Trident CSI driver.
70-
- Create a Kubernetes storage class.
71-
- Deploy a sample application to test the storage with.
72-
73-
## Detailed Instructions
74-
### Clone the "NetApp/FSx-ONTAP-samples-scripts" repo from GitHub
75-
Run the following commands to clone the repo and change into the directory where the
76-
terraform files are located:
77-
```bash
78-
git clone https://github.com/NetApp/FSx-ONTAP-samples-scripts.git
79-
cd FSx-ONTAP-samples-scripts/Solutions/FSxN-as-PVC-for-EKS/terraform
80-
```
81-
### Make any desired changes to the variables.tf file.
82-
Variables that can be changed include:
83-
- aws_region - The AWS region where you want to deploy the resources.
84-
- aws_secrets_region - The region where the fsx_password_secret will be created.
85-
- fsx_name - The name you want applied to the FSx for NetApp ONTAP File System. Must not already exist.
86-
- fsx_password_secret_name - A base name of the AWS SecretsManager secret that will hold the FSxN password.
87-
A random string will be appended to this name to ensure uniqueness.
88-
- fsx_throughput_capacity - The throughput capacity of the FSx for NetApp ONTAP File System.
89-
Read the "description" of the variable to see valid values.
90-
- fsx_storage_capacity - The storage capacity of the FSx for NetApp ONTAP File System.
91-
Read the "description" of the variable to see the valid range.
92-
- key_pair_name - The name of the EC2 key pair to use to access the jump server.
93-
**Note:** You must set this variable, otherwise the deployment will fail.
94-
- secure_ips - The IP address ranges to allow SSH access to the jump server. The default is wide open.
95-
96-
### Initialize the Terraform environment
97-
Run the following command to initialize the terraform environment.
98-
```bash
99-
terraform init
100-
```
101-
102-
### Deploy the resources
103-
Run the following command to deploy all the resources:
104-
```bash
105-
terraform apply --auto-approve
106-
```
107-
There will be a lot of output, and it will take 20 to 40 minutes to complete. Once done,
108-
the following is an example of last part of the output of a successful deployment:
109-
```bash
110-
Outputs:
111-
112-
eks-cluster-name = "fsx-eks-DB0H69vL"
113-
eks-jump-server = "Instance ID: i-0e99a61431a39d327, Public IP: 54.244.16.198"
114-
fsx-id = "fs-0887a493cXXXXXXXX"
115-
fsx-management-ip = "198.19.255.174"
116-
fsx-password-secret-arn = "arn:aws:secretsmanager:us-west-2:759995400000:secret:fsx-eks-secret-3b8bde97-Fst5rj"
117-
fsx-password-secret-name = "fsx-eks-secret-3b8bde97"
118-
fsx-svm-name = "ekssvm"
119-
region = "us-west-2"
120-
vpc-id = "vpc-03ed6b1867d76e1a9"
121-
```
122-
You will use the values in the commands below, so probably a good idea to copy the output somewhere
123-
so you can easily reference it later.
124-
125-
Note that an FSxN File System was created, with a vserver (a.k.a. SVM). The default username
126-
for the FSxN File System is 'fsxadmin'. And the default username for the vserver is 'vsadmin'. The
127-
password for both of these users is the same and is what is stored in the AWS SecretsManager secret
128-
shown above. Note that since Terraform was used to create the secret, the password is stored in
129-
plain text and therefore it is **HIGHLY** recommended that you change the password to something else
130-
by first changing the passwords via the AWS Management Console and then updating the password in
131-
the AWS SecretsManager secret. You can update the 'username' key in the secret if you want, but
132-
it must be a vserver admin user, not a system level user. This secret is used by Astra
133-
Trident and it will always login via the vserver management LIF and therefore it must be a
134-
vserver admin user. If you want to create a separate secret for the 'fsxadmin' user, feel free
135-
to do so.
136-
137-
### SSH to the jump server to complete the setup
138-
Use the following command to 'ssh' to the jump server:
139-
```bash
140-
ssh -i <path_to_key_pair> ubuntu@<jump_server_public_ip>
141-
```
142-
Where:
143-
- <path_to_key_pair> is the file path to where you have stored the key_pair that you
144-
referenced in the variables.tf file.
145-
- <jump_server_public_ip> is the IP address of the jump server that was displayed
146-
in the output from the `terraform apply` command.
147-
148-
### Configure the 'aws' CLI
149-
There are various ways to configure the AWS cli. If you are unsure how to do it, please
150-
refer to this the AWS documentation for instructions:
151-
[Configuring the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)
152-
153-
### Allow access to the EKS cluster for your user id
154-
AWS's EKS clusters have a secondary form for permissions. As such, you have to add an "access-entry"
155-
to your EKS configuration and associate it with the Cluster Admin policy to be able to view and
156-
configure the EKS cluster. The first step to do this is to find out your IAM ARN.
157-
You can do that via this command:
158-
```bash
159-
user_ARN=$(aws sts get-caller-identity --query Arn --output text)
160-
echo $user_ARN
161-
```
162-
Note that if you are using an SSO to authenticate with AWS, then the actual username
163-
you need to add is slightly different than what is output from the above command.
164-
The following command will take the output from the above command and format it correctly:
165-
166-
**ONLY RUN THIS COMMAND IF YOU ARE USING AN SSO TO AUTHENTICATE WITH AWS**
167-
```bash
168-
user_ARN=$(aws sts get-caller-identity | jq -r '.Arn' | awk -F: '{split($6, parts, "/"); printf "arn:aws:iam::%s:role/aws-reserved/sso.amazonaws.com/%s\n", $5, parts[2]}')
169-
echo $user_ARN
170-
```
171-
The above command will leverage a standard AWS role that is created when configuring AWS to use an SSO.
172-
173-
As you can see above, a variable named "user_ARN" was create to hold the your user's ARN. To make
174-
the next few commands easy, also create variables that hold the AWS region and EKS cluster name.
175-
```bash
176-
aws_region=<AWS_REGION>
177-
cluster_name=<EKS_CLUSTER_NAME>
178-
```
179-
Of course, replace <AWS_REGION> with the region where the resources were deployed. And replace
180-
<EKS_CLUSTER_NAME> with the name of your EKS cluster. Both of these values can be found
181-
from the output of the `terraform plan` command.
182-
183-
Once you have your variables set, add the EKS access-entry by running these commands:
184-
```bash
185-
aws eks create-access-entry --cluster-name $cluster_name --principal-arn $user_ARN --region $aws_region
186-
aws eks associate-access-policy --cluster-name $cluster_name --principal-arn $user_ARN --region $aws_region --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy --access-scope type=cluster
187-
```
188-
189-
### Configure kubectl to use the EKS cluster
190-
AWS makes it easy to configure 'kubectl' to use the EKS cluster. You can do that by running this command:
191-
```bash
192-
aws eks update-kubeconfig --name $cluster_name --region $aws_region
193-
```
194-
Of course the above assumes the cluster_name and aws_region variables are still set from
195-
running the commands above.
196-
197-
To confirm you can communicate with the EKS cluster run the following command:
198-
```bash
199-
kubectl get nodes
200-
```
201-
You should get output like this:
202-
```bash
203-
NAME STATUS ROLES AGE VERSION
204-
ip-10-0-1-84.us-west-2.compute.internal Ready <none> 76m v1.29.3-eks-ae9a62a
205-
ip-10-0-2-117.us-west-2.compute.internal Ready <none> 76m v1.29.3-eks-ae9a62a
206-
```
207-
208-
### Confirm Astra Trident is up and running
209-
Astra Trident should have been added to your EKS Cluster as part of the terraform deployment.
210-
Confirm that it is up and running by running this command:
211-
```bash
212-
kubectl get pods -n trident
213-
```
214-
The output should look something like this:
215-
```bash
216-
NAME READY STATUS RESTARTS AGE
217-
trident-controller-569f47fc59-hx2vn 6/6 Running 0 20h
218-
trident-node-linux-pgcw9 2/2 Running 0 20h
219-
trident-node-linux-zr8n7 2/2 Running 0 20h
220-
trident-operator-67d6fd899b-jrnt2 1/1 Running 0 20h
221-
```
222-
2231
### Configure the Trident CSI backend to use FSx for NetApp ONTAP
2242
For the example below we are going to set up an iSCSI LUN for a MySQL
2253
database. To help facilitate that, we are going to set up Astra Trident as a backend provider.
@@ -548,19 +326,3 @@ At this point you don't need the jump server created to configure the EKS enviro
548326
the FSxN File System, so feel free to `terminate` it (i.e. destroy it).
549327

550328
Other than that, you are welcome to deploy other applications that need persistent storage.
551-
552-
## Author Information
553-
554-
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).
555-
556-
## License
557-
558-
Licensed under the Apache License, Version 2.0 (the "License").
559-
560-
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
561-
562-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an _"AS IS"_ basis, without WARRANTIES or conditions of any kind, either express or implied.
563-
564-
See the License for the specific language governing permissions and limitations under the License.
565-
566-
© 2024 NetApp, Inc. All Rights Reserved.

Solutions/FSxN-as-PVC-for-EKS/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ Astra Trident has several different drivers to choose from. You can read more ab
228228
drivers it supports in the
229229
[Astra Trident documentation.](https://docs.netapp.com/us-en/trident/trident-use/trident-fsx.html#fsx-for-ontap-driver-details)
230230

231-
If you want to use an iSCSI LUN instead of an NFS file system, please refer to [these instructions](README-san.md#configure-the-trident-csi-backend-to-use-fsx-for-netapp-ontap).
231+
If you want to use an iSCSI LUN instead of an NFS file system, please refer to [these instructions](README-san.md).
232232

233233
In the commands below you're going to need the FSxN ID, the FSX SVM name, and the
234234
secret ARN. All of that information can be obtained from the output

0 commit comments

Comments
 (0)