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

Use SSL health checks for ELBs when backend protocol is SSL/HTTPS #70309

Open
wants to merge 3 commits into
base: master
from

Conversation

@2rs2ts
Copy link
Contributor

2rs2ts commented Oct 26, 2018

Fixes #45746

What type of PR is this?

/kind feature

What this PR does / why we need it:
Previously, all health checks were HTTP or TCP type, which meant that if the backend was actually listening for SSL traffic, there would be SSL handshake errors, and out of the box this causes many servers to log a lot of noise about said handshake errors. By setting the health check protocol to HTTPS/SSL, these errors can be avoided.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #45746

Special notes for your reviewer:
I didn't see any established tests for this code path, and since it's happening in a very long function I didn't feel comfortable trying to write a new test, so I apologize for not including any tests here.

Does this PR introduce a user-facing change?:

AWS ELB health checks will now use HTTPS/SSL protocol for HTTPS/SSL backends.

/sig aws

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Oct 26, 2018

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 2rs2ts
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: justinsb

If they are not already assigned, you can assign the PR to them by writing /assign @justinsb in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@2rs2ts

This comment has been minimized.

Copy link
Contributor

2rs2ts commented Oct 26, 2018

/assign @justinsb

@idealhack

This comment has been minimized.

Copy link
Member

idealhack commented Oct 29, 2018

/ok-to-test

@sstarcher sstarcher referenced this pull request Nov 19, 2018

Closed

TLS enabled error spam #355

@idealhack

This comment has been minimized.

Copy link
Member

idealhack commented Nov 19, 2018

kindly ping @2rs2ts for rebase

@2rs2ts

This comment has been minimized.

Copy link
Contributor

2rs2ts commented Nov 27, 2018

can this PR be merged now?

@idealhack

This comment has been minimized.

Copy link
Member

idealhack commented Nov 28, 2018

@mcrute

This comment has been minimized.

Copy link
Contributor

mcrute commented Nov 28, 2018

/lgtm

@micahhausler

This comment has been minimized.

Copy link
Member

micahhausler commented Nov 28, 2018

Is this going to work with self-signed certificates on the backend? What about a kubernetes-CA signed kubelet-server certificate? @2rs2ts have you tested this?

@mcrute

This comment has been minimized.

Copy link
Contributor

mcrute commented Nov 28, 2018

Health checks do not consider certificate chain trust, just the ability to connect via TLS and to read an HTTP response.

@2rs2ts

This comment has been minimized.

Copy link
Contributor

2rs2ts commented Nov 29, 2018

@micahhausler I did in fact test this with a backend cert signed by a company-internal CA that isn't explicitly trusted by the ELBs. The ELBs don't have backend cert trust policies set up on them anyway, so they will trust anything.

@2rs2ts

This comment has been minimized.

Copy link
Contributor

2rs2ts commented Dec 31, 2018

/unassign @justinsb

(I hear he is no longer reviewing PRs)

@d-nishi

This comment has been minimized.

Copy link

d-nishi commented Dec 31, 2018

/assign M00nf1sh

if path, healthCheckNodePort := service.GetServiceHealthCheckPathPort(apiService); path != "" {
klog.V(4).Infof("service %v (%v) needs health checks on :%d%s)", apiService.Name, loadBalancerName, healthCheckNodePort, path)
err = c.ensureLoadBalancerHealthCheck(loadBalancer, "HTTP", healthCheckNodePort, path, annotations)
if annotationProtocol == "https" || annotationProtocol == "ssl" {

This comment has been minimized.

@M00nF1sh

M00nF1sh Jan 2, 2019

This won't work, since the healthCheck for externalTrafficPolicy==Local(which triggers this branch) is in HTTP, no matter what ServiceAnnotationLoadBalancerBEProtocol is

This comment has been minimized.

@2rs2ts

2rs2ts Jan 2, 2019

Contributor

Thanks for letting me know. So I can just check if (annotationProtocol == "https" || annotationProtocol == "ssl") && apiService.Spec.ExternalTrafficPolicy != api.ServiceExternalTrafficPolicyTypeLocal and then I'll be good?

This comment has been minimized.

@M00nF1sh

M00nF1sh Jan 2, 2019

Hi, you can just leave this code branch untouched(i.e. still pass "HTTP" as protocol"), since this branch is only triggered when externalTrafficPolicy==Local, see https://github.com/kubernetes/kubernetes/blob/master/pkg/api/v1/service/util.go#L88

This comment has been minimized.

@M00nF1sh

M00nF1sh Jan 2, 2019

FYI, The healthCheck listener is allocated by k8s on nodes for externalTrafficPolicy==Local as HTTP, which returns 200 on nodes with pods of that service and 503 vice versa, which is not related to your backend application protocol(just to check whether this node can proxy traffic to your backend)

see

if err := svc.server.Serve(svc.listener); err != nil {

@k8s-ci-robot k8s-ci-robot added size/XS and removed lgtm size/S labels Jan 3, 2019

@2rs2ts 2rs2ts changed the title Use SSL/HTTPS health checks for ELBs when backend protocol is SSL/HTTPS Use SSL health checks for ELBs when backend protocol is SSL/HTTPS Jan 3, 2019

@M00nF1sh

This comment has been minimized.

Copy link

M00nF1sh commented Jan 3, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Jan 3, 2019

@2rs2ts

This comment has been minimized.

Copy link
Contributor

2rs2ts commented Jan 4, 2019

I do not understand these errors, to be quite honest they seem unrelated to my changes.

/retest

@M00nF1sh

This comment has been minimized.

Copy link

M00nF1sh commented Jan 4, 2019

I do not understand these errors, to be quite honest they seem unrelated to my changes.

/retest

I don't think it's related to your PR, we'll investigate it and let you know

@2rs2ts

This comment has been minimized.

Copy link
Contributor

2rs2ts commented Jan 11, 2019

@M00nF1sh how goes the investigation?

@M00nF1sh

This comment has been minimized.

Copy link

M00nF1sh commented Jan 11, 2019

/test pull-kubernetes-e2e-kops-aws
/test pull-kubernetes-integration
i don't got time to investigate this yet, these tests have been flake for a long time.(trying rerun :D)

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Jan 12, 2019

@2rs2ts: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kops-aws 72895a8 link /test pull-kubernetes-e2e-kops-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment