forked from stacksimplify/aws-eks-kubernetes-masterclass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kalyan Reddy Daida
authored and
Kalyan Reddy Daida
committed
Jul 17, 2020
1 parent
dec049c
commit 9ac6feb
Showing
6 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
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
70 changes: 70 additions & 0 deletions
70
18-EKS-Monitoring-using-CloudWatch-Container-Insights/README.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,70 @@ | ||
# Monitoring EKS using CloudWatch Container Insigths | ||
|
||
## Step-01: Deploy our Sample to generate Load | ||
``` | ||
# Deploy | ||
kubectl apply -f kube-manifests | ||
# Access Application | ||
http://<Network-Load-Balancer-URL>/app1/index.html | ||
``` | ||
|
||
## Step-02: Associate CloudWatch Policy to our EKS Worker Nodes Role | ||
- Go to Services -> EC2 -> Worker Node EC2 Instance -> IAM Role -> Click on that role | ||
``` | ||
# Sample Role ARN | ||
arn:aws:iam::180789647333:role/eksctl-eksdemo1-nodegroup-eksdemo-NodeInstanceRole-1FVWZ2H3TMQ2M | ||
# Policy to be associated | ||
Associate Policy: CloudWatchAgentServerPolicy | ||
``` | ||
|
||
## Step-03: Install Container Insights | ||
|
||
### Deploy CloudWatch Agent and Fluentd as DaemonSets | ||
- This command will | ||
- Create the Namespace amazon-cloudwatch. | ||
- Create all the necessary security objects for both DaemonSet: | ||
- SecurityAccount. | ||
- ClusterRole. | ||
- ClusterRoleBinding. | ||
- Deploy Cloudwatch-Agent (responsible for sending the metrics to CloudWatch) as a DaemonSet. | ||
- Deploy fluentd (responsible for sending the logs to Cloudwatch) as a DaemonSet. | ||
- Deploy ConfigMap configurations for both DaemonSets. | ||
``` | ||
# Template | ||
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 - | ||
# Replaced Cluster Name and Region | ||
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 - | ||
``` | ||
|
||
## Verify | ||
``` | ||
kubectl -n amazon-cloudwatch get daemonsets | ||
``` | ||
|
||
|
||
## Step-04: Access CloudWatch Dashboard & Generate Traffic using Postman Runner | ||
- Access CloudWatch Container Insigths Dashboard | ||
- Generate some traffic using Postman Runner | ||
|
||
## Step-05: CloudWatch Log Insights | ||
- View Container logs | ||
|
||
|
||
## Step-06: CloudWatch Alarms from metrics | ||
- Create Alarms | ||
|
||
|
||
## Step-07: Clean-Up Container Insights | ||
``` | ||
# Template | ||
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 - | ||
# Replace Cluster Name & Region Name | ||
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 - | ||
``` | ||
|
||
## References | ||
- https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/deploy-container-insights-EKS.html |
21 changes: 21 additions & 0 deletions
21
...onitoring-using-CloudWatch-Container-Insights/kube-manifests/01-Nginx-App1-Deployment.yml
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,21 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: app1-nginx-deployment | ||
labels: | ||
app: app1-nginx | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: app1-nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: app1-nginx | ||
spec: | ||
containers: | ||
- name: app1-nginx | ||
image: stacksimplify/kube-nginxapp1:1.0.0 | ||
ports: | ||
- containerPort: 80 |
15 changes: 15 additions & 0 deletions
15
...-Monitoring-using-CloudWatch-Container-Insights/kube-manifests/02-NetworkLoadBalancer.yml
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,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: nlb-app1-nginx | ||
labels: | ||
app: app1-nginx | ||
annotations: | ||
service.beta.kubernetes.io/aws-load-balancer-type: nlb # To create Network Load Balancer | ||
spec: | ||
type: LoadBalancer # Default - CLB | ||
selector: | ||
app: app1-nginx | ||
ports: | ||
- port: 80 | ||
targetPort: 80 |
Binary file not shown.
Binary file not shown.