<p>Following the YugabyteDB Voyager database migration steps (<a href="https://docs.yugabyte.com/preview/migrate/migrate-steps/" rel="nofollow noreferrer">https://docs.yugabyte.com/preview/migrate/migrate-steps/</a>) going from PostgreSQL to YugabyteDB on a local Kubernetes, on Docker Desktop, on WSL2, on Windows.
Using Ubuntu 22.04 on WSL2 to run yb-voyager, I get an error on the Import Data step:</p>
<pre><code>import of data in &quot;postgres&quot; database started
Target YugabyteDB version: 11.2-YB-2.15.2.1-b0
Error Resolving name=yb-tserver-1.yb-tservers.yb-demo.svc.cluster.local: lookup yb-tserver-1.yb-tservers.yb-demo.svc.cluster.local: no such host
</code></pre>
<p>The Import Schema step worked correctly (from using pgAdmin connected to the YugabyteDB), so I know that the database can be connected to.  Command used:</p>
<pre><code>yb-voyager import schema --export-dir ${EXPORT_DIR} --target-db-host ${TARGET_DB_HOST} --target-db-user ${TARGET_DB_USER} --target-db-password ${TARGET_DB_PASSWORD} --target-db-name ${TARGET_DB_NAME}
</code></pre>
<p>The command used to import the data, which fails:</p>
<pre><code>yb-voyager import data --export-dir ${EXPORT_DIR} --target-db-host ${TARGET_DB_HOST} --target-db-user ${TARGET_DB_USER} --target-db-password ${TARGET_DB_PASSWORD} --target-db-name ${TARGET_DB_NAME}
</code></pre>
<p>ENV variables:</p>
<pre><code>EXPORT_DIR=/home/abc/db-export
TARGET_DB_HOST=127.0.0.1
TARGET_DB_USER=ybvoyager
TARGET_DB_PASSWORD=password
TARGET_DB_NAME=postgres
</code></pre>
<p>Why does the import data fail when the import schema works connecting to the same database?</p>

<p>Putting solution here in case anybody runs into this issue.
If there is a Load Balancer is present and YugabyteDB server's IP is not resolvable from the voyager machine, then import data command is erroring out.
Ideally it should use the load balancer for importing the data.</p>
<p>Use <code>--target-endpoints=LB_HOST:LB_PORT</code> to force the server address.</p>
<p>See tickets:<br />
<a href="https://github.com/yugabyte/yb-voyager/issues/553" rel="nofollow noreferrer">Import data 'Error Resolving name' on local kubernetes #553</a><br />
<a href="https://github.com/yugabyte/yb-voyager/issues/585" rel="nofollow noreferrer">Import Data failed if LB is present and cluster servers host is not resolvable #585</a></p>
