In hybrid cloud scenarios, you can specify self-managed DNS servers for elastic container instances in registered clusters. This topic describes how to specify DNS servers for registered clusters.
Prerequisites
A registered cluster is created. For more information, see Create a registered cluster in the ACK console and Use onectl to create a registered cluster.
A kubectl client is connected to the registered cluster. For more information, see Obtain the kubeconfig file of a cluster and use kubectl to connect to the cluster.
ack-virtual-node 2.10.0 or later is installed in the cluster. For more information, see Manage components.
Procedure
Run the following command to modify the eci-profile file:
kubectl edit configmap eci-profile -n kube-system
Add annotations in the selectors section of the eci-profile configuration file.
For example, you can configure the following policy to specify DNS servers for all Elastic Container Instance-based pods. You can also configure dns-selector to allow the policy to take effect only on specified pods. For more information, see Configure selectors.
ImportantMake sure that the value of
Kubernetes. aliyun.com/eci-dns-config
is verified in the test environment before the configuration file is applied to the production environment. If the value is improper, the ack-virtual-node component will crash and your businesses will be adversely affected.selectors: | [ { "name":"dns-selector", "effect": { "annotations": { "k8s.aliyun.com/eci-dns-config": `{"nameserver":"192.0.2.1, 192.0.2.2","searchs":"ns1.svc.cluster-domain.example, my.dns.search.suffix","options":"[{"name": "ndots", "value": 2},{"name": "edns0"}]" }` } } } ]