-
Notifications
You must be signed in to change notification settings - Fork 150
[Feature Request] Allow k8s to discover ingress resources #419
Comments
Just for the record, ingress's status object is same as service's status object[1]. We can probably just reuse most of the code after some refactoring. |
Yes, in fact, this status is copied from an underlying LB service by the ingress controller (e.g. [1]). |
That's an interesting detail. Thanks @networkop. There are two interesting problems:
|
Yeah, I think something like that should work and it's fairly easy to add.
This may not be common but it's definitely possible and even mentioned in the offical k8s ingress docs. Another questions is how to do DNS resolution for these hosts. The most straigh-forward way is to do it locally on the client, based on information provided in |
This will be really good if cloudprober can discover ingress and then provide the golden signals from those ingress.This will be one of the killer feature of cloudprober if can be implemented |
@infa-kparida thanks for the input. Yes, we are planning to add support for the "ingress" resource type. I've not yet figured out how to name targets for multiple host rules within an ingress, for example, we can do: I guess second option is cleaner, though I think we should provide a way to identify which ingress that particular Let me know if you have any opinions on that. Also, we recently added special handling for the target's 'fqdn' label; if present, it becomes the HTTP host header for the probe: cloudprober/probes/http/request.go Line 62 in 4bdceab
We can use this feature and automatically add 'fqdn' label to ingress targets if not present already.
I think for DNS resolution we don't have to depend on the IP provided in the resource; we can let system resolve the IP address. There is a config option for that (though probably not that clear): |
I think Also @manugarg , I was thinking about implementing this locally but then I noticed you've added it to the next milestone. I'm happy to help with the implementation or testing to help speed things up, so please let me know if you need any help. |
Thanks @networkop. I had started a change some time back. I'll try to finish it in a couple of days (it will mostly get submitted around Sep 08 though). I'll let you know how it goes. |
I was over-optimistic to think that I'll get it done over the long weekend :) I've the change out for review (internally) now. It will take a few more days I think. |
As ingresses can have rules with multiple hosts and paths, ingress resources are named as follows: <ingress_name> (if no rules at all) <ingress_name>_<host> (if path is "/") <ingress_name>_<host>__<path with / replaced by _> We attach "fqdn" (=host) and "relative_url" (=path) labels to the resources if these labels are not set already. These labels can then be used inside HTTP probe for automatic configuration. Implements: #419 PiperOrigin-RevId: 331914954
Add ingress resource type to kubernetes targets provider. As ingresses can have rules with multiple hosts and paths, ingress resources are named as follows: <ingress_name> (if no rules at all) <ingress_name>_<host> (if path is "/") <ingress_name>_<host>__<path with / replaced by _> We attach "fqdn" (=host) and "relative_url" (=path) labels to the resources if these labels are not set already. These labels can then be used inside HTTP probe for automatic configuration. Implements: #419 PiperOrigin-RevId: 331914954
Alright, #469 adds support for ingress resources. Following example in the test shows how resources end up getting named and can be filtered using labels:
Ingress resources get the following two labels:
@networkop and @infa-kparida, please let me know if you have any thoughts on it. |
Great, thanks @manugarg , I'll give it a spin in the next few days and let you know. |
Hi @manugarg , here are a few issues I've picked up so far:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
name: rds-reader
rules:
- apiGroups: [""]
resources: ["*"]
verbs: ["get", "list"]
- apiGroups:
- extensions
- "networking.k8s.io" # k8s 1.14+
resources:
- ingresses
- ingresses/status
verbs: ["get", "list"]
|
another issue is that the URL that gets built and the client tries to resolve is in the format |
seems like the above DNS resolution issues are fixed with |
Thanks a lot for checking @networkop.
Yeah, this is expected. I'll update the document.
I didn't get this one. This prefix is added to the metric names. Which URL is this?
So both of these issues were supposed to be resolved by target labels. HTTP probe should use "fqdn" and "relative_url" labels, which are added by RDS automatically ("fqdn" label is used for URL host as well as host header). cloudprober/probes/http/request.go Line 71 in 928d3de
Just to confirm, you tried with cloudprober head, right? Not just the ingress change. I'll investigate more. Thanks a lot for giving it a try. That's very helpful. |
@networkop I tried running an HTTP probe like this:
Where ingress is:
With this I get logs like this:
Notice that the URL is correct here. And metrics look like this (notice additional labels here):
|
hm.. maybe they were false positives. Let me retest tomorrow and report back. |
it looks like it was false positives. I may have had DNS not fully functioning at one point and I looked at |
Thanks so much for confirming @networkop. I'll go ahead mark this issue closed. We can re-open this or file another one if we find a problem with the ingress resources discovery. |
Similar to how dynamic targets can be discovered from pods, endpoints and services, it'd be nice to have RDS discover ingress resources as well. The result would be an FQDN with optional set of IP (if resolved by the RDS server).
The text was updated successfully, but these errors were encountered: