Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate rules created in load balancer #821

Closed
gijo-varghese opened this issue Aug 10, 2019 · 12 comments
Closed

Duplicate rules created in load balancer #821

gijo-varghese opened this issue Aug 10, 2019 · 12 comments

Comments

@gijo-varghese
Copy link

gijo-varghese commented Aug 10, 2019

Every time I add a new rule to the ingress, it creates multiple rules in the load balancer. The rules are basically the same, pointing to the same backend

Here is my ingress file:

apiVersion: networking.gke.io/v1beta1
kind: ManagedCertificate
metadata:
  name: ingress-test.wpspeedmatters.com
spec:
  domains:
    - ingress-test.wpspeedmatters.com
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: basic-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: wordpress-ip
    networking.gke.io/managed-certificates: ingress-test.wpspeedmatters.com
spec:
  backend:
    serviceName: wordpress
    servicePort: 8080
  rules:
    - host: ingress-test.wpspeedmatters.com
      http:
        paths:
          - path: /*
            backend:
              serviceName: wordpress
              servicePort: 8080

Here are the duplicate rules created in the load balancer:
AwesomeScreenshot-console-cloud-google-net-services-loadbalancing-details-http-k8s-um-default-basic-ingress--6dca0e07f90e8063-2019-08-10_8_53

@rramkumar1
Copy link
Contributor

@gijo-varghese Nothing about your Ingress spec stands out, it looks pretty normal...

Can you dump the contents of the url map k8s-um-default-basic-ingress--6dca0e07f... via the gcloud command line tool? I want to see if the output JSON also has duplicate rules. This would rule out some sort of UI issue.

@gijo-varghese
Copy link
Author

gijo-varghese commented Aug 11, 2019

@rramkumar1 here is the dump of a similar load balancer:

creationTimestamp: '2019-08-11T07:05:44.900-07:00'
defaultService: https://www.googleapis.com/compute/v1/projects/messengerify-test/global/backendServices/k8s-be-32748--6ec2919d9eb52b04
fingerprint: vkwPEy0akm4=
hostRules:
- hosts:
  - test-one.wpspeedmatters.com
  pathMatcher: hostdcdca3d119ea4935b7ac809d619cb470
- hosts:
  - test-two.wpspeedmatters.com
  pathMatcher: host3ceb073eb7b244992ec05cfec239fc09
id: '8242956804984512087'
kind: compute#urlMap
name: k8s-um-default-basic-ingress--6ec2919d9eb52b04
pathMatchers:
- defaultService: https://www.googleapis.com/compute/v1/projects/messengerify-test/global/backendServices/k8s-be-32748--6ec2919d9eb52b04
  name: hostdcdca3d119ea4935b7ac809d619cb470
  pathRules:
  - paths:
    - /*
    service: https://www.googleapis.com/compute/v1/projects/messengerify-test/global/backendServices/k8s-be-32748--6ec2919d9eb52b04
- defaultService: https://www.googleapis.com/compute/v1/projects/messengerify-test/global/backendServices/k8s-be-32748--6ec2919d9eb52b04
  name: host3ceb073eb7b244992ec05cfec239fc09
  pathRules:
  - paths:
    - /*
    service: https://www.googleapis.com/compute/v1/projects/messengerify-test/global/backendServices/k8s-be-32748--6ec2919d9eb52b04
selfLink: https://www.googleapis.com/compute/v1/projects/messengerify-test/global/urlMaps/k8s-um-default-basic-ingress--6ec2919d9eb52b04

and view of load balancer:
Screenshot from 2019-08-11 19-52-04

@gijo-varghese
Copy link
Author

gijo-varghese commented Aug 11, 2019

@rramkumar1 the reason for the duplicate rule I think is because the first rule is created for 'defaultService' and the second one for 'pathRules/paths'

any way to specify backend for a domain without adding 'paths'?

@rramkumar1
Copy link
Contributor

rramkumar1 commented Aug 12, 2019

@gijo-varghese Yea appears that is the case, although I remember the UI rendering it differently...

any way to specify backend for a domain without adding 'paths'?

I believe if you leave "paths" empty, we fill in "/*" for you but I don't see how that would change the UI. It seems like your UrlMap is structurally correct so I don't think this is any sort of bug. Perhaps they changed the UI a bit which is why this looks a little weird.

Given that, can we close this?

@gijo-varghese
Copy link
Author

@rramkumar1 ok. My concern is about the price. Since there are duplicate rules in the UI (4 rules), will I be charged for 4 rules or 2 rules?

@rramkumar1
Copy link
Contributor

@gijo-varghese Please correct me if I am wrong, but you are never charged for individual rules in a UrlMap. You are only charged for ForwardingRules themselves (which are a completely different API resource).

@gijo-varghese
Copy link
Author

@rramkumar1

individual rules in a UrlMap

What does this mean?

See the below rules:
b09bc42a-777a-44c8-5cd8-0f7168814de2
In this case, will I be charged for 5 (total) or 4 (duplicate rules) or 2 rules?

@gijo-varghese
Copy link
Author

Here are the Load balancing and forwarding rules pricing: https://cloud.google.com/compute/all-pricing#lb

@rramkumar1
Copy link
Contributor

In this case, will I be charged for 5 (total) or 4 (duplicate rules) or 2 rules?

You will not be charged anything. These are rules in a UrlMap resource and a UrlMap resource does not incur any charges. What you are charged for is a ForwardingRule. If you look under the "Frontend" heading, you will see two entries (HTTP and HTTPS). These correspond to ForwardingRules. You are charged for those.

@gijo-varghese
Copy link
Author

haha! Thanks a lot 😄

I was thinking about some weird solutions like this! https://stackoverflow.com/questions/57456652/how-to-use-gke-ingress-along-with-nginx-ingress/

@rramkumar1
Copy link
Contributor

/close

@k8s-ci-robot
Copy link
Contributor

@rramkumar1: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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

No branches or pull requests

3 participants