I'm trying to use nested virtualization in Google Cloud Platform for hosting multiple web applications. but I'm confuse that if I can access these nested VM globally. I tried to google it but didn't find any good answer. Thank you.
1 Answers
Routing packets directly to nested VMs is not a standard feature of GCE. And if you attempted to build it by using existing features in "innovative" ways you are likely to hit the IP address quota by trying to allocate a separate external IP address to each nested VM.
A different approach
Instead of attempting to route packets directly to your nested VMs I recommend that you take a different approach.
On the intermediate VM which can be directly assigned an external IP address you can run a reverse proxy to support HTTP and HTTPS. This reverse proxy will use the hostname sent by the client to route the request to the correct nested VM.
Should the nested VMs need to establish outgoing connections you can have the intermediate VM configured to do NAT for connections from the nested VMs.
A word on reliability
If you are trying to build a highly reliable service you should expect individual intermediate VMs to occasionally be unavailable. So you should bring up more than one such intermediate VM for redundancy and load balance the traffic across those intermediate VMs using the HTTP load balancing or network load balancing provided by GCE.
Keep in mind that the health checks done by the GCE load balancing will not know about the nested VMs and thus will consider each intermediate VM to be either healthy or unhealthy even if a single of the nested VMs is unhealthy and the rest are unhealthy.
This means your proxy can receive a small amount of requests intended for a nested VM that is currently unhealthy, and you need to implement your own health checks such that you can route such requests to another intermediate VM.
- 31,086