ASMMeshConfig is a custom resource (CR) from Alibaba Cloud Service Mesh (ASM) that defines mesh-wide configuration for the service mesh. Similar to Istio's MeshConfig, this CR allows you to centrally manage mesh-level parameters such as connection timeout, protocol detection, path normalization, and a retry policy. You can also use it to control the behavior and resource quota of the sidecar injector.
Configuration example
The following example specifies mesh-wide settings for an ASM instance, including connection configuration, path normalization, the HTTP retry policy, sidecar injector configuration, and the global rate limiting service.
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: 1
accessLogConfiguration:
logEncoding: JSON
logProject: test-project
sidecarEnabled: true
manifestPatch:
- targetRef:
kind: DaemonSet
group: apps
namespace: kube-system
selector:
labels:
app: istio-cni
patch: |
metadata:
labels:
custom.example.com/managed-by: asm
annotations:
custom.example.com/cni-version: "1.29"To use all fields of the ASMMeshConfig CRD, your ASM instance must be version 1.24 or later. The rateLimitService configuration requires instance version 1.25.6.84. In addition, the ASMMeshConfig CR is not namespaced, and its name must be default. ASMMeshConfig CRs with any other name are ignored.
Field reference
Spec (Mesh configuration)
Field path | Type | Description | Example value |
| TcpKeepalive | Configures TCP keepalive settings. |
|
| Duration | Specifies the maximum wait time for the Envoy proxy to establish a TCP connection. A timeout triggers an |
|
| Duration | The timeout for protocol detection, used to identify HTTP/HTTPS traffic. If the protocol is not detected within this duration, the traffic is treated as raw TCP. Important This field is configurable only in ASM versions 1.19 and earlier. | |
| PathNormalization | Configures path normalization for HTTP requests. | |
| DefaultHttpRetryPolicy | Defines the default HTTP retry policy for sidecars. | |
| Bool | If |
|
| SidecarInjectorWebhookConfiguration | Configures the sidecar injector. | |
| AccessLogConfiguration | Configures the format and collection of access logs. | |
| RatelimitService | Configures the global rate limiting service. Important This field is configurable only in ASM versions 1.25 and later. | |
| []PatchConfig | The Important This field is configurable only in ASM versions 1.27 and later. |
TcpKeepalive
Field path | Type | Description | Example value | Scope |
| Uint32 | The maximum number of TCP keepalive probes to send. A value of |
| Outbound long-lived TCP connections. |
| Duration | The idle time before the first keepalive probe is sent. |
| |
| Duration | The keep-alive probe sending interval must be less than the |
|
PathNormalization
Field path | Type | Description | Example value | Scope |
| Enum | The URI path processing policy:
|
| Mesh-wide HTTP routing. |
DefaultHttpRetryPolicy
Field path | Type | Description | Example value | Scope |
| Int32 | The maximum number of attempts for an HTTP request. This global setting applies only if a VirtualService does not explicitly define its own retry policy. |
| HTTP routing policy. |
| Duration | The timeout for each attempt. This value must be less than the overall request timeout defined in the VirtualService. |
| |
| String | Specifies the conditions that trigger a retry. Supported standard error types include |
|
SidecarInjectorWebhookConfiguration
Field path | Type | Description | Example value | Scope |
| Bool | If |
| Sidecar injection behavior. |
| Int | The number of replicas for the sidecar injector controller to improve high availability. |
| Sidecar injector component. |
| Object | The resource quota configuration:
| | Sidecar injector component. |
AccessLogConfiguration
Field path | Type | Description | Example value |
| String | The output format for logs. Valid values are |
|
| String | The destination Alibaba Cloud Log Service (SLS) project for the logs. Important This field is configurable only in ASM versions 1.25 and later. |
|
| Boolean | If |
|
| Boolean | If |
|
| Boolean | If Important This field is configurable only in ASM versions 1.25 and later. |
|
| Integer | The retention period in days for gateway access logs. Default: 90. |
|
| Integer | The retention period in days for sidecar access logs. Default: 90. |
|
| Integer | The retention period in days for Ztunnel access logs. Default: 90. Important This field is configurable only in ASM versions 1.25 and later. |
|
RatelimitService
Field path | Type | Description | Example value | Scope |
| Bool | Specifies whether to enable the global rate limiting service. |
| Global rate limiting capability. |
| 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 | Configuration for the Redis instance used by the rate limiting service. Note The global rate limiting service uses Redis to store rate limiting policies and decisions. | | Rate limiting state backend. |
| String | The type of the Redis cluster. The valid values are |
| Rate limiting state backend. |
| String | The Redis address. |
| Rate limiting state backend. |
| String | The authentication information for Redis. The format is | xxxxxx | Credential security management. |
| String | The name of the Secret that stores the Redis authentication credentials. Note This Secret must be deployed in the | | Credential security management. |
| String | The prefix for Redis cache keys. Defaults to empty. | N/A | Rate limiting state backend. |
We recommend that you use Alibaba Cloud Redis to ensure high availability. You can configure the rateLimitService.redis.type parameter based on the type of your Redis instance and the following table.
Instance type | Architecture | Connection mode |
|
Single-node | N/A | N/A |
|
High-availability | Standard (cluster disabled) | N/A |
|
Cluster (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. When you enable the rate limiting service, this configuration is automatically mounted. You do not need to manually update the rate limiting service configuration.
PatchConfig
Field path | Type | Description |
| TargetRef | Specify the target resource to patch. When ASM reconciles each resource, it matches the actual information of the resource with the conditions in |
| string | The content of the Strategic Merge Patch, in either YAML or JSON format. ASM merges this patch into the target resource. |
TargetRef
Field path | Type | Required | Description |
| string | Yes | The Kubernetes Kind of the target resource, such as |
| string | No | The API Group of the target resource, such as |
| string | No | The name of the target resource. If not specified, the patch applies to all resources of the specified |
| string | No | The |
| PatchSelector | No | Further filters target resources using a label selector. If not specified, labels are not matched. |
PatchSelector
Field path | Type | Required | Description |
| map[string]string | No | A map of key-value pairs. A resource must contain all specified labels to be matched (AND logic). |
When ASM reconciles resources, it uses the following rules to determine whether targetRef matches the current resource:
kindmust be identical to the Kind of the resource.If
groupis specified, it must match the API Group of the resource.If you specify
name, it must match the name of the resource.If a
namespaceis specified, it must be the same as the namespace of the resource.If
selector.labelsis specified, the resource must contain all the specified labels (AND relationship).