Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Build does not resolve the private DNS of self hosted Gitlab

I'm having a cloud build pipeline that is linked to self hosted Gitlab instance,But it's not able to resolve the private DNS host name inspite of being hosted on same VPC . I'm using private pools for cloud build as well.

But still getting the error Unable to resolve the host "hostname" error.

Any help is really appreciated 

0 1 151
1 REPLY 1

Hi @AravindEZ 

Welcome to Google Cloud Community!

It appears that you're facing a DNS resolution issue in your Cloud Build pipeline, despite your private pool and target host being in the same VPC. This is usually caused by misconfigurations in the network settings or DNS resolution. Here are some steps to troubleshoot and resolve this issue:

  1. You can try the solution provided by KikoZam to fix the DNS issue.
  2. Verify Network Connectivity:
    1. Ping the Host: Use the ping command to directly ping the private IP address of the host. This ensures basic network connectivity.
    2. Check Firewall Rules: Ensure that inbound and outbound traffic is allowed on the necessary ports (e.g., HTTP, HTTPS, SSH) for your application.
    3. Inspect VPC Network Settings: Verify the VPC network configuration, subnets, and routing tables to ensure they're correctly set up for internal communication.
  3. Examine DNS Resolution:
    1. DNS Server Configuration: Confirm that the DNS servers used by your Cloud Build workers are correctly configured to resolve private DNS names.
    2. DNS Records: Check if the necessary DNS records (A records for hostnames) are present in your private DNS zone and are correctly propagated. You can tools like dig or nslookup to verify DNS records
  4. Cloud Build Configuration:
    1. Private Pool Configuration: Ensure that your private pool is correctly configured to access the VPC network and resolve DNS names.
    2. Build Steps: Review your build steps to ensure they're not introducing any additional network or DNS-related issues.
  5. Additional Considerations:
    1. Service Accounts: Verify that the service account used by your Cloud Build pipeline has the necessary permissions to access the VPC network and resolve DNS names.
    2. Network Tags: If you're using network tags, ensure that the tags on your Cloud Build workers and the target host are configured to allow communication.

I hope this helps.