У меня есть образ докера, который создает соединение с Azure Datalake, используя adlCreds = lib.auth(tenant_id=tenantId, client_secret=application_key, client_id=application_id)
в python, и получает доступ к файлу.Я выполняю образ докера в модуле Kubernetes, используя Airflow Kubernetes_Pod_Operator.Когда я создаю экземпляр оператора pod, контейнер в Kubernetes завершается с ошибкой OAuth2Client:Get Token request failed
Я проверил кредиты Azure, и соединение работает нормально, когда я выполняю его локально.Я получаю эту ошибку, только когда запускаю ее в кластере с помощью Kubernetes Pod.
# Creating ADL connection
def make_azure_enduser():
logging.info('Creating the Azure Datalake Client...')
config = dict(azure_tenantid=<tenant_id>'),
application_key=<azure_application_key>),
application_id=<azure_applicationid>),
subscriptionId=<azure_subid>),
adlAccountName=<azure_datalake_accountname>)
)
# Format the tenant ID and Account Name as strings to be passed into the object
application_id = "{}".format(config['application_id'])
application_key = "{}".format(config['application_key'])
tenantId = "{}".format(config['azure_tenantid'])
store_name = "{}".format(config['adlAccountName'])
# Create the token and the Azure Datalake File System Client
adlCreds = lib.auth(tenant_id=tenantId, client_secret=application_key, client_id=application_id)
adlsFileSystemClient = core.AzureDLFileSystem(adlCreds, store_name=store_name)
return adlsFileSystemClient
# instantiating Kubernetes_pod_operator in Airflow DAG
get_adl_file = KubernetesPodOperator(namespace='default',
image="get_adl_file:latest",
image_pull_policy='IfNotPresent',
image_pull_secrets='acr-registry',
# cmds=["/bin/sh", "-c", "sleep 500"],
# arguments=["sleep 500"],
labels={"foo": "bar"},
name="get_file",
task_id="get_adl_file",
get_logs=True,
dag=dag
)
Я ожидаю, что модуль создаст соединение с датаком, но происходит сбой с приведенной ниже ошибкой.
Журналы Kubernetes Pod
> Creating the Azure Datalake Client...
> ed2a3672-9d3b-456e-924f-cdf6e5f60ce8 - TokenRequest:Getting token with
> client credentials.
> /opt/conda/lib/python3.7/site-packages/sklearn/externals/joblib/__init__.py:15:
> DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and
> will be removed in 0.23. Please import this functionality directly
> from joblib, which can be installed with: pip install joblib. If this
> warning is raised when loading pickled models, you may need to
> re-serialize those models with scikit-learn 0.21+.
> warnings.warn(msg, category=DeprecationWarning)
> ed2a3672-9d3b-456e-924f-cdf6e5f60ce8 - OAuth2Client:Get Token request
> failed Traceback (most recent call last): File
> "/opt/conda/lib/python3.7/site-packages/urllib3/connection.py", line
> 159, in _new_conn
> (self._dns_host, self.port), self.timeout, extra_kw) File "/opt/conda/lib/python3.7/site-packages/urllib3/util/connection.py",
> line 57, in create_connection
> for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/opt/conda/lib/python3.7/socket.py", line
> 748, in getaddrinfo
> for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Temporary failure in name
> resolution During handling of the above exception, another exception
> occurred: Traceback (most recent call last): File
> "/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py",
> line 600, in urlopen
> chunked=chunked) File "/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py",
> line 343, in _make_request
> self._validate_conn(conn) File "/opt/conda/lib/python3.7/site-packages/urllib3/connectionpool.py",
> line 839, in _validate_conn
> conn.connect() File "/opt/conda/lib/python3.7/site-packages/urllib3/connection.py", line
> 301, in connect
> conn = self._new_conn() File "/opt/conda/lib/python3.7/site-packages/urllib3/connection.py", line
> 168, in _new_conn
> self, "Failed to establish a new connection: %s" % e) urllib3.exceptions.NewConnectionError:
> <urllib3.connection.VerifiedHTTPSConnection object at 0x7f0941ce8160>:
> Failed to establish a new connection: [Errno -3] Temporary failure in
> name resolution
Пожалуйста, помогите мне исправить эту ошибку подключения.Спасибо