-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pattern for apiserver monitoring (#111)
* Pattern for apiserver monitoring * Fixing Lint issues * Adding Doc for existing open source pattern with apiserver monitoring. * Fixed suggested changes in the PR
- Loading branch information
1 parent
f79939f
commit c68b509
Showing
14 changed files
with
536 additions
and
7 deletions.
There are no files selected for viewing
162 changes: 162 additions & 0 deletions
162
...existing-eks-observability-accelerators/existing-eks-apiserver-observability.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
# Existing EKS Cluster Observability Accelerator - API Server Monitoring | ||
|
||
## Objective | ||
|
||
This pattern aims to add Observability on top of an existing EKS cluster and adds API server monitoring, with open source managed AWS services. | ||
|
||
## Prerequisites: | ||
|
||
Ensure that you have installed the following tools on your machine: | ||
|
||
1. [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) | ||
2. [kubectl](https://Kubernetes.io/docs/tasks/tools/) | ||
3. [cdk](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install) | ||
4. [npm](https://docs.npmjs.com/cli/v8/commands/npm-install) | ||
|
||
You will also need: | ||
|
||
1. Either an existing EKS cluster, or you can setup a new one with [Single New EKS Cluster Observability Accelerator](../single-new-eks-observability-accelerators/single-new-eks-cluster.md) | ||
2. An OpenID Connect (OIDC) provider, associated to the above EKS cluster (Note: Single EKS Cluster Pattern takes care of that for you) | ||
|
||
## Deploying | ||
|
||
1. Edit `~/.cdk.json` by setting the name of your existing cluster: | ||
|
||
```json | ||
"context": { | ||
... | ||
"existing.cluster.name": "...", | ||
... | ||
} | ||
``` | ||
|
||
2. Edit `~/.cdk.json` by setting the kubectl role name; if you used Single New EKS Cluster Observability Accelerator to setup your cluster, the kubectl role name would be provided by the output of the deployment, on your command-line interface (CLI): | ||
|
||
```json | ||
"context": { | ||
... | ||
"existing.kubectl.rolename":"...", | ||
... | ||
} | ||
``` | ||
|
||
3. Amazon Managed Grafana workspace: To visualize metrics collected, you need an Amazon Managed Grafana workspace. If you have an existing workspace, create an environment variable as described below. To create a new workspace, visit [our supporting example for Grafana](https://aws-observability.github.io/terraform-aws-observability-accelerator/helpers/managed-grafana/) | ||
|
||
!!! note | ||
For the URL `https://g-xyz.grafana-workspace.us-east-1.amazonaws.com`, the workspace ID would be `g-xyz` | ||
|
||
```bash | ||
export AWS_REGION=<YOUR AWS REGION> | ||
export COA_AMG_WORKSPACE_ID=g-xxx | ||
export COA_AMG_ENDPOINT_URL=https://g-xyz.grafana-workspace.us-east-1.amazonaws.com | ||
``` | ||
|
||
!!! warning | ||
Setting up environment variables `COA_AMG_ENDPOINT_URL` and `AWS_REGION` is mandatory for successful execution of this pattern. | ||
|
||
4. GRAFANA API KEY: Amazon Managed Grafana provides a control plane API for generating Grafana API keys. | ||
|
||
```bash | ||
export AMG_API_KEY=$(aws grafana create-workspace-api-key \ | ||
--key-name "grafana-operator-key" \ | ||
--key-role "ADMIN" \ | ||
--seconds-to-live 432000 \ | ||
--workspace-id $COA_AMG_WORKSPACE_ID \ | ||
--query key \ | ||
--output text) | ||
``` | ||
|
||
5. AWS SSM Parameter Store for GRAFANA API KEY: Update the Grafana API key secret in AWS SSM Parameter Store using the above new Grafana API key. This will be referenced by Grafana Operator deployment of our solution to access Amazon Managed Grafana from Amazon EKS Cluster | ||
|
||
```bash | ||
aws ssm put-parameter --name "/cdk-accelerator/grafana-api-key" \ | ||
--type "SecureString" \ | ||
--value $AMG_API_KEY \ | ||
--region $AWS_REGION | ||
``` | ||
|
||
6. Install project dependencies by running `npm install` in the main folder of this cloned repository. | ||
|
||
7. The actual settings for dashboard urls are expected to be specified in the CDK context. Generically it is inside the cdk.json file of the current directory or in `~/.cdk.json` in your home directory. | ||
|
||
Example settings: Update the context in `cdk.json` file located in `cdk-eks-blueprints-patterns` directory | ||
|
||
```typescript | ||
"context": { | ||
"fluxRepository": { | ||
"name": "grafana-dashboards", | ||
"namespace": "grafana-operator", | ||
"repository": { | ||
"repoUrl": "https://github.com/aws-observability/aws-observability-accelerator", | ||
"name": "grafana-dashboards", | ||
"targetRevision": "main", | ||
"path": "./artifacts/grafana-operator-manifests/eks/infrastructure" | ||
}, | ||
"values": { | ||
"GRAFANA_CLUSTER_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/cluster.json", | ||
"GRAFANA_KUBELET_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/kubelet.json", | ||
"GRAFANA_NSWRKLDS_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/namespace-workloads.json", | ||
"GRAFANA_NODEEXP_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/nodeexporter-nodes.json", | ||
"GRAFANA_NODES_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/nodes.json", | ||
"GRAFANA_WORKLOADS_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/workloads.json", | ||
"GRAFANA_WORKLOADS_API_BASIC_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/apiserver/apiserver-basic.json", | ||
"GRAFANA_WORKLOADS_API_ADVANCED_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/apiserver/apiserver-advanced.json", | ||
"GRAFANA_WORKLOADS_API_TROUBLESHOOTING_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/apiserver/apiserver-troubleshooting.json" | ||
}, | ||
"kustomizations": [ | ||
{ | ||
"kustomizationPath": "./artifacts/grafana-operator-manifests/eks/infrastructure" | ||
}, | ||
{ | ||
"kustomizationPath": "./artifacts/grafana-operator-manifests/eks/apiserver" | ||
} | ||
] | ||
}, | ||
"apiserver.pattern.enabled": true | ||
} | ||
``` | ||
|
||
8. 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: | ||
|
||
```bash | ||
make build | ||
make pattern existing-eks-opensource-observability deploy | ||
``` | ||
|
||
|
||
## Visualization | ||
|
||
Login to your Grafana workspace and navigate to the Dashboards panel. You should see three new dashboard named `Kubernetes/Kube-apiserver (basic), Kubernetes/Kube-apiserver (advanced), Kubernetes/Kube-apiserver (troubleshooting)`, under `Observability Accelerator Dashboards`: | ||
|
||
![Dashboard](../images/all-dashboards-apiserver.png) | ||
|
||
Open the `Kubernetes/Kube-apiserver (basic)` dashboard and you should be able to view its visualization as shown below: | ||
|
||
![NodeExporter_Dashboard](../images/apiserver-basic.png) | ||
|
||
Open the `Kubernetes/Kube-apiserver (advanced)` dashboard and you should be able to view its visualization as shown below: | ||
|
||
![NodeExporter_Dashboard](../images/apiserver-advanced.png) | ||
|
||
Open the `Kubernetes/Kube-apiserver (troubleshooting)` dashboard and you should be able to view its visualization as shown below: | ||
|
||
![NodeExporter_Dashboard](../images/apiserver-troubleshooting.png) | ||
|
||
|
||
## Verify the resources | ||
|
||
Please see [Single New Nginx Observability Accelerator](../single-new-eks-observability-accelerators/single-new-eks-nginx-opensource-observability.md). | ||
|
||
## Teardown | ||
|
||
You can teardown the whole CDK stack with the following command: | ||
|
||
```bash | ||
make pattern existing-eks-opensource-observability destroy | ||
``` | ||
|
||
If you setup your cluster with Single New EKS Cluster Observability Accelerator, you also need to run: | ||
|
||
```bash | ||
make pattern single-new-eks-cluster destroy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions
79
...observability-accelerators/single-new-eks-apiserver-opensource-observability.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Single New EKS Cluster Open Source Observability Accelerator - API Server monitoring | ||
|
||
## Objective | ||
|
||
This pattern demonstrates how to use the _New EKS Cluster Open Source Observability Accelerator_ with API Server monitoring. | ||
|
||
## Prerequisites | ||
|
||
Ensure that you have installed the following tools on your machine. | ||
|
||
1. [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) | ||
2. [kubectl](https://Kubernetes.io/docs/tasks/tools/) | ||
3. [cdk](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install) | ||
4. [npm](https://docs.npmjs.com/cli/v8/commands/npm-install) | ||
|
||
## Deploying | ||
|
||
Please follow the _Deploying_ instructions of the [New EKS Cluster Open Source Observability Accelerator](./single-new-eks-opensource-observability.md) pattern, except for step 7, where you need to replace "context" in `~/.cdk.json` with the following: | ||
|
||
```typescript | ||
"context": { | ||
"fluxRepository": { | ||
"name": "grafana-dashboards", | ||
"namespace": "grafana-operator", | ||
"repository": { | ||
"repoUrl": "https://github.com/aws-observability/aws-observability-accelerator", | ||
"name": "grafana-dashboards", | ||
"targetRevision": "main", | ||
"path": "./artifacts/grafana-operator-manifests/eks/infrastructure" | ||
}, | ||
"values": { | ||
"GRAFANA_CLUSTER_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/cluster.json", | ||
"GRAFANA_KUBELET_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/kubelet.json", | ||
"GRAFANA_NSWRKLDS_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/namespace-workloads.json", | ||
"GRAFANA_NODEEXP_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/nodeexporter-nodes.json", | ||
"GRAFANA_NODES_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/nodes.json", | ||
"GRAFANA_WORKLOADS_DASH_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/infrastructure/workloads.json", | ||
"GRAFANA_WORKLOADS_API_BASIC_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/apiserver/apiserver-basic.json", | ||
"GRAFANA_WORKLOADS_API_ADVANCED_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/apiserver/apiserver-advanced.json", | ||
"GRAFANA_WORKLOADS_API_TROUBLESHOOTING_URL" : "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/main/artifacts/grafana-dashboards/eks/apiserver/apiserver-troubleshooting.json" | ||
}, | ||
"kustomizations": [ | ||
{ | ||
"kustomizationPath": "./artifacts/grafana-operator-manifests/eks/infrastructure" | ||
}, | ||
{ | ||
"kustomizationPath": "./artifacts/grafana-operator-manifests/eks/apiserver" | ||
} | ||
] | ||
}, | ||
"apiserver.pattern.enabled": true, | ||
} | ||
``` | ||
|
||
## Visualization | ||
|
||
Login to your Grafana workspace and navigate to the Dashboards panel. You should see three new dashboard named `Kubernetes/Kube-apiserver (basic), Kubernetes/Kube-apiserver (advanced), Kubernetes/Kube-apiserver (troubleshooting)`, under `Observability Accelerator Dashboards`: | ||
|
||
![Dashboard](../images/all-dashboards-apiserver.png) | ||
|
||
Open the `Kubernetes/Kube-apiserver (basic)` dashboard and you should be able to view its visualization as shown below: | ||
|
||
![NodeExporter_Dashboard](../images/apiserver-basic.png) | ||
|
||
Open the `Kubernetes/Kube-apiserver (advanced)` dashboard and you should be able to view its visualization as shown below: | ||
|
||
![NodeExporter_Dashboard](../images/apiserver-advanced.png) | ||
|
||
Open the `Kubernetes/Kube-apiserver (troubleshooting)` dashboard and you should be able to view its visualization as shown below: | ||
|
||
![NodeExporter_Dashboard](../images/apiserver-troubleshooting.png) | ||
|
||
## Teardown | ||
|
||
You can teardown the whole CDK stack with the following command: | ||
|
||
```bash | ||
make pattern single-new-eks-opensource-observability destroy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.