Local debugging of Tikv-java-client connects to PD, but the parsed address is the DNS address of Tikv in k8s, which cannot be resolved locally. Seeking help!

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 本地调试Tikv-java-client连PD后,解析出来的是k8s中Tikv的dns地址,本地无法解析,求教!!!

| username: TiDBer_N2Zf1WoP

【TiDB Usage Environment】Production Environment / Testing / PoC
【TiDB Version】
【Reproduction Path】What operations were performed that led to the issue
【Encountered Issue: Issue Phenomenon and Impact】
【Resource Configuration】
【Attachments: Screenshots / Logs / Monitoring】

| username: liuis | Original post link

Unable to resolve locally? What does “locally” refer to here? Within k8s, only the cluster should be able to access through headless svr, right?

| username: yiduoyunQ | Original post link

Normally, connecting to the database through the TiDB service does not require additional access to other components. For special requirements, first ensure network connectivity.

| username: TiDBer_N2Zf1WoP | Original post link

Locally using the Tikv-java-client, configuring the PD connection to Tikv through TiConfiguration, I want to use Tikv directly.

| username: TiDBer_N2Zf1WoP | Original post link

I can write to TiKV through PD using the Tikv-java-client in an application deployed in a K8S cluster, and it works. However, when I try to call TiKV in K8S from my local environment, I get the above error.

| username: liuis | Original post link

You can definitely only call the internal DNS of k8s within k8s.