Skip to content

Commit

Permalink
Welcome to Stack Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalyan Reddy Daida authored and Kalyan Reddy Daida committed Jul 17, 2020
1 parent dec049c commit 9ac6feb
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
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";']
containers:
- name: usermgmt-restapp
image: stacksimplify/kube-usermanagement-microservice:3.0.0-AWS-XRay
image: stacksimplify/kube-usermanagement-microservice:3.0.0-AWS-XRay-MySQLDB
ports:
- containerPort: 8095
imagePullPolicy: Always
Expand Down
70 changes: 70 additions & 0 deletions 18-EKS-Monitoring-using-CloudWatch-Container-Insights/README.md
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
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
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 modified presentation/AWS-Fargate-and-EKS-Masterclass.pptx
Binary file not shown.
Binary file removed presentation/~$AWS-Fargate-and-EKS-Masterclass.pptx
Binary file not shown.

0 comments on commit 9ac6feb

Please sign in to comment.