If a container cannot access the Internet, check whether the node where the container is located can access the Internet. Then check whether the network configuration of the container is correct. For example, check whether the DNS configuration can resolve the domain name.
The following figure shows that an EIP has been bound. If no EIP is displayed, bind an EIP to the ECS.
Run cat /etc/resolv.conf in the container to check the DNS configuration. An example is as follows:
nameserver 10.247.x.x search default.svc.cluster.local svc.cluster.local cluster.local options ndots:5
If nameserver is set to 10.247.x.x, DNS is connected to the CoreDNS of the cluster. Ensure that the CoreDNS of the cluster is running properly. If another IP address is displayed, an in-cloud or on-premises DNS server is used. Ensure that the domain name resolution is correctly configured.