ASMMeshConfig is a custom resource provided by Alibaba Cloud Service Mesh (ASM) to globally configure the core parameters of a service mesh. Its functionality is similar to Istio's MeshConfig. You can use this CustomResourceDefinition (CRD) to centrally manage mesh-level settings, such as connection timeouts, protocol detection, path normalization, and retry policies. You can also use it to control the resource quotas and behavior of the sidecar injector.
Configuration example
The following example shows how to configure an ASM instance. The configuration includes connection settings, path normalization, HTTP retry policies, sidecar injector policies, and global rate limiting.
apiVersion: istio.alibabacloud.com/v1beta1
kind: ASMMeshConfig
metadata:
name: default
spec:
connectTimeout: 30s
tcpKeepalive:
probes: 5
time: 7200s
interval: 72s
pathNormalization:
normalization: MERGE_SLASHES
defaultHttpRetryPolicy:
attempts: 3
perTryTimeout: 1s
retryOn: gateway-error,connect-failure,refused-stream
enablePrometheusMerge: true
sidecarInjectorWebhookConfiguration:
rewriteAppHTTPProbe: true
replicaCount: 2
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: '2'
memory: 2Gi
rateLimitService:
enabled: true
redis:
authSecret: redis-secret
url: redis.istio-system.svc:6379
replicas: 1To use all the fields of the ASMMeshConfig CRD, your Service Mesh instance must be version 1.24 or later. To configure rateLimitService, the instance version must be 1.25.6.84 or later. In addition, the ASMMeshConfig CR is not namespaced, and its name must be `default`. ASMMeshConfig CRs with other names will not take effect.
Field reference
Basic configurations
Field path | Data type | Description | Example | Scope |
| Duration | The maximum time to wait for an Envoy proxy to establish a TCP connection. If the connection times out, an |
| Mesh-level outbound TCP connections. |
| Duration | The timeout for automatic protocol detection, which is used to identify HTTP/HTTPS traffic. If the detection times out, traffic is processed based on the original protocol. Important This field is configurable only in ASM 1.19 and earlier versions. |
| Mesh-level protocol sniffing. |
TCP keepalive configurations
Field path | Data type | Description | Example | Scope |
| Uint32 | The maximum number of TCP keepalive probes to send. Set this to |
| Outbound persistent TCP connections. |
| Duration | The idle time for a TCP connection before keepalive probes are sent. |
| |
| Duration | The interval between keepalive probes. This value must be smaller than the |
|
Path normalization
Field path | Data type | Description | Example | Scope |
| Enum | The URI path processing policy.
|
| Mesh-level HTTP routing. |
HTTP retry policy
Field path | Data type | Description | Example | Scope |
| Int32 | The maximum number of retries for an HTTP request. This includes the initial request. This setting takes effect only if a retry policy is not explicitly configured in the VirtualService. |
| HTTP routing policy. |
| Duration | The timeout for a single retry. This value must be shorter than the total timeout defined in the VirtualService. |
| |
| String | The conditions that trigger a retry. Standard error types are supported, such as
|
|
Monitoring integration
Field path | Data type | Description | Example | Scope |
| Bool | Automatically merges the original |
| Prometheus monitoring configuration. |
Sidecar injector configuration
Field path | Data type | Description | Example | Scope |
| Bool | Automatically redirects the HTTP readiness probe of the pod to the sidecar proxy port. |
| Sidecar injection behavior. |
| Int | The number of replicas for the sidecar injection controller. A larger number of replicas improves high availability. |
| Sidecar injector component. |
| Object | The resource quota configuration.
| | Sidecar injector component. |
Global rate limiting configuration
Field path | Data type | Description | Example | Scope |
| Bool | Specifies whether to enable the rate limiting service. |
| Enables the global rate limiting feature. |
| Int | The number of replicas for the rate limiting service. |
| Availability and performance of the rate limiting service. |
| Object | The resource configuration for the rate limiting service. | | Availability and performance of the rate limiting service. |
| Object | The Redis configuration for the rate limiting service. Note The global rate limiting service uses Redis to record rate limiting policies and decisions. | | Rate limiting state storage backend. |
| String | The type of the Redis cluster. Valid values: |
| Rate limiting state storage backend. |
| String | The Redis address. |
| Rate limiting state storage backend. |
| String | The Redis authentication information. The format is | xxxxxx | Credential security management. |
| String | The name of the secret that stores the Redis authentication information. Note This secret must be deployed in the | | Credential security management. |
| String | The prefix for Redis cache keys. The default value is empty. | N/A | Rate limiting state storage backend. |
Use Alibaba Cloud ApsaraDB for Redis to ensure high availability. Configure rateLimitService.redis.type for the rate limiting service based on the Redis instance type by referring to the following table.
Instance type | Architecture | Connection mode | Cluster type configuration |
Single-node | / | / |
|
High-availability | Cluster disabled | / |
|
Cluster enabled | Direct connection mode |
| |
Proxy mode |
|
ASM aggregates all configurations and automatically generates a rate limiting service configuration named ratelimit-service-config in the `istio-system` namespace. After you enable the rate limiting service, this configuration is automatically mounted. You do not need to manually update it.