Skip to content

Commit b6dac4b

Browse files
author
charlyF
committed
adding screenshots and details of the hpa simulation section
1 parent f468f9d commit b6dac4b

File tree

6 files changed

+55
-16
lines changed

6 files changed

+55
-16
lines changed

02-path-working-with-clusters/207-cluster-monitoring-with-datadog/readme.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ image::logmonitor.png[]
8787

8888
The goal of this workshop is to set up a full stack application on AWS EKS and see how each layer of the stack can be monitored with the Datadog Agent.
8989

90-
Start by taking a look at the link:../201-cluster-monitoring/templates/datadog/agent.yaml[manifest to run the Datadog Agent].
90+
Start by taking a look at the link:../207-cluster-monitoring-with-datadog/templates/datadog/agent.yaml[manifest to run the Datadog Agent].
9191
Insert a Datadog API Key that can be found in your https://app.datadoghq.com/account/settings#api[Datadog account] in the `value: <DD_API_KEY>` placeholder.
9292

9393
Then from the current directory, just run:

02-path-working-with-clusters/207-cluster-monitoring-with-datadog/templates/nginx/nginx.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
apiVersion: extensions/v1beta1
2-
kind: DaemonSet
1+
apiVersion: apps/v1beta1
2+
kind: Deployment
33
metadata:
44
name: nginx
55
spec:
6+
replicas: 1
67
template: # create pods using pod definition in this template
78
metadata:
89
annotations:

03-path-application-development/305-app-scaling-custom-metrics/readme.adoc

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Autoscaling over External Metrics does not require the Node Agent to be running,
2424
Nevertheless, for this walkthrough, we autoscale an NGINX Deployment based off of NGINX metrics, collected by a Node Agent.
2525

2626
Before proceeding, please make sure you went through the section 207 of this workshop.
27-
This entails tat you have Node Agents running with the Autodiscovery process enabled and functional.
27+
This entails that you have Node Agents running with the Autodiscovery process enabled and functional.
2828

29-
In order to autoscale in Kubernetes, you need to register a Custom Metrics Server - The Datadog Cluster Agent implements this feature.
29+
In order to autoscale in Kubernetes, you need to register a Custom/External Metrics Server - The Datadog Cluster Agent implements this feature.
3030

3131
=== Spinning up the Datadog Cluster Agent
3232

@@ -40,7 +40,7 @@ clusterrolebinding.rbac.authorization.k8s.io "dca" created
4040
serviceaccount "dca" created
4141
```
4242

43-
Add your <API_KEY> and <APP_KEY> in the link:../305-app-scaling-custom-metrics/templates/cluster-agent/cluster-agent.yaml[Deployment manifest of the Datadog Cluster Agent].
43+
Add your <API_KEY> and <APP_KEY> in the link:../305-app-scaling-custom-metrics/templates/cluster-agent.yaml[Deployment manifest of the Datadog Cluster Agent].
4444
Then enable the HPA Processing by setting the `DD_EXTERNAL_METRICS_PROVIDER_ENABLED` variable to true.
4545
Finally, spin up the resources:
4646

@@ -82,6 +82,29 @@ clusterrole.rbac.authorization.k8s.io "external-metrics-reader" created
8282
clusterrolebinding.rbac.authorization.k8s.io "external-metrics-reader" created
8383
```
8484

85+
You can confirm that the cluster agent is properly registered as an External Metrics Provider by running:
86+
87+
```
88+
kubectl describe apiservice v1beta1.external.metrics.k8s.io
89+
[...]
90+
91+
Service:
92+
Name: datadog-custom-metrics-server
93+
Namespace: default
94+
Version: v1beta1
95+
Version Priority: 100
96+
97+
[...]
98+
99+
Status:
100+
Conditions:
101+
Last Transition Time: 2018-09-28T16:19:34Z
102+
Message: all checks passed
103+
Reason: Passed
104+
Status: True
105+
Type: Available
106+
```
107+
85108
Once you have the Datadog Cluster Agent running and the service registered, create an HPA manifest.
86109
The Datadog Cluster Agent will subsequently parse the manifest and pull metrics from Datadog.
87110

@@ -111,14 +134,21 @@ We will be relying on the nginx deployment used in the section 207 of this works
111134
Make sure that everything is still running:
112135

113136
```
114-
kubectl get deploy, po -lapp=nginx
137+
kubectl get deploy,po -lrole=nginx
138+
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
139+
deployment.extensions/nginx 1 1 1 1 2h
115140

116-
```
141+
NAME READY STATUS RESTARTS AGE
142+
pod/nginx-69cb46b4db-6bbml 1/1 Running 0 2h
117143

144+
```
118145

119146
Then, apply the HPA manifest.
120147

148+
```
121149
kubectl apply -f templates/cluster-agent/hpa-example/hpa-manifest.yaml
150+
horizontalpodautoscaler.autoscaling "nginxext" created
151+
```
122152

123153
You should be seeing your nginx pod running with the corresponding service:
124154

@@ -128,30 +158,38 @@ default nginx-6757dd8769-5xzp2 1/1 Running 0 3m
128158
```
129159
Services:
130160
```
131-
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
132-
default nginx ClusterIP 192.168.251.36 none 8090/TCP 3m
161+
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
162+
default nginx ClusterIP 192.168.251.36 none 8090/TCP 3m
133163
```
134164
Horizontal Pod Autoscalers:
135165
```
136-
NAMESPACE NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
137-
default nginxext Deployment/nginx 0/9 (avg) 1 3 1 3m
166+
NAMESPACE NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
167+
default nginxext Deployment/nginx 0/50 (avg) 1 3 1 3m
138168
```
139169

140170
=== Stressing your service
141171

142172
At this point, the set up is ready to be stressed. As a result of the stress Kubernetes will autoscale the NGINX pods.
143173

144-
TODO
174+
To do so, you can use the interface of the application spun up during the step 207.
175+
For instance, you can trigger a cache stress, which will also stress the NGINX service by simulating requests.
145176

177+
image::caching-demo.png[]
146178

147179
Looking into your application, you should be able to correlate the requests per second on your NGINX boxes with the autoscaling event and the creation of new replicas.
148180

149181
image::autoscalingdash.png[]
150182

151-
== Cleanup
183+
In the above screenshot, we triggered 2 simulations, one at 12.30 and another one at 12.45.
184+
You can see that as a result of the stress, an additional replica is spun up serving the requests.
185+
The average request per second falls at ~27 request.
186+
Finally, after a cooling down period, we downscale.
152187

153-
$ kubectl delete -f templates/
188+
== Cleanup
154189

190+
```
191+
$ kubectl delete -f templates
192+
```
155193

156194
You are now ready to continue on with the workshop!
157195

03-path-application-development/305-app-scaling-custom-metrics/templates/hpa-manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ spec:
1616
metricSelector:
1717
matchLabels:
1818
kube_container_name: nginx
19-
targetAverageValue: 9
19+
targetAverageValue: 50

resources/images/autoscalingdash.png

488 KB
Loading

resources/images/caching-demo.png

143 KB
Loading

0 commit comments

Comments
 (0)