|
| 1 | +# Single New EKS Cluster AWS Mixed Observability Accelerator |
| 2 | + |
| 3 | +## Architecture |
| 4 | + |
| 5 | +The following figure illustrates the architecture of the pattern we will be deploying for Single EKS Cluster Mixed Observability pattern using AWS native tools such as CloudWatch and X-Ray and Open Source tools such as Amazon Distro for OpenTelmetry(ADOT) and Prometheus Node Exporter. |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +This example makes use of CloudWatch as a metric and log aggregation layer while X-Ray is used as a trace-aggregation layer. In order to collect the metrics and traces we use the Open Source ADOT collector. Fluent Bit is used to export the logs to CloudWatch Logs. |
| 10 | + |
| 11 | +In this architecture AWS X-Ray provides a complete view of requests as they travel through your application and filters visual data across payloads, functions, traces, services, and APIs. X-Ray also allows you to perform analytics to gain powerful insights about your distributed trace data. |
| 12 | + |
| 13 | +Utilizing CloudWatch and X-Ray as an aggregation layer allows for a fully-managed scalable telemetry backend. In this example we get those benefits while still having the flexibility and rapid development of the Open Source collection tools. |
| 14 | + |
| 15 | +## Objective |
| 16 | + |
| 17 | +- Deploys one production grade Amazon EKS cluster. |
| 18 | +- AWS Distro For OpenTelemetry Operator and Collector configured to collect metrics and traces. |
| 19 | +- Logs with [AWS for FluentBit](https://github.com/aws/aws-for-fluent-bit) and CloudWatch Logs |
| 20 | +- Aggregate Metrics in CloudWatch |
| 21 | +- Aggregate Traces in X-Ray |
| 22 | + |
| 23 | +Ensure that you have installed the following tools on your machine. |
| 24 | + |
| 25 | +1. [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) |
| 26 | +2. [kubectl](https://Kubernetes.io/docs/tasks/tools/) |
| 27 | +3. [cdk](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install) |
| 28 | +4. [npm](https://docs.npmjs.com/cli/v8/commands/npm-install) |
| 29 | + |
| 30 | +## Deploying |
| 31 | + |
| 32 | +1. Clone your forked repository |
| 33 | + |
| 34 | +```sh |
| 35 | +git clone https://github.com/aws-observability/cdk-aws-observability-accelerator.git |
| 36 | +``` |
| 37 | + |
| 38 | +2. Install the AWS CDK Toolkit globally on your machine using |
| 39 | + |
| 40 | +```bash |
| 41 | +npm install -g aws-cdk |
| 42 | +``` |
| 43 | + |
| 44 | +3. Install project dependencies by running `npm install` in the main folder of this cloned repository |
| 45 | + |
| 46 | +4. Once all pre-requisites are set you are ready to deploy the pipeline. Run the following command from the root of this repository to deploy the pipeline stack: |
| 47 | + |
| 48 | +```bash |
| 49 | +make build |
| 50 | +make pattern single-new-eks-mixed-observability deploy |
| 51 | +``` |
| 52 | + |
| 53 | +## Verify the resources |
| 54 | + |
| 55 | +Run update-kubeconfig command. You should be able to get the command from CDK output message. |
| 56 | + |
| 57 | +```bash |
| 58 | +aws eks update-kubeconfig --name single-new-eks-mixed-observability-accelerator --region <your region> --role-arn arn:aws:iam::xxxxxxxxx:role/single-new-eks-opensource-singleneweksopensourceob-82N8N3BMJYYI |
| 59 | +``` |
| 60 | + |
| 61 | +Let’s verify the resources created by steps above. |
| 62 | + |
| 63 | +```bash |
| 64 | +kubectl get nodes -o wide |
| 65 | +``` |
| 66 | + |
| 67 | +Output: |
| 68 | + |
| 69 | +```console |
| 70 | +NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME |
| 71 | +ip-10-0-144-134.us-west-1.compute.internal Ready <none> 143m v1.25.9-eks-0a21954 10.0.144.134 <none> Amazon Linux 2 5.10.179-168.710.amzn2.x86_64 containerd://1.6.19 |
| 72 | +``` |
| 73 | + |
| 74 | +Next, lets verify the namespaces in the cluster: |
| 75 | + |
| 76 | +```bash |
| 77 | +kubectl get ns # Output shows all namespace |
| 78 | +``` |
| 79 | + |
| 80 | +Output: |
| 81 | + |
| 82 | +```console |
| 83 | +NAME STATUS AGE |
| 84 | +aws-for-fluent-bit Active 142m |
| 85 | +cert-manager Active 142m |
| 86 | +default Active 148m |
| 87 | +external-secrets Active 142m |
| 88 | +kube-node-lease Active 149m |
| 89 | +kube-public Active 149m |
| 90 | +kube-system Active 149m |
| 91 | +opentelemetry-operator-system Active 142m |
| 92 | +prometheus-node-exporter Active 142m |
| 93 | +``` |
| 94 | + |
| 95 | +## Visualization |
| 96 | + |
| 97 | +Navigate to CloudWatch and go to Metrics -> All Metrics. |
| 98 | + |
| 99 | +Select the metrics in the ContainerInsights/Prometheus Namespace: |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | +View the graph of the selected metrics: |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | +## Viewing Logs |
| 108 | + |
| 109 | +By default, we deploy a FluentBit daemon set in the cluster to collect worker logs for all namespaces. Logs are collected and exported to Amazon CloudWatch Logs, which enables you to centralize the logs from all of your systems, applications, |
| 110 | +and AWS services that you use, in a single, highly scalable service. |
| 111 | + |
| 112 | +## Using CloudWatch Logs Insights to Query Logs |
| 113 | + |
| 114 | +Navigate to CloudWatch, then go to "Logs Insights" |
| 115 | + |
| 116 | +In the dropdown, select any of the logs that begin with "/aws/eks/single-new-eks-mixed-observability-accelerator" and run a query. |
| 117 | + |
| 118 | +Example with "kubesystem" log group: |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | +Then you can view the results of your query: |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | +## Teardown |
| 127 | + |
| 128 | +You can teardown the whole CDK stack with the following command: |
| 129 | + |
| 130 | +```bash |
| 131 | +make pattern single-new-eks-mixed-observability destroy |
| 132 | +``` |
| 133 | + |
| 134 | + |
0 commit comments