Skip to content

Commit 9ac6feb

Browse files
Kalyan Reddy DaidaKalyan Reddy Daida
authored andcommitted
Welcome to Stack Simplify
1 parent dec049c commit 9ac6feb

File tree

6 files changed

+107
-1
lines changed

6 files changed

+107
-1
lines changed

14-Microservices-Canary-Deployments/kube-manifests/02-UserManagementMicroservice-Deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
command: ['sh', '-c', 'echo -e "Checking for the availability of MySQL Server deployment"; while ! nc -z mysql 3306; do sleep 1; printf "-"; done; echo -e " >> MySQL DB Server has started";']
2121
containers:
2222
- name: usermgmt-restapp
23-
image: stacksimplify/kube-usermanagement-microservice:3.0.0-AWS-XRay
23+
image: stacksimplify/kube-usermanagement-microservice:3.0.0-AWS-XRay-MySQLDB
2424
ports:
2525
- containerPort: 8095
2626
imagePullPolicy: Always
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Monitoring EKS using CloudWatch Container Insigths
2+
3+
## Step-01: Deploy our Sample to generate Load
4+
```
5+
# Deploy
6+
kubectl apply -f kube-manifests
7+
8+
# Access Application
9+
http://<Network-Load-Balancer-URL>/app1/index.html
10+
```
11+
12+
## Step-02: Associate CloudWatch Policy to our EKS Worker Nodes Role
13+
- Go to Services -> EC2 -> Worker Node EC2 Instance -> IAM Role -> Click on that role
14+
```
15+
# Sample Role ARN
16+
arn:aws:iam::180789647333:role/eksctl-eksdemo1-nodegroup-eksdemo-NodeInstanceRole-1FVWZ2H3TMQ2M
17+
18+
# Policy to be associated
19+
Associate Policy: CloudWatchAgentServerPolicy
20+
```
21+
22+
## Step-03: Install Container Insights
23+
24+
### Deploy CloudWatch Agent and Fluentd as DaemonSets
25+
- This command will
26+
- Create the Namespace amazon-cloudwatch.
27+
- Create all the necessary security objects for both DaemonSet:
28+
- SecurityAccount.
29+
- ClusterRole.
30+
- ClusterRoleBinding.
31+
- Deploy Cloudwatch-Agent (responsible for sending the metrics to CloudWatch) as a DaemonSet.
32+
- Deploy fluentd (responsible for sending the logs to Cloudwatch) as a DaemonSet.
33+
- Deploy ConfigMap configurations for both DaemonSets.
34+
```
35+
# Template
36+
curl -s https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/quickstart/cwagent-fluentd-quickstart.yaml | sed "s/{{cluster_name}}/<REPLACE_CLUSTER_NAME>/;s/{{region_name}}/<REPLACE-AWS_REGION>/" | kubectl apply -f -
37+
38+
# Replaced Cluster Name and Region
39+
curl -s https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/quickstart/cwagent-fluentd-quickstart.yaml | sed "s/{{cluster_name}}/eksdemo1/;s/{{region_name}}/us-east-1/" | kubectl apply -f -
40+
```
41+
42+
## Verify
43+
```
44+
kubectl -n amazon-cloudwatch get daemonsets
45+
```
46+
47+
48+
## Step-04: Access CloudWatch Dashboard & Generate Traffic using Postman Runner
49+
- Access CloudWatch Container Insigths Dashboard
50+
- Generate some traffic using Postman Runner
51+
52+
## Step-05: CloudWatch Log Insights
53+
- View Container logs
54+
55+
56+
## Step-06: CloudWatch Alarms from metrics
57+
- Create Alarms
58+
59+
60+
## Step-07: Clean-Up Container Insights
61+
```
62+
# Template
63+
curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/quickstart/cwagent-fluentd-quickstart.yaml | sed "s/{{cluster_name}}/cluster-name/;s/{{region_name}}/cluster-region/" | kubectl delete -f -
64+
65+
# Replace Cluster Name & Region Name
66+
curl https://raw.githubusercontent.com/aws-samples/amazon-cloudwatch-container-insights/latest/k8s-deployment-manifest-templates/deployment-mode/daemonset/container-insights-monitoring/quickstart/cwagent-fluentd-quickstart.yaml | sed "s/{{cluster_name}}/eksdemo1/;s/{{region_name}}/us-east-1/" | kubectl delete -f -
67+
```
68+
69+
## References
70+
- https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/deploy-container-insights-EKS.html
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app1-nginx-deployment
5+
labels:
6+
app: app1-nginx
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: app1-nginx
12+
template:
13+
metadata:
14+
labels:
15+
app: app1-nginx
16+
spec:
17+
containers:
18+
- name: app1-nginx
19+
image: stacksimplify/kube-nginxapp1:1.0.0
20+
ports:
21+
- containerPort: 80
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: nlb-app1-nginx
5+
labels:
6+
app: app1-nginx
7+
annotations:
8+
service.beta.kubernetes.io/aws-load-balancer-type: nlb # To create Network Load Balancer
9+
spec:
10+
type: LoadBalancer # Default - CLB
11+
selector:
12+
app: app1-nginx
13+
ports:
14+
- port: 80
15+
targetPort: 80
Binary file not shown.
-165 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)