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

Add Hostname to HealthCheckConfig #1046

Closed
tmc opened this issue Mar 3, 2020 · 12 comments
Closed

Add Hostname to HealthCheckConfig #1046

tmc opened this issue Mar 3, 2020 · 12 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@tmc
Copy link

tmc commented Mar 3, 2020

Right now the HealthCheckConfig can't/doesn't allow specification of the Host header to send with the health check.

@mark-church
Copy link

mark-church commented Apr 3, 2020

Hi @tmc thanks for your question. We have not implemented this yet as we focused on configurability of the path first. Can you detail a little more on the use case for the host header in a health check and what kind of systems require this? cc @bowei

@tmc
Copy link
Author

tmc commented Apr 4, 2020

A use case is as follows:
If you service a health check from within a cluster with a VirtualService say with a VS like so:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
 name: healthcheck-virtualservice
spec:
 gateways:
   - foo-system/generic-gateway
 hosts:
   - healthcheck.foobar.com
 http:
   - match:
     - uri:
         exact: /
     rewrite:
       uri: /healthz/ready
     route:
     - destination:
         host: istio-ingressgateway.istio-system.svc.cluster.local
         port:
           number: 15020

If this healthcheck didn't have a specific hostname then the behavior of the cluster is surprising to developers/operators as the default request is then a content-free 200.

The hostname can be configured on the healthcheck but I'd prefer to hand this to a control plane as configuration rather than deal with additional configuration and state that might get removed or reset.

@mark-church
Copy link

Hi @tmc

Does configuring the path of the GCE health check also solve the problem? It would be configured in the BackendConfig which will be supported soon by #1040. Note that this PR does not support changing of the health check hostname, only path.

It could be done like this and referenced by the Service:

apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
  name: http-hc-config
spec:
  healthCheck:
    type: http
    requestPath: /healthz/ready

Then all hosts with /healthz/ready are matched and sent to the ingressgateway health check.

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
 name: healthcheck-virtualservice
spec:
 gateways:
   - foo-system/generic-gateway
 hosts:
   - *
 http:
   - match:
     - uri:
         exact: /healthz/ready
     route:
     - destination:
         host: istio-ingressgateway.istio-system.svc.cluster.local
         port:
           number: 15020

Let me know if this has the same effect for you as changing the health check hostname.

@rramkumar1 rramkumar1 added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 20, 2020
@anderspetersson
Copy link

anderspetersson commented Jun 4, 2020

Changing the path does not solve this issue for me.

My application checks for hostname and does custom logic (For example customer domain CNAME to my domain to show a customers page) based on requested hostname.

I have set the hostname in the console but would obviously prefer to have this in reproducible config files as well.

@mark-church
Copy link

mark-church commented Jun 4, 2020

Direct health check configuration is currently in development. It will roll out to GKE 1.17 and 1.16 likely within the next 1-2 months. Here are the fields that will be supported. Unfortunately hostname header did not make the cut because of some complications but we hope that these fields will at least make health checking somewhat easier and more predictable:

  • checkIntervalSec: [int]
  • timeoutSec: [int]
  • healthyThreshold: [int]
  • unhealthyThreshold: [int]
  • type: [HTTP | HTTPS | HTTP2]
  • port: [int]
  • requestPath: [string]

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 2, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 2, 2020
@rick-pri
Copy link

rick-pri commented Oct 26, 2020

Direct health check configuration is currently in development. It will roll out to GKE 1.17 and 1.16 likely within the next 1-2 months. Here are the fields that will be supported. Unfortunately hostname header did not make the cut because of some complications but we hope that these fields will at least make health checking somewhat easier and more predictable:

That's unfortunate as Django has an ALLOWED_HOSTS setting which should be set specifically to the expected hosts for your app but this just returns a 400 for the healthcheck because the host is set to a subnet range IP address. Allow a custom request path doesn't help in that instance (although in some of our applications this is an additional complication.)

@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/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.

@dariemp
Copy link

dariemp commented Mar 10, 2021

I need a health check for my Django app that supports sending the HOST header so the app can match ALLOWED_HOSTS.

/reopen

@k8s-ci-robot
Copy link
Contributor

@dariemp: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

I need a health check for my Django app that supports sending the HOST header so the app can match ALLOWED_HOSTS.

/reopen

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
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

8 participants