0

我正在我的计算机上多通道运行 Kubeflow 部署。我已经根据本教程部署了 Kubeflow 。我正在根据文档创建可重用的组件,这是我的管道中一个组件的步骤的一部分。

    db_name = os.getenv("MYSQL_DB_NAME")
    user_name = os.getenv("MYSQL_USER_NAME")
    password = os.getenv("MYSQL_PASSWORD")
    endpoint = os.getenv("MYSQL_ENDPOINT")

    with open('query.sql', 'r') as file:
        query = file.read()

    con = mysql.connector.connect(
        user=user_name,
        password=password,
        host=endpoint,
        database=db_name,
        use_pure=True
    )

用户名、密码等数据由 Kubernetes 机密提供。我已经测试了凭据和连接性,并且能够使用 MySQL 工作台连接到数据库,但是从我的管道组件运行它时,我收到以下错误:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/mysql/connector/network.py", line 482, in open_connection
    addrinfos = socket.getaddrinfo(self.server_host,
  File "/usr/local/lib/python3.9/socket.py", line 953, 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 "/src/get_data.py", line 39, in <module>
    get_data_from_database(args.output_path)
  File "/src/get_data.py", line 22, in get_data_from_database
    con = mysql.connector.connect(
  File "/usr/local/lib/python3.9/site-packages/mysql/connector/__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mysql/connector/connection.py", line 95, in __init__
    self.connect(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/mysql/connector/abstracts.py", line 716, in connect
    self._open_connection()
  File "/usr/local/lib/python3.9/site-packages/mysql/connector/connection.py", line 206, in _open_connection
    self._socket.open_connection()
  File "/usr/local/lib/python3.9/site-packages/mysql/connector/network.py", line 500, in open_connection
    raise errors.InterfaceError(
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'DATABASE URL HERE' (-3 Temporary failure in name resolution)

在我看来这可能是网络配置问题,但我无法弄清楚它是什么。关于可能导致此问题的任何想法?

编辑 1:我检查了 coredns 的日志,结果如下:

2021-04-13T17:10:56.993Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:37555->8.8.8.8:53: i/o timeout
2021-04-13T17:10:57.200Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:38679->8.8.4.4:53: i/o timeout
2021-04-13T17:10:57.607Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:49867->8.8.8.8:53: i/o timeout
2021-04-13T17:10:57.881Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:38816->8.8.8.8:53: i/o timeout
2021-04-13T17:10:58.031Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:50459->8.8.4.4:53: i/o timeout
2021-04-13T17:10:58.070Z [ERROR] plugin/errors: 2 metadata-grpc-service.mshome.net. AAAA: read udp 10.1.1.90:33914->8.8.8.8:53: i/o timeout
2021-04-13T17:10:58.950Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:33273->8.8.4.4:53: i/o timeout
2021-04-13T17:10:58.974Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:53405->8.8.4.4:53: i/o timeout
2021-04-13T17:10:59.009Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:46594->8.8.4.4:53: i/o timeout
2021-04-13T17:10:59.201Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:47334->8.8.8.8:53: i/o timeout
2021-04-13T17:10:59.620Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:56790->8.8.4.4:53: i/o timeout
2021-04-13T17:10:59.911Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:44284->8.8.4.4:53: i/o timeout
2021-04-13T17:11:00.097Z [ERROR] plugin/errors: 2 metadata-grpc-service.mshome.net. AAAA: read udp 10.1.1.90:59630->8.8.8.8:53: i/o timeout
2021-04-13T17:11:00.789Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:57692->8.8.4.4:53: i/o timeout
2021-04-13T17:11:00.789Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:59542->8.8.4.4:53: i/o timeout
2021-04-13T17:11:00.804Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:50422->8.8.8.8:53: i/o timeout
2021-04-13T17:11:00.951Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:60086->8.8.4.4:53: i/o timeout
2021-04-13T17:11:01.257Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:35778->8.8.8.8:53: i/o timeout
2021-04-13T17:11:01.621Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:58926->8.8.8.8:53: i/o timeout
2021-04-13T17:11:01.873Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:60646->8.8.8.8:53: i/o timeout
2021-04-13T17:11:01.951Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:50084->8.8.4.4:53: i/o timeout
2021-04-13T17:11:02.098Z [ERROR] plugin/errors: 2 metadata-grpc-service.mshome.net. AAAA: read udp 10.1.1.90:59431->8.8.8.8:53: i/o timeout
2021-04-13T17:11:02.611Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:59929->8.8.8.8:53: i/o timeout
2021-04-13T17:11:02.792Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:44759->8.8.4.4:53: i/o timeout
2021-04-13T17:11:02.793Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:49814->8.8.4.4:53: i/o timeout
2021-04-13T17:11:02.809Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:39801->8.8.8.8:53: i/o timeout
2021-04-13T17:11:02.906Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:43867->8.8.8.8:53: i/o timeout
2021-04-13T17:11:02.952Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:51358->8.8.8.8:53: i/o timeout
2021-04-13T17:11:03.028Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:43346->8.8.8.8:53: i/o timeout
2021-04-13T17:11:03.203Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:58517->8.8.8.8:53: i/o timeout
2021-04-13T17:11:03.686Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:42878->8.8.8.8:53: i/o timeout
2021-04-13T17:11:03.874Z [ERROR] plugin/errors: 2 storage.googleapis.com.mshome.net. A: read udp 10.1.1.90:60683->8.8.4.4:53: i/o timeout
2021-04-13T17:11:03.952Z [ERROR] plugin/errors: 2 www.googleapis.com.mshome.net. A: read udp 10.1.1.90:33429->8.8.4.4:53: i/o timeout
4

0 回答 0