Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Error Ensuring Firewall rules when running on Clusters in a Shared VPC #217

Open
boredabdel opened this issue Feb 27, 2019 · 5 comments
Open

Comments

@boredabdel
Copy link
Member

boredabdel commented Feb 27, 2019

Hi,

I'm having an issue with kubemci trying to create a multi cluster ingress across two clusters that are attached to a sharedvpc.

Shared VPC in project A. This is the Host project
Cluster 1 in project B Attached to the Shared VPC in project A
Cluster 2 in project B Attached to the Shared VPC in project A

Same service running on both clusters listening to the same node port.

I0227 15:24:45.316852 52427 gen.go:5430] GCEFirewalls.Insert(context.Background, Key{"mci1-fr--nginx-mci"}, ...): projectID = PROJECT_B, rk = &{ProjectID:PROJECT_B Operation:Insert Version:ga Service:Firewalls}
I0227 15:24:45.408566 52427 gen.go:5441] GCEFirewalls.Insert(context.Background, Key{"mci1-fr--nginx-mci"}, ...) = googleapi: Error 400: Invalid value for field 'resource.network': 'https://www.googleapis.com/compute/v1/projects/PROJECT_A/global/networks/PROJECT_A'. Cross project referencing is not allowed for this resource., invalid
Error ensuring firewall rule: Error googleapi: Error 400: Invalid value for field 'resource.network': 'https://www.googleapis.com/compute/v1/projects/PROJECT_A/global/networks/PROJECT_A
. Cross project referencing is not allowed for this resource., invalid in ensuring firewall rule
Error: Error in creating load balancer: 1 error occurred:

What i think happens is the following

1 - kubemci check the project hosting the cluster (PROJECT_B in my case) for a specific firewall rule.
2 - The call fails, so it calls the EnsureFirewallRule function to create those.
3 - The call fails because the API called behind apparently doesn't support creating a firewall rule in a different project then the one where the call is made. hence the error "Cross project referencing is not allowed for this resource"

I understand that kubemci is trying to create fw rules for the LB Health Check and Backend Service IP Ranges. But we could create those in the shared VPC project manually or via a script. will it be possible to have a flag to kubemci to skip trying to create firewall rules ?

@jawlitkp
Copy link

jawlitkp commented Mar 5, 2019

Having the same issue. please provide work around

@boredabdel
Copy link
Member Author

This have been fixed already.

You just need to add the following annotation to the ingress definition to silence the alerts about firewall rules.

networking.gke.io/suppress-firewall-xpn-error: "true"

@boredabdel
Copy link
Member Author

Got confused with this and an other issue, reopening as we do need a workaround for this issue,

@boredabdel boredabdel reopened this Mar 12, 2019
@artazar
Copy link

artazar commented Oct 29, 2019

I am facing exactly the same issue, is there any known workaround available?

@nikhiljindal
Copy link
Contributor

Yes this is a known issue. kubemci does not support XPN: #56.

I havent tried them myself, but 2 potential workarounds I can think of are:

  1. Create the Firewall rule manually. Or
  2. Try the patch: Networks #222

To create the firewall rule manually: Run the kubemci create command so that it creates all other resources. Then create the necessary firewall rule yourself. Ensure that you use the right project.
You can create the firewall rule manually by using cloud console, or by running the appropriate gcloud command: https://cloud.google.com/sdk/gcloud/reference/compute/firewall-rules/create.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants