容器如何访问公网?
因为任务过程中可能需要下载训练用数据集,所以可能需要进行访问公网操作。而容器初始状态无法访问公网,直接运行带下载数据集的指令将会进行如下报错:
W tensorflow/core/platform/cloud/google_auth_provider.cc:184] All attempts to get a Google authentication bearer token failed, returning an empty token. Retrieving token from files failed with "Not found: Could not locate the credentials file.". Retrieving token from GCE failed with "Failed precondition: Error executing an HTTP request: libcurl code 6 meaning 'Couldn't resolve host name', error details: Could not resolve host: metadata".
E tensorflow/core/platform/cloud/curl_http_request.cc:614] The transmission of request 0x5b328e0 (URI: https://www.googleapis.com/storage/v1/b/tfds-data/o/dataset_info%2Fmnist%2F3.0.1?fields=size%2Cgeneration%2Cupdated) has been stuck at 0 of 0 bytes for 61 seconds and will be aborted....
针对上述问题,提供两种访问公网的方式:
注意
创建的 NAT 网关和路由表需要与 TKE Serverless 集群同地域、同私有网络 VPC。
本页内容是否解决了您的问题?