Skip to content

Commit 00feeb4

Browse files
authoredDec 6, 2023
docs: add user guide for EnvoyProxy HPA (#2271)
* docs: add user guide to customize envoyproxy hpa Signed-off-by: Ardika Bagus <me@ardikabs.com> * chore: fix format Signed-off-by: Ardika Bagus <me@ardikabs.com> --------- Signed-off-by: Ardika Bagus <me@ardikabs.com>
1 parent d1c19dc commit 00feeb4

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed
 

‎api/v1alpha1/shared_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ const (
277277
StringMatchRegularExpression StringMatchType = "RegularExpression"
278278
)
279279

280-
// KubernetesHorizontalPodAutoscalerSpec defines Kubernetes Horizontal Pod Autoscaler settings of Envoy Proxy Deployment
281-
// See k8s.io.autoscaling.v2.HorizontalPodAutoScalerSpec
280+
// KubernetesHorizontalPodAutoscalerSpec defines Kubernetes Horizontal Pod Autoscaler settings of Envoy Proxy Deployment.
281+
// See k8s.io.autoscaling.v2.HorizontalPodAutoScalerSpec.
282282
type KubernetesHorizontalPodAutoscalerSpec struct {
283283
// minReplicas is the lower limit for the number of replicas to which the autoscaler
284284
// can scale down. It defaults to 1 replica.

‎site/content/en/latest/api/extension_types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ _Appears in:_
981981

982982

983983

984-
KubernetesHorizontalPodAutoscalerSpec defines Kubernetes Horizontal Pod Autoscaler settings of Envoy Proxy Deployment See k8s.io.autoscaling.v2.HorizontalPodAutoScalerSpec
984+
KubernetesHorizontalPodAutoscalerSpec defines Kubernetes Horizontal Pod Autoscaler settings of Envoy Proxy Deployment. See k8s.io.autoscaling.v2.HorizontalPodAutoScalerSpec.
985985

986986
_Appears in:_
987987
- [EnvoyProxyKubernetesProvider](#envoyproxykubernetesprovider)

‎site/content/en/latest/user/customize-envoyproxy.md

+36-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ EOF
135135

136136
## Customize EnvoyProxy Deployment Env
137137

138-
You can customize the EnvoyProxy Deployment Env via EnvoyProxy Config like:
138+
You can customize the EnvoyProxy Deployment Env via EnvoyProxy Config like:
139139

140140
```shell
141141
cat <<EOF | kubectl apply -f -
@@ -187,7 +187,7 @@ spec:
187187
volumes:
188188
- name: certs
189189
secret:
190-
secretName: envoy-cert
190+
secretName: envoy-cert
191191
EOF
192192
```
193193

@@ -220,7 +220,7 @@ After applying the config, you can get the envoyproxy service, and see annotatio
220220

221221
## Customize EnvoyProxy Bootstrap Config
222222

223-
You can customize the EnvoyProxy bootstrap config via EnvoyProxy Config.
223+
You can customize the EnvoyProxy bootstrap config via EnvoyProxy Config.
224224
There are two ways to customize it:
225225

226226
* Replace: the whole bootstrap config will be replaced by the config you provided.
@@ -317,6 +317,38 @@ After applying the config, the bootstrap config will be overridden by the new co
317317
Any errors in the configuration will be surfaced as status within the `GatewayClass` resource.
318318
You can also validate this configuration using [egctl translate][].
319319

320+
## Customize EnvoyProxy Horizontal Pod Autoscaler
321+
322+
You can enable [Horizontal Pod Autoscaler](https://github.com/envoyproxy/gateway/issues/703) for EnvoyProxy Deployment. However, before enabling the HPA for EnvoyProxy, please ensure that the [metrics-server](https://github.com/kubernetes-sigs/metrics-server) component is installed in the cluster.
323+
324+
Once confirmed, you can apply it via EnvoyProxy Config as shown below:
325+
326+
```shell
327+
cat <<EOF | kubectl apply -f -
328+
apiVersion: gateway.envoyproxy.io/v1alpha1
329+
kind: EnvoyProxy
330+
metadata:
331+
name: custom-proxy-config
332+
namespace: envoy-gateway-system
333+
spec:
334+
provider:
335+
type: Kubernetes
336+
kubernetes:
337+
envoyHpa:
338+
minReplicas: 2
339+
maxReplicas: 10
340+
metrics:
341+
- resource:
342+
name: cpu
343+
target:
344+
averageUtilization: 60
345+
type: Utilization
346+
type: Resource
347+
EOF
348+
```
349+
350+
After applying the config, the EnvoyProxy HPA (Horizontal Pod Autoscaler) is generated. However, upon activating the EnvoyProxy's HPA, the Envoy Gateway will no longer reference the `replicas` field specified in the `envoyDeployment`, as outlined [here](#customize-envoyproxy-deployment-replicas).
351+
320352
[Gateway API documentation]: https://gateway-api.sigs.k8s.io/
321-
[EnvoyProxy]: ../../api/extension_types#envoyproxy
353+
[EnvoyProxy]: ../../api/extension_types#envoyproxy
322354
[egctl translate]: ../egctl/#validating-gateway-api-configuration

0 commit comments

Comments
 (0)
Please sign in to comment.