In a hybrid cloud scenario, you can specify a custom Domain Name System (DNS) server for Elastic Container Instance (ECI) pods in a registered cluster. This topic describes how to perform this configuration.
Prerequisites
You have an attached registered cluster. For more information, see Create an ACK One registered cluster.
You have connected to the registered cluster using kubectl. For more information, see Connect to a cluster using kubectl.
You have installed version 2.10.0 or later of the ack-virtual-node component. For more information, see Manage components.
Procedure
Run the following command to edit the eci-profile file.
kubectl edit configmap eci-profile -n kube-systemIn the selectors section of the eci-profile file, configure annotations.
For example, you can configure the following policy to specify the DNS server for all ECI pods. To apply the policy only to specific pods, configure dns-selector. For more information, see Configure selectors.
ImportantVerify the value of
k8s.aliyun.com/eci-dns-configin a staging environment before you publish it to a production environment. This prevents an incorrect configuration from crashing the ack-virtual-node component and affecting your services.selectors: | [ { "name":"dns-selector", "effect": { "annotations": { "k8s.aliyun.com/eci-dns-config": "{\"nameservers\":[\"192.0.2.1\",\"192.0.2.2\"],\"searches\":[\"ns1.svc.cluster-domain.example\",\"my.dns.search.suffix\"],\"options\":[{\"name\":\"ndots\",\"value\":\"2\"},{\"name\":\"edns0\"}]}" } } } ]