Skip to content

Commit 1ceecb3

Browse files
dms486preddy727
andauthored
Add EKS Istio Dashboards (#194)
* Update readme * checking in new readme example * new istio readme * Updated mkdocs.yml * checking in readme files * checking in all changes * Test * Test * Test * Testing * Testing * test * Update main.tf * Update outputs.tf * Adding Istio dashboards * Updating URL's * Removing dashboards * Updates from pre-commit * Update istio.md * Removing empty file * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update README.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update istio.md * Update README.md * Update README.md * Istio Documentation Updates Added istioctl prereq, updated dashboards image * Updated setup and cleanup of Istio Bookinfo Updated Istio Bookinfo sample app instructions, included clean up of Bookinfo resources * Updating image and removing advanced configuration -Switching image to Github generated link -Removing advanced configuration section --------- Co-authored-by: Prithvi Reddy <[email protected]> Co-authored-by: Prithvi Reddy <[email protected]>
1 parent 7f60bd7 commit 1ceecb3

File tree

18 files changed

+904
-0
lines changed

18 files changed

+904
-0
lines changed

docs/eks/istio.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Monitor Istio running on Amazon EKS
2+
3+
This example demonstrates how to use Terraform modules for AWS Observability Accelerator, EKS Blueprints with the Tetrate Istio Add-on and EKS monitoring for Istio.
4+
5+
The current example deploys the [AWS Distro for OpenTelemetry Operator](https://docs.aws.amazon.com/eks/latest/userguide/opentelemetry.html)
6+
for Amazon EKS with its requirements and make use of an existing Amazon Managed Grafana workspace.
7+
It creates a new Amazon Managed Service for Prometheus workspace unless provided with an existing one to reuse.
8+
9+
It uses the `EKS monitoring` [module](../../modules/eks-monitoring/)
10+
to provide an existing EKS cluster with an OpenTelemetry collector,
11+
curated Grafana dashboards, Prometheus alerting and recording rules with multiple
12+
configuration options for Istio.
13+
14+
## Prerequisites
15+
16+
Ensure that you have the following tools installed locally:
17+
18+
1. [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
19+
2. [kubectl](https://kubernetes.io/docs/tasks/tools/)
20+
3. [terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)
21+
4. [istioctl](https://istio.io/latest/docs/setup/getting-started/#download)
22+
23+
## Setup
24+
25+
This example uses a local terraform state. If you need states to be saved remotely,
26+
on Amazon S3 for example, visit the [terraform remote states](https://www.terraform.io/language/state/remote) documentation
27+
28+
### 1. Clone the repo using the command below
29+
30+
```
31+
git clone https://github.com/aws-observability/terraform-aws-observability-accelerator.git
32+
```
33+
34+
### 2. Initialize terraform
35+
36+
```console
37+
cd examples/eks-istio
38+
terraform init
39+
```
40+
41+
### 3. Amazon EKS Cluster
42+
43+
To run this example, you need to provide your EKS cluster name.
44+
If you don't have a cluster ready, visit [this example](https://aws-observability.github.io/terraform-aws-observability-accelerator/helpers/new-eks-cluster/)
45+
first to create a new one.
46+
47+
Add your cluster name for `eks_cluster_id="..."` to the `terraform.tfvars` or use an environment variable `export TF_VAR_eks_cluster_id=xxx`.
48+
49+
### 4. Amazon Managed Grafana workspace
50+
51+
To run this example you need an Amazon Managed Grafana workspace. If you have
52+
an existing workspace, create an environment variable
53+
`export TF_VAR_managed_grafana_workspace_id=g-xxx`.
54+
55+
To create a new one, visit [this example](https://aws-observability.github.io/terraform-aws-observability-accelerator/helpers/managed-grafana/).
56+
57+
> In the URL `https://g-xyz.grafana-workspace.eu-central-1.amazonaws.com`, the workspace ID would be `g-xyz`
58+
59+
### 5. <a name="apikey"></a> Grafana API Key
60+
61+
Amazon Managed Service for Grafana provides a control plane API for generating Grafana API keys. We will provide to Terraform
62+
a short lived API key to run the `apply` or `destroy` command.
63+
Ensure you have necessary IAM permissions (`CreateWorkspaceApiKey, DeleteWorkspaceApiKey`)
64+
65+
```sh
66+
export TF_VAR_grafana_api_key=`aws grafana create-workspace-api-key --key-name "observability-accelerator-$(date +%s)" --key-role ADMIN --seconds-to-live 1200 --workspace-id $TF_VAR_managed_grafana_workspace_id --query key --output text`
67+
```
68+
69+
## Deploy
70+
71+
Simply run this command to deploy (if using a variable definition file)
72+
73+
```sh
74+
terraform apply -var-file=terraform.tfvars
75+
```
76+
77+
or if you had setup environment variables, run
78+
79+
```sh
80+
terraform apply
81+
```
82+
83+
## Additional configuration
84+
85+
For the purpose of the example, we have provided default values for some of the variables.
86+
87+
1. AWS Region
88+
89+
Specify the AWS Region where the resources will be deployed. Edit the `terraform.tfvars` file and modify `aws_region="..."`. You can also use environement variables `export TF_VAR_aws_region=xxx`.
90+
91+
92+
2. Amazon Managed Service for Prometheus workspace
93+
94+
If you have an existing workspace, add `managed_prometheus_workspace_id=ws-xxx`
95+
or use an environment variable `export TF_VAR_managed_prometheus_workspace_id=ws-xxx`.
96+
97+
## Visualization
98+
99+
### 1. Grafana dashboards
100+
101+
Go to the Dashboards panel of your Grafana workspace. You will see a list of Istio dashboards under the `Observability Accelerator Dashboards`
102+
103+
<img width="1208" alt="image" src="https://github.com/aws-observability/terraform-aws-observability-accelerator/assets/34757337/19b589b4-00f6-465d-a562-1da39e8b9b8c">
104+
105+
Open one of the Istio dasbhoards and you will be able to view its visualization
106+
107+
<img width="1850" alt="image" src="https://user-images.githubusercontent.com/47993564/236842708-72225322-4f97-44cc-aac0-40a3356e50c6.jpeg">
108+
109+
### 2. Amazon Managed Service for Prometheus rules and alerts
110+
111+
Open the Amazon Managed Service for Prometheus console and view the details of your workspace. Under the `Rules management` tab, you will find new rules deployed.
112+
113+
<img width="1054" alt="image" src="https://user-images.githubusercontent.com/47993564/236844084-80c754e3-4fe1-45bb-8361-181432675469.jpeg">
114+
115+
!!! note
116+
To setup your alert receiver, with Amazon SNS, follow [this documentation](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alertmanager-receiver.html)
117+
118+
## Deploy an example application to visualize metrics
119+
120+
In this section we will deploy Istio's Bookinfo sample application and extract metrics using the AWS OpenTelemetry collector. When downloading and configuring `istioctl`, there are samples included in the Istio package directory. The deployment files for Bookinfo are found in the `samples` folder. Additional details can be found on Istio's [Getting Started](https://istio.io/latest/docs/setup/getting-started/) documentation
121+
122+
### 1. Deploy the Bookinfo Application
123+
124+
1. Using the AWS CLI, configure kubectl so you can connect to your EKS cluster. Update for your region and EKS cluster name
125+
```sh
126+
aws eks update-kubeconfig --region <enter-your-region> --name <cluster-name>
127+
```
128+
2. Label the default namespace for automatic Istio sidecar injection
129+
```sh
130+
kubectl label namespace default istio-injection=enabled
131+
```
132+
3. Navigate to the Istio folder location. For example, if using Istio v1.18.2 in Downloads folder:
133+
```sh
134+
cd ~/Downloads/istio-1.18.2
135+
```
136+
4. Deploy the Bookinfo sample application
137+
```sh
138+
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
139+
```
140+
5. Connect the Bookinfo application with the Istio gateway
141+
```sh
142+
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
143+
```
144+
6. Validate that there are no issues with the Istio configuration
145+
```sh
146+
istioctl analyze
147+
```
148+
7. Get the DNS name of the load balancer for the Istio gateway
149+
```sh
150+
GATEWAY_URL=$(kubectl get svc istio-ingressgateway -n istio-system -o=jsonpath='{.status.loadBalancer.ingress[0].hostname}')
151+
```
152+
153+
### 2. Generate traffic for the Istio Bookinfo sample application
154+
155+
For the Bookinfo sample application, visit `http://$GATEWAY_URL/productpage` in your web browser. To see trace data, you must send requests to your service. The number of requests depends on Istio’s sampling rate and can be configured using the Telemetry API. With the default sampling rate of 1%, you need to send at least 100 requests before the first trace is visible. To send a 100 requests to the productpage service, use the following command:
156+
```sh
157+
for i in $(seq 1 100); do curl -s -o /dev/null "http://$GATEWAY_URL/productpage"; done
158+
```
159+
160+
### 3. Explore the Istio dashboards
161+
162+
Log back into your Amazon Managed Grafana workspace and navigate to the dashboard side panel. Click on the `Observability Accelerator Dashboards` folder and open the `Istio Service` Dashboard. Use the Service dropdown menu to select the `reviews.default.svc.cluster.local` service. This gives details about metrics for the service, client workloads (workloads that are calling this service), and service workloads (workloads that are providing this service).
163+
164+
Explore the Istio Control Plane, Mesh, and Performance dashboards as well.
165+
166+
## Destroy
167+
168+
To teardown and remove the resources created in this example:
169+
170+
```sh
171+
kubectl delete -f samples/bookinfo/networking/bookinfo-gateway.yaml
172+
kubectl delete -f samples/bookinfo/platform/kube/bookinfo.yaml
173+
terraform destroy
174+
```

examples/eks-istio/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Existing Cluster with the AWS Observability accelerator base module, Tetrate Istio Add-on and Istio monitoring
2+
3+
View the full documentation for this example [here](https://aws-observability.github.io/terraform-aws-observability-accelerator/eks/istio)
4+
5+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6+
## Requirements
7+
8+
| Name | Version |
9+
|------|---------|
10+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.1.0 |
11+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0.0 |
12+
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 2.4.1 |
13+
| <a name="requirement_kubectl"></a> [kubectl](#requirement\_kubectl) | >= 1.14 |
14+
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.10 |
15+
16+
## Providers
17+
18+
| Name | Version |
19+
|------|---------|
20+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0.0 |
21+
22+
## Modules
23+
24+
| Name | Source | Version |
25+
|------|--------|---------|
26+
| <a name="module_aws_observability_accelerator"></a> [aws\_observability\_accelerator](#module\_aws\_observability\_accelerator) | ../../ | n/a |
27+
| <a name="module_eks_blueprints_kubernetes_addons"></a> [eks\_blueprints\_kubernetes\_addons](#module\_eks\_blueprints\_kubernetes\_addons) | github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons | v4.32.0 |
28+
| <a name="module_eks_monitoring"></a> [eks\_monitoring](#module\_eks\_monitoring) | ../../modules/eks-monitoring | n/a |
29+
30+
## Resources
31+
32+
| Name | Type |
33+
|------|------|
34+
| [aws_eks_cluster.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source |
35+
| [aws_eks_cluster_auth.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster_auth) | data source |
36+
37+
## Inputs
38+
39+
| Name | Description | Type | Default | Required |
40+
|------|-------------|------|---------|:--------:|
41+
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS Region | `string` | n/a | yes |
42+
| <a name="input_eks_cluster_id"></a> [eks\_cluster\_id](#input\_eks\_cluster\_id) | Name of the EKS cluster | `string` | `"eks-cluster-with-vpc"` | no |
43+
| <a name="input_enable_dashboards"></a> [enable\_dashboards](#input\_enable\_dashboards) | Enables or disables curated dashboards. Dashboards are managed by the Grafana Operator | `bool` | `true` | no |
44+
| <a name="input_grafana_api_key"></a> [grafana\_api\_key](#input\_grafana\_api\_key) | API key for authorizing the Grafana provider to make changes to Amazon Managed Grafana | `string` | n/a | yes |
45+
| <a name="input_managed_grafana_workspace_id"></a> [managed\_grafana\_workspace\_id](#input\_managed\_grafana\_workspace\_id) | Amazon Managed Grafana Workspace ID | `string` | n/a | yes |
46+
| <a name="input_managed_prometheus_workspace_id"></a> [managed\_prometheus\_workspace\_id](#input\_managed\_prometheus\_workspace\_id) | Amazon Managed Service for Prometheus Workspace ID | `string` | `""` | no |
47+
48+
## Outputs
49+
50+
| Name | Description |
51+
|------|-------------|
52+
| <a name="output_aws_region"></a> [aws\_region](#output\_aws\_region) | AWS Region |
53+
| <a name="output_eks_cluster_id"></a> [eks\_cluster\_id](#output\_eks\_cluster\_id) | EKS Cluster Id |
54+
| <a name="output_eks_cluster_version"></a> [eks\_cluster\_version](#output\_eks\_cluster\_version) | EKS Cluster version |
55+
| <a name="output_managed_prometheus_workspace_endpoint"></a> [managed\_prometheus\_workspace\_endpoint](#output\_managed\_prometheus\_workspace\_endpoint) | Amazon Managed Prometheus workspace endpoint |
56+
| <a name="output_managed_prometheus_workspace_id"></a> [managed\_prometheus\_workspace\_id](#output\_managed\_prometheus\_workspace\_id) | Amazon Managed Prometheus workspace ID |
57+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/eks-istio/main.tf

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
provider "aws" {
2+
region = local.region
3+
}
4+
5+
data "aws_eks_cluster_auth" "this" {
6+
name = var.eks_cluster_id
7+
}
8+
9+
data "aws_eks_cluster" "this" {
10+
name = var.eks_cluster_id
11+
}
12+
13+
provider "kubernetes" {
14+
host = local.eks_cluster_endpoint
15+
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data)
16+
token = data.aws_eks_cluster_auth.this.token
17+
}
18+
19+
provider "helm" {
20+
kubernetes {
21+
host = local.eks_cluster_endpoint
22+
cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data)
23+
token = data.aws_eks_cluster_auth.this.token
24+
}
25+
}
26+
27+
locals {
28+
region = var.aws_region
29+
eks_cluster_endpoint = data.aws_eks_cluster.this.endpoint
30+
create_new_workspace = var.managed_prometheus_workspace_id == "" ? true : false
31+
tags = {
32+
Source = "github.com/aws-observability/terraform-aws-observability-accelerator"
33+
}
34+
}
35+
36+
# deploys the base module
37+
module "aws_observability_accelerator" {
38+
source = "../../"
39+
# source = "github.com/aws-observability/terraform-aws-observability-accelerator?ref=v2.0.0"
40+
41+
aws_region = var.aws_region
42+
43+
# creates a new Amazon Managed Prometheus workspace, defaults to true
44+
enable_managed_prometheus = local.create_new_workspace
45+
46+
# reusing existing Amazon Managed Prometheus if specified
47+
managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
48+
49+
# sets up the Amazon Managed Prometheus alert manager at the workspace level
50+
enable_alertmanager = true
51+
52+
# reusing existing Amazon Managed Grafana workspace
53+
managed_grafana_workspace_id = var.managed_grafana_workspace_id
54+
55+
tags = local.tags
56+
}
57+
58+
module "eks_blueprints_kubernetes_addons" {
59+
source = "github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons?ref=v4.32.0"
60+
61+
eks_cluster_id = var.eks_cluster_id
62+
#eks_cluster_endpoint = module.eks_blueprints.eks_cluster_endpoint
63+
#eks_oidc_provider = module.eks_blueprints.oidc_provider
64+
#eks_cluster_version = module.eks_blueprints.eks_cluster_version
65+
66+
# EKS Managed Add-ons
67+
#enable_amazon_eks_vpc_cni = true
68+
#enable_amazon_eks_coredns = true
69+
#enable_amazon_eks_kube_proxy = true
70+
71+
# Add-ons
72+
enable_metrics_server = true
73+
enable_cluster_autoscaler = true
74+
75+
# Tetrate Istio Add-on
76+
enable_tetrate_istio = true
77+
78+
tags = local.tags
79+
}
80+
81+
module "eks_monitoring" {
82+
source = "../../modules/eks-monitoring"
83+
# source = "github.com/aws-observability/terraform-aws-observability-accelerator//modules/eks-monitoring?ref=v2.0.0"
84+
enable_istio = true
85+
eks_cluster_id = var.eks_cluster_id
86+
87+
# deploys AWS Distro for OpenTelemetry operator into the cluster
88+
enable_amazon_eks_adot = true
89+
90+
# reusing existing certificate manager? defaults to true
91+
enable_cert_manager = true
92+
93+
# deploys external-secrets in to the cluster
94+
enable_external_secrets = true
95+
grafana_api_key = var.grafana_api_key
96+
target_secret_name = "grafana-admin-credentials"
97+
target_secret_namespace = "grafana-operator"
98+
grafana_url = module.aws_observability_accelerator.managed_grafana_workspace_endpoint
99+
100+
# control the publishing of dashboards by specifying the boolean value for the variable 'enable_dashboards', default is 'true'
101+
enable_dashboards = var.enable_dashboards
102+
103+
managed_prometheus_workspace_id = module.aws_observability_accelerator.managed_prometheus_workspace_id
104+
105+
managed_prometheus_workspace_endpoint = module.aws_observability_accelerator.managed_prometheus_workspace_endpoint
106+
managed_prometheus_workspace_region = module.aws_observability_accelerator.managed_prometheus_workspace_region
107+
108+
# optional, defaults to 60s interval and 15s timeout
109+
prometheus_config = {
110+
global_scrape_interval = "60s"
111+
global_scrape_timeout = "15s"
112+
}
113+
114+
enable_logs = true
115+
116+
tags = local.tags
117+
118+
depends_on = [
119+
module.aws_observability_accelerator
120+
]
121+
}

examples/eks-istio/outputs.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
output "aws_region" {
2+
description = "AWS Region"
3+
value = module.aws_observability_accelerator.aws_region
4+
}
5+
6+
output "managed_prometheus_workspace_endpoint" {
7+
description = "Amazon Managed Prometheus workspace endpoint"
8+
value = module.aws_observability_accelerator.managed_prometheus_workspace_endpoint
9+
}
10+
11+
output "managed_prometheus_workspace_id" {
12+
description = "Amazon Managed Prometheus workspace ID"
13+
value = module.aws_observability_accelerator.managed_prometheus_workspace_id
14+
}
15+
16+
output "eks_cluster_version" {
17+
description = "EKS Cluster version"
18+
value = module.eks_monitoring.eks_cluster_version
19+
}
20+
21+
output "eks_cluster_id" {
22+
description = "EKS Cluster Id"
23+
value = module.eks_monitoring.eks_cluster_id
24+
}

0 commit comments

Comments
 (0)