Why not A?

Option A is incorrect because it doesn't properly account for the scenario where the Compute Engine instance is in a different VPC from the Google Kubernetes Engine (GKE) cluster, and there are no overlapping IP ranges between the VPCs. Here’s a breakdown of why Option A doesn't work:

Option A:

  1. Create a Service of type LoadBalancer in GKE: This step is valid, as it creates an external load balancer for the GKE application, making it accessible over the internet.
  2. Set the service’s externalTrafficPolicy to Cluster: This option configures how traffic is routed when it enters the load balancer. Setting externalTrafficPolicy to Cluster ensures that the traffic is distributed across all nodes in the cluster, rather than preserving the source IP. However, this setting doesn't address VPC connectivity between the GKE cluster and the Compute Engine instance.
  3. Configure the Compute Engine instance to use the address of the load balancer: While this step is correct, the key issue is that the load balancer, by default, would be publicly accessible if it's of type LoadBalancer.

However, in this case, the requirement is to connect from a Compute Engine instance in a different VPC, and this leads to two main problems:

Why it’s incorrect:

  1. No VPC Peering: Option A assumes that the load balancer is public, which would require the Compute Engine instance to access it over the internet. If you're trying to minimize effort and make the solution internal, you would need to peer the two VPCs. However, in this option, no steps are provided for VPC peering.
  2. Overlapping IP Address Range Issue: Since the VPCs don't overlap in IP ranges, there's no inherent connectivity between them unless VPC peering is established. The use of a public load balancer (as implied by this option) wouldn’t solve this issue because you would still have the challenge of routing traffic from a private Compute Engine instance (in another VPC) to the public load balancer.

What should be done instead:

  • Option C is the correct choice because it addresses the VPC peering requirement. By setting the cloud.google.com/load-balancer-type: Internal annotation on the GKE service, it ensures that the load balancer is internal to the network and avoids exposing the application to the public internet. Then, VPC peering can be established between the two VPCs, allowing the Compute Engine instance in the second VPC to connect to the GKE service via the internal load balancer. This meets the requirement of minimizing effort and ensures secure, private connectivity.

In summary, Option A fails to address the connectivity between VPCs and would expose the GKE service to the internet, which is not desirable in this case where you want to maintain internal connectivity.

This page was last edited on 2024-12-31 13:02

Powered by Wiki|Docs

This page was last edited on 2024-12-31 13:02

Mac
To whom it may concern

Powered by Wiki|Docs