0

I have set up an internal TCP/UDP load balancer with VM instance group backends.

I am on the section that relates to Test connection from client VM.

Here, I don't quite understand the last step, which says:

If you add a service label to the internal forwarding rule, you can use internal DNS to contact the load balancer using its service name.
curl http://web-test.fr-ilb.il4.us-west1.lb.sandbox-neos.internal

When I run the above command, I get the following error:
curl: (6) Could not resolve host: web-test.fr-ilb.il4.us-west1.lb.sandbox-neos.internal

The service label of my forwarding rule is fr-ilb-label. Should I replace the name of my service label in the above command? If yes, I am not quite able to fathom what I should replace it with for I tried different options but it doesn't work:
curl http://web-test.fr-ilb-label.us-west1.lb.sandbox-neos.internal

The following is the description of my forwarding rule:

@cloudshell:~ (ilb-test-356804)$ gcloud compute forwarding-rules describe fr-ilb --region=us-west1                                                                        
IPAddress: 10.1.2.99
IPProtocol: TCP
allowGlobalAccess: true
backendService: https://www.googleapis.com/compute/v1/projects/ilb-test-356804/regions/us-west1/backendServices/be-ilb
creationTimestamp: '2022-09-06T19:54:49.330-07:00'
description: ''
fingerprint: 7wff1x8n8_g=
id: '7457513772638648598'
ipVersion: IPV4
kind: compute#forwardingRule
labelFingerprint: iLh3JCVj-vI=
labels:
  service-label: fr-ilb-label
loadBalancingScheme: INTERNAL
name: fr-ilb
network: https://www.googleapis.com/compute/v1/projects/ilb-test-356804/global/networks/lb-network
networkTier: PREMIUM
ports:
- '80'
- '8008'
- '8080'
- '8088'
region: https://www.googleapis.com/compute/v1/projects/ilb-test-356804/regions/us-west1
selfLink: https://www.googleapis.com/compute/v1/projects/ilb-test-356804/regions/us-west1/forwardingRules/fr-ilb
subnetwork: https://www.googleapis.com/compute/v1/projects/ilb-test-356804/regions/us-west1/subnetworks/lb-subnet
Nosail
  • 465
  • 2
  • 7
  • 19

1 Answers1

0

CloudShell is not part of your internal VPC network. Run the curl command from a VM instance running in the same project.

John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • Hi John, i missed to mention that that i am running the `curl` command from the VM instance in the project. It was only the command to describe the load balancer that I ran from Cloud Shell. – Nosail Sep 07 '22 at 07:06
  • @Nosail - are you specifying the label for the forwarding rule or the load balancer? Note: your second link requires logging in to view. Change to a public link. – John Hanley Sep 07 '22 at 07:12
  • so I am following the instructions [here](https://cloud.google.com/load-balancing/docs/internal/setting-up-internal#test_connection_from_client_vm). I am specifying the label of forwarding rule of the load balancer. – Nosail Sep 07 '22 at 07:16
  • 1
    @Nosail - what is `web-test` and `sandbox-neos` in the URL that you are using? The format is `SERVICE_LABEL.FORWARDING_RULE_NAME.il4.REGION.lb.PROJECT_ID.internal`. Your service label is `fr-ilb-label`. Forwarding rule name is `fr-ilb`. Region is `us-west1`. Project ID is `ilb-test-356804`. That format does not match the URL you specified `web-test.fr-ilb-label.us-west1.lb.sandbox-neos.internal`. Try using `fr-ilb-label.fr-ilb.il4.us-west1.lb.ilb-test-356804.internal`. – John Hanley Sep 07 '22 at 07:56
  • @JohHanley i don't know what is `web-test` - it was in the documentation. `sandbox-neos` is my project-id. So i used the following command: `curl fr-ilb-label.fr-ilb.il4.us-west1.lb.sandbox-neos.internal` but i get the same error: `curl: (6) Could not resolve host: fr-ilb-label.fr-ilb.il4.us-west1.lb.sandbox-neos.internal` – Nosail Sep 07 '22 at 08:18
  • @Nosail - Did you try the URL I specified? Your project ID is not `sandbox-neos`. Your project ID is `ilb-test-356804`. – John Hanley Sep 07 '22 at 08:20
  • @Nosail - Also make sure you are testing from a VM instance in the project `ilb-test-356804`. – John Hanley Sep 07 '22 at 08:22
  • I am sorry I was in the wrong project. But I have switched to the right one: `ilb-test-356804`. I ran the following command, but no luck: `curl fr-ilb-label.fr-ilb.il4.us-west1.lb.ilb-test-356804.internal`. I must add I have SSH'd into the client VM `vm-client`, and that the preceding command in the instructions works just fine: `curl http://10.1.2.99`. It returns `Page served from: vm-a1`, `Page served from: vm-a2`, and so on. – Nosail Sep 07 '22 at 08:48
  • I meant I ran the following: `curl http://fr-ilb-label.fr-ilb.il4.us-west1.lb.ilb-test-356804` – Nosail Sep 07 '22 at 10:38
  • That is not the URL I provided. You are missing the end. Consult the documentation on how the URL is formatted so that you understand what the correct format is. – John Hanley Sep 07 '22 at 19:03
  • sorry, i meant to say, i ran the following: `curl http://fr-ilb-label.fr-ilb.il4.us-west1.lb.ilb-test-356804.internal` but keep getting the same error: `curl: (6) Could not resolve host: fr-ilb-label.fr-ilb.il4.us-west1.lb.ilb-test-356804.internal`. I have SSH'd into the client VM `vm-client`, and that the preceding command in the instructions works just fine: `curl http://10.1.2.99`. It returns `Page served from: vm-a1`, `Page served from: vm-a2`, and so on. – Nosail Sep 08 '22 at 00:26
  • I checked with the team internally and i think this is an issue with the org that i am using. But thanks John for all your help! – Nosail Sep 08 '22 at 02:25