33This subfolder contains a Helm chart to install [ NetApp Harvest] ( https://github.com/NetApp/harvest/blob/main/README.md )
44into an AWS EKS cluster to monitor multiple FSx for ONTAP file systems using the
55Grafana + Prometheus stack. It uses the AWS Secrets Manager to obtain
6- credentials for the FSxN file systems so those credentials aren't insecurely stored.
6+ credentials for echo of the FSxN file systems so those credentials aren't insecurely stored.
77
88## Introduction
99
1010### What to expect
1111
1212Harvest Helm chart installation will result the following:
1313* Install the latest version of NetApp Harvest on to your EKS cluster.
14- * Each FSxN cluster will represent as Kubernetes pod on the cluster.
14+ * Each FSxN cluster will have its own Harvest poller in the EKS cluster.
1515* Collecting metrics about your FSxNs and adding existing Grafana dashboards for better visualization.
1616
1717### Integration with AWS Secrets Manager
18- This Harvest installation uses the AWS Secrets Manager to obtain the credentials for the FSxN file systems.
18+ This Harvest installation uses the AWS Secrets Manager to obtain the credentials for the echo of FSxN file systems.
1919The format of the secret string should to be a json structure with a ` username ` and ` password ` keys. For example:
2020``` json
2121{
2222 "username" : " fsxadmin" ,
2323 "password" : " fsxadmin-password"
2424}
2525```
26- A ServiceAccount should be created during the installation with the sufficient permissions to fetch the secrets.
26+ A service account should be created during the installation with the sufficient permissions to fetch the secrets.
2727
2828### Prerequisites
2929* ` Helm ` - for resources installation.
30+ * ` kubectl ` - for managing Kubernetes resources.
31+ * ` eksctl ` - for creating and managing EKS clusters.
3032* An FSx for ONTAP file system deployed in the same VPC as the EKS cluster.
31- * Existing ` Secrets Manager ` secret in the same region as the FSxN file system.
3233
3334## Deployment
3435
@@ -45,8 +46,8 @@ helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack --
4546 --set prometheus.prometheusSpec.storageSpec.volumeClaimTemplate.spec.storageClassName=< FSX-BASIC-NAS>
4647```
4748Where:
48- * \< FSX-BASIC-NAS\> is the storage class you want to use. If you don't care about persistent storage, you can omit the
49- last two lines from the above command.
49+ * \< FSX-BASIC-NAS\> is the storage class you want to use to store the data collected from the FSxN file systems.
50+ If you don't care about persistent storage, you can omit the last two lines from the above command.
5051
5152The above will create a 50Gib PVC for Prometheus to use. You can adjust the size as needed.
5253
@@ -83,10 +84,23 @@ kube-prometheus-stack-prometheus-node-exporter-ffckd 1/1 Running 0
8384prometheus-kube-prometheus-stack-prometheus-0 2/2 Running 0 50s
8485```
8586
86- ### Specify which FSxNs to monitor
87+ ### Deployment of the Harvest Helm chart
88+
89+ #### 1. Download the Harvest Helm chart
90+ Download the Harvest helm chart by copying the contents of the 'harvest' directory found in this repo. Put the contents in an empty directory.
91+
92+ The custom Helm chart includes:
93+ * ` deplyment.yaml ` - Harvest deployment using Harvest latest version image
94+ * ` harvest-config.yaml ` - Harvest backend configuration
95+ * ` harvest-cm.yaml ` - Environment variables configuration for credentials script.
96+ * ` service-monitor.yaml ` - Prometheus ServiceMonitor for collecting Harvest metrics.
97+
98+ :memo : ** NOTE** You should not have to modify these files.
99+
100+ #### 2. Specify which FSxNs to monitor
87101
88102The Helm chart supports monitoring multiple FSxNs. You can add multiples FSxNs by editing the ` values.yaml ` file
89- and updating the ` clusters ` section. For example:
103+ and updating the ` clusters ` section. The following is an example with two FSxNs.
90104```
91105fsxs:
92106 clusters:
@@ -103,29 +117,30 @@ fsxs:
103117```
104118Of course replace the strings within the <> with your own values.
105119
106- ** NOTE:** Each FSxN cluster should have unique port number for promPort.
120+ : memo : ** NOTE:** Each FSxN cluster should have unique port number for promPort.
107121
108- ### Deployment of the Harvest Helm chart
109- Download the Harvest helm chart from this GitHub repository found in the 'harvest' directory. The custom Helm chart includes:
110- * ` deplyment.yaml ` - Harvest deployment using Harvest latest version image
111- * ` harvest-config.yaml ` - Harvest backend configuration
112- * ` harvest-cm.yaml ` - Environment variables configuration for credentails script.
113- * ` service-monitor.yaml ` - Promethues ServiceMonitor for collecting Harvest metrics.
122+ #### 3. Create a namespace
114123
115- 1 . ** Create AWS Secrets Manager for FSxN credentials**
124+ If you don't already have a namespace where you want to deploy Harvest, you can create one using the following command:
125+ ```
126+ kubectl create ns <NAMESPACE>
127+ ```
128+
129+ #### 4. Create AWS Secrets Manager for FSxN credentials
116130If you don't already have an AWS Secrets Manager secret with your FSxN credentials, you can create one using the AWS CLI.
117131```
118- aws secretsmanager create-secret \
119- --region <REGION> \
120- --name <SECRET_NAME> \
132+ aws secretsmanager create-secret --region <REGION> --name <SECRET_NAME> \
121133 --secret-string '{"USERNAME":"fsxadmin", "PASSWORD":"<YOUR_FSX_PASSWORD>"}'
122134```
135+ Replace ` <YOUR_FSX_PASSWORD> ` with the actual password for the ` fsxadmin ` user on your FSxN file system.
123136
124- 2 . ** Create ServiceAccount with permissions to AWS Secrets Manager**
125-
126- ** Create Policy with permissions to AWS secretsmanager:**
137+ #### 5. Create Service Account with permissions to read the AWS Secrets Manager secrets
127138
128- The following IAM policy can be used to grant the all permissions required by Harvest to fetch the secrets:
139+ ##### 5a. Create Policy
140+ The following IAM policy can be used to grant the all permissions required by Harvest to fetch the secrets.
141+ Note in this example, it has places to put two AWS Secrets Manager ARNs. You should add all the secret ARNs
142+ for all the FSxN you plan to monitor. Typically on per FSxN, but it is okay to use the same secret for multiple
143+ FSxNs as long as the credentials are the same.
129144
130145```
131146{
@@ -149,37 +164,54 @@ The following IAM policy can be used to grant the all permissions required by Ha
149164Of course replace the strings within the <> with your own values.
150165
151166You can use the following command to create the policy:
152-
167+ ``` bash
153168POLICY_ARN=$( aws iam create-policy --policy-name harvest_read_secrets --policy-document file://harvest-read-secrets-policy.json --query Policy.Arn --output text)
154-
155- Note that this creates a variable named ` POLICY_ARN ` that you will use in the next step.
156-
157- ** Create ServiceAccount** :
158-
159- ** Note** : If you don't already have a namespace where you want to deploy Harvest, you can create one using the following command:
160- ```
161- kubectl create ns <NAMESPACE>
162169```
170+ Note that this sets a variable named ` POLICY_ARN ` to the ARN of the policy that is created.
171+ It is done this way to make it easy to pass that policy ARN when you create the service account in the next step.
163172
164- To create the ServiceAccount, run the following command:
173+ ##### 5b. Create ServiceAccount
174+ The following command will create a role, associated with the policy created above, and an Kubernettes service account that Harvest will run under:
165175```
166176eksctl create iamserviceaccount --name harvest-sa --region=<REGION> --namespace <NAMESPACE> --role-name harvest-role --cluster <YOUR_CLUSTER_NAME> --attach-policy-arn "$POLICY_ARN" --approve
167177```
178+ Of course replace the strings within the <> with your own values.
168179
169- 3 . ** Install Harvest helm chart**
180+ #### 6. Install Harvest helm chart
181+ Once you have update the values.yaml file, created the namespace, created the AWS Secrets Manager secrets,
182+ and created the service account with permissions to read the secrets, you are ready to install the Harvest Helm chart.
170183``` text
171184helm upgrade --install harvest -f values.yaml ./ --namespace=<NAMESPACE> --set promethues=<your_promethues_release_name>
172185```
186+ Where ` <NAMESPACE> ` is the name of the namespace you created or are using for Harvest and ` <your_promethues_release_name> `
187+ is the name of your Prometheus release (e.g. ` kube-prometheus-stack ` if you followed the previous steps).
173188
174- Once the deployment is complete, Harvest should be listed as a target on Prometheus.
189+ Once the deployment is complete, Harvest should be listed as a target on Prometheus. You can check that by running
190+ the following command:
191+ ``` bash
192+ kubectl port-forward -n prometheus prometheus-kube-prometheus-stack-prometheus-0 9090 &
193+ curl -s http://localhost:9090/api/v1/targets | jq -r ' .data.activeTargets[] | select(.labels.service[0:14] == "harvest-poller") | "\(.labels.service) Status = \(.health)"'
194+ ```
195+ It should list a status of 'up' for each of the FSxN clusters you are monitoring. For example:
196+ ```
197+ $ curl -s http://localhost:9090/api/v1/targets | jq -r '.data.activeTargets[] | select(.labels.service[0:14] == "harvest-poller") | "\(.labels.service) Status = \(.health)"'
198+ Handling connection for 9090
199+ harvest-poller-dr Status = up
200+ harvest-poller-prod Status = up
201+ ```
202+ You might have to give it a minute before getting an 'up' status.
203+
204+ Once you have obtain the status, you don't need the "kubctl port-forward" command running anymore. You can stop it by running:
205+ ``` bash
206+ kill %? 9090
207+ ```
175208
176- ### Import FSxN CloudWatch metrics into your monitoring stack using YACE
177- AWS provides FSx for ONTAP metrics which cannot be collected by Harvest. Therefore, we recommend to
178- use yet-another-exporter (by Prometheus community) for collecting metrics from CloudWatch .
209+ #### Import FSxN CloudWatch metrics into your monitoring stack using YACE
210+ AWS CloudWatch provides metrics for the FSx for ONTAP file systems which cannot be collected by Harvest.
211+ Therefore, we recommend to use yet-another-exporter (by Prometheus community) for collecting these metrics .
179212See [ YACE] ( https://github.com/nerdswords/helm-charts ) for more information.
180213
181- #### Installation ####
182- 1 . ** Create ServiceAccount with permissions to AWS CloudWatch**
214+ ##### 1. Create ServiceAccount with permissions to AWS CloudWatch
183215The following IAM policy can be used to grant the all permissions required by yet-another-exporter to fetch the CloudWatch metrics:
184216
185217```
@@ -213,32 +245,33 @@ The following IAM policy can be used to grant the all permissions required by ye
213245Run the following command in order to create the policy:
214246
215247POLICY_ARN=$(aws iam create-policy --policy-name yace-exporter-policy --policy-document file://yace-exporter-policy.json --query Policy.Arn --output text)
248+ Note that this sets a variable named ` POLICY_ARN ` to the ARN of the policy that is created.
249+ It is done this way to make it easy to pass that policy ARN when you create the service account in the next step.
216250
217- 2 . ** Create ServiceAccount** :
251+ ##### 2. Create ServiceAccount
252+ The following command will create a role associated with the policy created above, and a Kubernetes service account that YACE will run under:
218253
219- ** note** : namespace should be already exists if not exist use the following command:
220- ```
221- kubectl create ns <NAMESPACE>
222- ```
223- ```
254+ ``` bash
224255eksctl create iamserviceaccount --name yace-exporter-sa --region=< REGION> --namespace < NAMESPACE> --role-name yace-cloudwatch-exporter-role --cluster < YOUR_CLUSTER_NAME> --attach-policy-arn " $POLICY_ARN " --approve
225256```
257+ Of course replace the strings within the <> with your own values.
226258
227- 3 . ** Install yace-exporter helm chart**
259+ ##### 3. Install yace-exporter helm chart
260+ First add the nerdswords Helm repository to your local Helm client. This repository contains the YACE exporter chart.
228261
229- ``` text
262+ ``` bash
230263helm repo add nerdswords https://nerdswords.github.io/helm-charts
231264```
232-
233- Change the prometheus release name for ServiceMonitor creation in the yace-override-values.yaml file:
265+ Edit the yace-override-values.yaml file by changing the prometheus release name for ServiceMonitor section:
234266```
235267serviceMonitor:
236268 enabled: true
237269 labels:
238270 release: <Prometheus_Name>
239271```
272+ If you installed Prometheus using the previous steps, the release name will be ` kube-prometheus-stack ` .
240273
241- Also apply the region name to FSxN's region in yace-override-values.yaml :
274+ Also update the region name, in both places, to FSxN's region:
242275```
243276 apiVersion: v1alpha1
244277 sts-region: <Region_Name>
@@ -266,14 +299,69 @@ Also apply the region name to FSxN's region in yace-override-values.yaml:
266299 statistics: [Average]
267300```
268301
269- Run the following command to install the yace-exporter helm chart:
302+ Finally, run the following command to install the yace-exporter helm chart:
270303``` text
271304helm install yace-cw-exporter --namespace <NAMESPACE> nerdswords/yet-another-cloudwatch-exporter -f yace-override-values.yaml
272305```
273306
307+ ### Accessing Grafana
308+ If you newly installed the Prometheus stack, that includes Grafana, you will need to provide a way of accessing it from the Kubernetes cluster.
309+ One way to do that is to setup a "port-forward" from your local machine using the following command:
310+
311+ ``` bash
312+ kubectl --namespace prometheus port-forward svc/kube-prometheus-stack-grafana 3000:80 --address 0.0.0.0/0 &
313+ ```
314+
315+ This is okay for a test, but this method is not persistent and would force everyone to go through your local machine to access the Grafana dashboards.
316+ To allow for more permanent access to Grafana, you should consider setting up an LoadBalancer service.
317+ That can easily be done by running:
318+ ``` bash
319+ kubectl expose deployment kube-prometheus-stack-grafana --port=80 --target-port=3000 --name=load-balancer-service --type=LoadBalancer
320+ ```
321+
322+ This will create a AWS Elastic Load Balancer (ELB) in front of the Grafana service, which will allow you to access Grafana via the ELB's DNS name.
323+ To get the DNS name, you can run the following command:
324+ ``` bash
325+ kubectl get svc load-balancer-service --namespace prometheus
326+ ```
327+ The output should be similar to this:
328+ ``` bash
329+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
330+ load-balancer-service LoadBalancer 172.20.85.44 ab130084a571d4e59afeabafb0477037-1196442078.us-west-2.elb.amazonaws.com 80:30611/TCP 56m
331+ ```
332+ The ` EXTERNAL-IP ` column will show the DNS name of the ELB that was created. You can use this DNS name to access Grafana from your web browser.
333+ Once you have access to Grafana, you can log in using the default credentials:
334+ * ** Username:** ` admin `
335+ * ** Password:** ` prom-operator `
336+
274337### Adding Grafana dashboards and visualize your FSxN metrics on Grafana
275- Import existing dashboards into your Grafana:
276- * [ How to import Grafana dashboards] ( https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/import-dashboards/ )
277- * Example dashboards for Grafana are located in the dashboards folder
278- #### Note
279- fsxadmin user does not have a full permission to collect all metrics by default.
338+ Once you login, you'll want to import some dashboards to visualize the metrics collected by Harvest and YACE. You will find
339+ some example dashboards in the ` dashboards ` folder in this repository. You can import these dashboards into Grafana by following these steps:
340+ 1 . Log in to your Grafana instance.
341+ 2 . Click on the "+" icon on the left-hand side menu and select "Import".
342+ 3 . In the "Import via file" section, click on "Upload .json file" and select one of the dashboard JSON files from the ` dashboards ` folder in this repository.
343+ 4 . Once the file is uploaded, Grafana will show a preview of the dashboard. You can change the dashboard name if you want.
344+ 5 . Click on the "Import" button to import the dashboard.
345+ 6 . After importing the dashboard, you can view it by clicking on the dashboard name in the left-hand side menu.
346+ 7 . You can repeat the above steps for each of the dashboard JSON files you want to import.
347+
348+ You can also import the "default" dashboards from the Harvest repo found [ here] ( https://github.com/NetApp/harvest/tree/main/grafana/dashboards ) .
349+ Only consider the dashboards in the 'cmode' and 'cmode-details' directories.
350+ :memo : ** NOTE:** Since the special 'fsxadmin' account doesn't have access to all the metrics that a traditional 'admin' account would have,
351+ some of the metrics and dashboards may not be fully applicable or available. The ones with 'fsx' tag are more relevant for FSxN.
352+
353+ ## Author Information
354+
355+ This repository is maintained by the contributors listed on [ GitHub] ( https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors ) .
356+
357+ ## License
358+
359+ Licensed under the Apache License, Version 2.0 (the "License").
360+
361+ You may obtain a copy of the License at [ apache.org/licenses/LICENSE-2.0] ( http://www.apache.org/licenses/LICENSE-2.0 ) .
362+
363+ 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.
364+
365+ See the License for the specific language governing permissions and limitations under the License.
366+
367+ © 2024 NetApp, Inc. All Rights Reserved.
0 commit comments