You have an application running in Google Kubernetes Engine (GKE) with cluster autoscaling enabled.
The application exposes a TCP endpoint.
There are several replicas of this application.
You have a Compute Engine instance in the same region, but in another Virtual Private Cloud (VPC), called gce-network, that has no overlapping IP ranges with the first VPC.
This instance needs to connect to the application on GKE.
You want to minimize effort.
What should you do?
Click on the arrows to vote for the correct answer
A. B. C. D. E.A.
The correct answer is A:
Explanation:
The scenario requires connecting a Compute Engine instance in a different VPC to an application running on Google Kubernetes Engine (GKE). One way to achieve this is by creating a load balancer service in GKE and configuring the Compute Engine instance to use the address of the load balancer.
Option A is the correct answer because it meets the requirements and minimizes effort. Here are the steps to implement option A:
In GKE, create a Service of type LoadBalancer that uses the application's Pods as backend.
Set the service's externalTrafficPolicy to Cluster.
Configure the Compute Engine instance to use the address of the load balancer that has been created.
Option B is incorrect because it requires creating a Compute Engine instance called proxy with two network interfaces, one in each VPC. This adds unnecessary complexity to the solution.
Option C is incorrect because it requires using iptables on the Compute Engine instance to forward traffic from gce-network to the GKE nodes. This is also unnecessarily complex and requires manual configuration.
Option D is incorrect because it requires peering the two VPCs together. This is not necessary since the VPCs don't have overlapping IP ranges.
Option E is incorrect because it requires adding a Cloud Armor Security Policy to the load balancer that whitelists the internal IPs of the MIG's instances. This is not necessary since the Compute Engine instance is in a different VPC and not part of the Managed Instance Group (MIG).