IPv6 offers a larger address space and enhanced security compared to IPv4. This topic shows you how to create an ASM gateway with an IPv6 address and add an IPv6 address to an existing one.
Prerequisites
The cluster is added to the ASM instance. For more information, see Add a cluster to an ASM instance.
Method 1: Create an IPv6 ASM gateway
When you create an ASM gateway, add theservice.beta.kubernetes.io/alibaba-cloud-loadbalancer-ip-version: "ipv6" annotation to assign it an IPv6 address.
-
Log on to the ASM console. In the left-side navigation pane, choose .
-
On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
-
On the Ingress Gateway page, click Create from YAML.
-
On the Create page, set Namespaces to istio-system, enter the following content in the editor, and then click Create.
Set the
clusterIdsfield to the ID of your data plane cluster.Parameter
Description
service.beta.kubernetes.io/alicloud-loadbalancer-address-type
The network type of the CLB instance. Valid values are:
-
internet: A public network.
-
intranet: A private network.
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec
The specification of the CLB instance. Valid values are:
slb.s1.small,slb.s2.small,slb.s2.medium,slb.s3.small,slb.s3.medium, andslb.s3.large.service.beta.kubernetes.io/alibaba-cloud-loadbalancer-ip-version
Set the value to
"ipv6"to assign an IPv6 address to the CLB instance.After the gateway is created, the Ingress Gateway page displays an IPv6 address as the Service address for the gateway.
-
Method 2: Add IPv6 to an existing ASM gateway
If you have an ASM gateway that uses an IPv4 address, you can add IPv6 support by creating an additional CLB instance. This allows the gateway to use both IPv4 and IPv6 addresses.
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
On the Services page, set Namespace to istio-system at the top of the page, and then click Create Resources in YAML in the upper-right corner.
-
On the Create page, set Sample Template to Custom, copy the following content into the Template editor, and then click Create.
ImportantThe
nodePortvalue must not conflict with any existing port number.Parameter
Description
service.beta.kubernetes.io/alicloud-loadbalancer-address-type
The network type of the CLB instance. Valid values are:
-
internet: A public network.
-
intranet: A private network.
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec
The specification of the CLB instance. Valid values are:
slb.s1.small,slb.s2.small,slb.s2.medium,slb.s3.small,slb.s3.medium, andslb.s3.large.service.beta.kubernetes.io/alibaba-cloud-loadbalancer-ip-version
Set the value to
"ipv6"to assign an IPv6 address to the CLB instance.After the service is created, the Services page lists the IPv4 and IPv6 addresses for
istio-ingressgatewayandistio-ingressgateway-2in the External IP column. These addresses serve as the IPv4 and IPv6 entrypoints for the ASM gateway. -
FAQ
Get the original client IPv6 address
-
Configure the CLB instance that is associated with the IPv6 address. Modify the listener configurations for ports 80 and 443. In the Advanced Settings section, enable the Proxy Protocol. For more information, see Obtain the real IP address of a client by using the Layer 4 listener of a CLB instance.
-
Create an EnvoyFilter Template.
-
Log on to the ASM console. In the left-side navigation pane, choose .
-
On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose . On the page that appears, click Create EnvoyFilter Template.
-
On the Create page, enter a template name, click Add an EnvoyFilter template for specific adapted istio version., select an Adapted istio version, configure the following YAML, and then click Create.
apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: proxy-protocol namespace: istio-system spec: configPatches: - applyTo: LISTENER patch: operation: MERGE value: listener_filters: - name: envoy.listener.proxy_protocol - name: envoy.listener.tls_inspector workloadSelector: labels: istio: ingressgateway
-
-
Apply the EnvoyFilter Template to the ASM gateway to enable Proxy Protocol support.
-
On the EnvoyFilter Template page, find the target template and click Edit template in the Actions column.
-
On the Edit EnvoyFilter Template page, click the Bind template to workloads tab and then click Bind EnvoyFilter to Workloads.
-
In the Bind EnvoyFilter to Workloads dialog box, set Namespaces to istio-system and Workload Type to Deployment. In the Not bound section, click Bind next to the target gateway, and then click OK.
-
-
Access the IPv6 URL of the gateway over an IPv6 network and view the corresponding gateway logs.
In the sample gateway log below, the value of the
downstream_remote_addressfield is the client's original IPv6 address.{"upstream_cluster":null,"bytes_received":0,"downstream_local_address":"[2400:XXXX:1300::12d1]:80","upstream_service_time":null,"FILTER_CHAIN_NAME":null,"path":"/","x_forwarded_for":"2402:XXXX:1800:af00:0:9671:f00f:314b","upstream_host":null,"bytes_sent":0,"requested_server_name":null,"route_name":null,"response_flags":"NR","start_time":"2022-12-28T06:41:57.796Z","upstream_transport_failure_reason":null,"protocol":"HTTP/1.1","authority":"[2400:XXXX:1300::12d1]","LOCAL_REPLY_BODY":"","duration":0,"method":"GET","downstream_remote_address":"[2402:XXXX:1800:af00:0:9671:f00f:314b]:58272","request_id":"fee2b69a-b755-986b-91e4-5d228c81****","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36","trace_id":null,"authority_for":"[2400:XXXX:1300::12d1]","upstream_local_address":null,"istio_policy_status":null,"response_code":404}