Skip to content

Let CCM reach API server through k8s svc to avoid bad TLS cert #226

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

Conversation

timoreimann
Copy link
Contributor

What this PR does / why we need it:
Currently, our example CCM uses the host IP address for the Kubernetes service host. This is problematic for cases where the original master node disappears (through, say, an initial upscale and subsequent downscale of the control plane) since the certificate won't be valid for that IP address anymore. Example output showing the problem:

E1215 23:06:20.726439       1 leaderelection.go:330] error retrieving resource lock kube-system/cloud-controller-manager: Get https://10.116.0.44:6443/api/v1/namespaces/kube-system/endpoints/cloud-controller-manager: x509: certificate is valid for 10.96.0.1, 67.205.137.20, 138.197.227.228, not 10.116.0.44

The solution is to not overwrite the Kubernetes service host environment variable and let CCM use the kubernetes service normally. This is guaranteed to work because API servers advertise their own IP address on startup, which then becomes part of the continuously reconciled kubernetes service's endpoint set.

Release note:

NONE

Currently, our example CCM uses the host IP address for the Kubernetes
service host. This is problematic for cases where the original master
node disappears (through, say, an initial upscale and subsequent
downscale of the control plane) since the certificate won't be valid for
that IP address anymore. Example output showing the problem:

E1215 23:06:20.726439       1 leaderelection.go:330] error retrieving resource lock kube-system/cloud-controller-manager: Get https://10.116.0.44:6443/api/v1/namespaces/kube-system/endpoints/cloud-controller-manager: x509: certificate is valid for 10.96.0.1, 67.205.137.20, 138.197.227.228, not 10.116.0.44

The solution is to not overwrite the Kubernetes service host environment
variable and let CCM use the `kubernetes` service normally. This is
guaranteed to work because API servers advertise their own IP address on
startup, which then becomes part of the continuously reconciled
`kubernetes` service's endpoint set.
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 16, 2020
@k8s-ci-robot
Copy link

Hi @timoreimann. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 16, 2020
@timoreimann
Copy link
Contributor Author

/assign @prksu

@xmudrii
Copy link
Member

xmudrii commented Dec 16, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 16, 2020
@cpanato
Copy link
Member

cpanato commented Dec 16, 2020

/test pull-cluster-api-provider-digitalocean-e2e

@cpanato
Copy link
Member

cpanato commented Dec 16, 2020

/test all

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, timoreimann

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

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 16, 2020
@k8s-ci-robot k8s-ci-robot merged commit 315917a into kubernetes-sigs:master Dec 16, 2020
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants