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

Use host.docker.internal in local-garden #2641

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

timebertt
Copy link
Member

@timebertt timebertt commented Jul 31, 2020

How to categorize this PR?

/area dev-productivity
/kind enhancement
/priority normal

What this PR does / why we need it:
This PR replaces docker.for.mac.localhost by host.docker.internal in our scripts for spinning up the local nodeless garden.
This way, connection from the docker VM to the host is unified for Mac and Windows users.
It also adds host.docker.internal to the local garden API server cert, so you can talk to it from within a docker container without TLS verification errors.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

The `local-garden`'s kube-apiserver cert has been updated to include `host.docker.internal` as an alternative DNS Name, so clients running in docker containers can successfully validate the TLS cert when talking to the local garden. If you have copied the `local-garden` kubeconfig to somewhere else, please update your copy with the newly generate one.

@timebertt timebertt requested a review from a team as a code owner July 31, 2020 11:16
@gardener-robot gardener-robot added area/dev-productivity Developer productivity related (how to improve development) kind/enhancement Enhancement, improvement, extension priority/normal labels Jul 31, 2020
@gardener-robot
Copy link

@timebertt Thank you for your contribution.

@gardener-robot-ci-2
Copy link
Contributor

Thank you @timebertt for your contribution. I will start a build for your PR. Once started, the build URL will be posted here.

@gardener-robot-ci-2
Copy link
Contributor

A build of this pull request has started. You can check on its progress here: https://concourse.ci.gardener.cloud/teams/gardener/pipelines/gardener-master/jobs/master-pull-request-job/builds/166

@gardener-robot-ci-1
Copy link
Contributor

A build of this pull request has started. You can check on its progress here: https://concourse.ci.gardener.cloud/teams/gardener/pipelines/gardener-master/jobs/master-pull-request-job/builds/167

@timuthy
Copy link
Contributor

timuthy commented Jul 31, 2020

What about host.docker.internal? 👀

@timebertt
Copy link
Member Author

What about host.docker.internal? 👀

Well, good idea. host.docker.internal is available both on Windows and Mac, right?

@timuthy
Copy link
Contributor

timuthy commented Jul 31, 2020

What about host.docker.internal? 👀

Well, good idea. host.docker.internal is available both on Windows and Mac, right?

It was already advertised by 17.12.0 as the release notes say. So we can probably completely drop docker.for.mac.localhost.
/cc @rfranzke

@timebertt
Copy link
Member Author

Nice suggestion.
I've updated the PR to basically replace docker.for.mac.localhost with host.docker.internal.
/title Use host.docker.internal in local-garden

/invite @guydaichs @vpnachev
Can you check, that the local-garden still works as expected before on windows and linux?

@gardener-robot gardener-robot changed the title Add docker.for.mac.localhost to local garden certs use host.docker.internal in local-garden Jul 31, 2020
@timebertt timebertt changed the title use host.docker.internal in local-garden Use host.docker.internal in local-garden Jul 31, 2020
@timebertt timebertt requested a review from timuthy July 31, 2020 13:49
@vpnachev
Copy link
Member

I can confirm that local-garden is working fine for me (on ubuntu 18.04) with and without this change.
But I would like to mention that I cannot resolve host.docker.internal from whithin containers because simply this feature is available only on Docker for Windoes/Mac - ref: docker/for-linux#264.

/lgtm

Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

When I run make start-apiserver after I ran make local-garden-up then I get following error:

$ make start-apiserver
Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes-ca")
Found Nodeless Kubernetes ...
I0803 07:23:46.788772   92804 plugins.go:84] Registered admission plugin "ResourceReferenceManager"
I0803 07:23:46.788858   92804 plugins.go:84] Registered admission plugin "DeletionConfirmation"
I0803 07:23:46.788862   92804 plugins.go:84] Registered admission plugin "ExtensionValidator"
I0803 07:23:46.788865   92804 plugins.go:84] Registered admission plugin "ShootTolerationRestriction"
I0803 07:23:46.788870   92804 plugins.go:84] Registered admission plugin "ShootQuotaValidator"
I0803 07:23:46.788875   92804 plugins.go:84] Registered admission plugin "ShootDNS"
I0803 07:23:46.788879   92804 plugins.go:84] Registered admission plugin "ShootValidator"
I0803 07:23:46.788882   92804 plugins.go:84] Registered admission plugin "ControllerRegistrationResources"
I0803 07:23:46.788885   92804 plugins.go:84] Registered admission plugin "PlantValidator"
I0803 07:23:46.788889   92804 plugins.go:84] Registered admission plugin "OpenIDConnectPreset"
I0803 07:23:46.788893   92804 plugins.go:84] Registered admission plugin "ClusterOpenIDConnectPreset"
I0803 07:23:46.788915   92804 plugins.go:84] Registered admission plugin "ShootStateDeletionValidator"
I0803 07:23:46.788922   92804 plugins.go:84] Registered admission plugin "CustomVerbAuthorizer"
W0803 07:23:47.093386   92804 configmap_cafile_content.go:102] unable to load initial CA bundle for: "client-ca::kube-system::extension-apiserver-authentication::client-ca-file" due to: configmap "extension-apiserver-authentication" not found
W0803 07:23:47.093422   92804 configmap_cafile_content.go:102] unable to load initial CA bundle for: "client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file" due to: configmap "extension-apiserver-authentication" not found
Error: unable to load configmap based request-header-client-ca-file: Get "https://localhost:2443/api/v1/namespaces/kube-system/configmaps/extension-apiserver-authentication": x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes-ca")

Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

Turns out that I had to update my local ~/.kube.config file to the new default admin kubeconfig.. thanks for the pointers! With it, it works as expected!

/lgtm

@rfranzke rfranzke merged commit 2eec97f into gardener:master Aug 3, 2020
Copy link
Contributor

@guydc guydc left a comment

Choose a reason for hiding this comment

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

works in my WSL2 env as well

@rfranzke
Copy link
Member

rfranzke commented Aug 3, 2020

Thanks @guydaichs for your feedback!

@timebertt timebertt deleted the enh/local-garden branch August 3, 2020 08:50
@timebertt
Copy link
Member Author

Added a release note for action developer to make developers aware, that they need to refresh copies of the local-garden kubeconfig.

@gardener-robot gardener-robot added priority/3 Priority (lower number equals higher priority) and removed priority/3 Priority (lower number equals higher priority) labels Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dev-productivity Developer productivity related (how to improve development) kind/enhancement Enhancement, improvement, extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants