Skip to content

Commit 50f81b6

Browse files
authored
Merge pull request #43 from aws-observability/41-new-pattern-for-single-new-eks-cluster
Single New Eks Cluster
2 parents c5987c5 + 24ed4b3 commit 50f81b6

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

bin/single-new-eks-cluster.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { configureApp } from '../lib/common/construct-utils';
2+
import SingleNewEksConstruct from '../lib/single-new-eks-cluster-construct';
3+
4+
const app = configureApp();
5+
6+
new SingleNewEksConstruct(app, 'single-new-eks');
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Single New EKS Cluster Observability Accelerator
2+
3+
## Objective
4+
5+
This pattern deploys one production grade Amazon EKS cluster, without any Observability add-on.
6+
7+
## Prerequisites:
8+
9+
Ensure that you have installed the following tools on your machine.
10+
11+
1. [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
12+
2. [kubectl](https://Kubernetes.io/docs/tasks/tools/)
13+
3. [cdk](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install)
14+
4. [npm](https://docs.npmjs.com/cli/v8/commands/npm-install)
15+
16+
## Deploying
17+
18+
1. Clone your forked repository
19+
20+
```sh
21+
git clone https://github.com/aws-observability/cdk-aws-observability-accelerator.git
22+
```
23+
24+
2. Install the AWS CDK Toolkit globally on your machine using
25+
26+
```bash
27+
npm install -g aws-cdk
28+
```
29+
30+
3. Install project dependencies by running `npm install` in the main folder of this cloned repository
31+
32+
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:
33+
34+
```bash
35+
make build
36+
make pattern single-new-eks-cluster deploy
37+
```
38+
39+
## Verify the resources
40+
41+
Run update-kubeconfig command. You should be able to get the command from CDK output message.
42+
43+
```bash
44+
aws eks update-kubeconfig --name single-new-eks-observability-accelerator --region <your region> --role-arn arn:aws:iam::xxxxxxxxx:role/single-new-eks-observabil-singleneweksobservabilit-5NW0A5AUXVS9
45+
```
46+
47+
Let’s verify the resources created by steps above.
48+
49+
```bash
50+
kubectl get nodes -o wide
51+
```
52+
Output:
53+
54+
```console
55+
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
56+
ip-10-0-157-151.eu-central-1.compute.internal Ready <none> 9m19s v1.25.9-eks-0a21954 10.0.157.151 <none> Amazon Linux 2 5.10.179-168.710.amzn2.x86_64 containerd://1.6.19
57+
```
58+
59+
Next, lets verify the namespaces in the cluster:
60+
61+
```bash
62+
kubectl get ns # Output shows all namespace
63+
```
64+
65+
Output:
66+
67+
```console
68+
NAME STATUS AGE
69+
cert-manager Active 7m8s
70+
default Active 13m
71+
external-secrets Active 7m9s
72+
kube-node-lease Active 13m
73+
kube-public Active 13m
74+
kube-system Active 13m
75+
prometheus-node-exporter Active 7m9s
76+
```
77+
78+
## Teardown
79+
80+
You can teardown the whole CDK stack with the following command:
81+
82+
```bash
83+
make pattern single-new-eks-cluster destroy
84+
```
85+
86+
aws
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Construct } from 'constructs';
2+
import * as blueprints from '@aws-quickstart/eks-blueprints';
3+
import { ObservabilityBuilder } from '../common/observability-builder';
4+
5+
export default class SingleNewEksConstruct {
6+
constructor(scope: Construct, id: string) {
7+
const stackId = `${id}-observability-accelerator`;
8+
9+
const account = process.env.COA_ACCOUNT_ID! || process.env.CDK_DEFAULT_ACCOUNT!;
10+
const region = process.env.COA_AWS_REGION! || process.env.CDK_DEFAULT_REGION!;
11+
12+
const addOns: Array<blueprints.ClusterAddOn> = [
13+
new blueprints.addons.KubeProxyAddOn(),
14+
];
15+
16+
ObservabilityBuilder.builder()
17+
.account(account)
18+
.region(region)
19+
.addOns(...addOns)
20+
.build(scope, stackId);
21+
}
22+
}

0 commit comments

Comments
 (0)