Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Kubelet tls bootstrap #2809

Merged
merged 1 commit into from
Feb 12, 2018
Merged

Conversation

abhinavdahiya
Copy link
Contributor

@abhinavdahiya abhinavdahiya commented Jan 24, 2018

Enable kubelet auto TLS bootstrapping.

  • Generates kubeconfig-kublet from a bootstrapping token for kubelet to generate CSRs.
  • Current implementation uses auto-approve all nodes.
  • Requires ca.crt and ca.key to sign CSRs generated by nodes. (handled by kube-controller-mananger)

(kubernetes-retired/bootkube#663)
(https://kubernetes.io/docs/admin/kubelet-tls-bootstrapping/)

cc @aaronlevy @diegs

@coreosbot
Copy link

Can one of the admins verify this patch?

diegs
diegs previously approved these changes Jan 24, 2018
Copy link
Contributor

@diegs diegs left a comment

Choose a reason for hiding this comment

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

Amazing work!

config.tf Outdated
bootkube = "quay.io/coreos/bootkube:v0.8.1"
etcd = "quay.io/coreos/etcd:v3.2.14"
bootkube = "quay.io/coreos/bootkube:v0.10.0"
etcd = "quay.io/coreos/etcd:v3.1.8"
Copy link
Contributor

Choose a reason for hiding this comment

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

why the lower etcd version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, fixed that.

@@ -0,0 +1,43 @@
# admin
# Admin (generated/tls/{admin.key,admin.crt})
# Used to create kubeconfig (generated/auth/kubeconfig) with admin level priviledges.
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling: privileges

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

# Kubelet
resource "tls_private_key" "kubelet" {
# Admin (generated/tls/{admin.key,admin.crt})
# Used to create kubeconfig (generated/auth/kubeconfig) with admin level priviledges.
Copy link
Contributor

Choose a reason for hiding this comment

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

privileges

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -45,11 +61,31 @@ resource "local_file" "kubeconfig" {
filename = "./generated/auth/kubeconfig"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider renaming this one too (to kubeconfig-admin) to make it really clear that you shouldn't use it for anything in the cluster. Others might have different feelings though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Heh, look at the fool who left that TODO there :-/

Copy link
Member

@enxebre enxebre Jan 24, 2018

Choose a reason for hiding this comment

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

may be just add a comment on the kubeconfig file if that does not break any consumer?

@diegs
Copy link
Contributor

diegs commented Jan 24, 2018

cc @ericchiang

@coreosbot
Copy link

Can one of the admins verify this patch?

@diegs diegs closed this Jan 24, 2018
@diegs diegs reopened this Jan 24, 2018
@coreosbot
Copy link

Can one of the admins verify this patch?

@diegs
Copy link
Contributor

diegs commented Jan 24, 2018

ok to test

@diegs
Copy link
Contributor

diegs commented Jan 24, 2018

closed and reopened to trigger smoke tests.

--cni-bin-dir=/var/lib/cni/bin \
--cni-conf-dir=/etc/kubernetes/cni/net.d \
--exit-on-lock-contention \
--kubeconfig=/etc/kubernetes/kubeconfig \
Copy link
Member

@enxebre enxebre Jan 24, 2018

Choose a reason for hiding this comment

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

Why not?:

--kubeconfig=/path/to/to-be-generated-kubeconfig
--require-kubeconfig
--bootstrap-kubeconfig="/path/to/bootstrap/kubeconfig"

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe he alphabetized them.

Copy link
Member

@enxebre enxebre Jan 24, 2018

Choose a reason for hiding this comment

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

I meant what's the reasoning to not use the --bootstrap-kubeconfig flag and then letting the kubelet write the new config on approval in the path pointed by --kubeconfig as suggested here https://kubernetes.io/docs/admin/kubelet-tls-bootstrapping/#kubelet-configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@enxebre
Copy link
Member

enxebre commented Jan 24, 2018

Hey @abhinavdahiya After a quick run, secrets check-pointing seems to be failing:

 Failed to checkpoint secrets for pod kube-system/kube-apiserver-z7d2m: failed to checkpoint secret for pod kube-system/kube-apiserver-z7d2m: failed to retrieve secret kube-system/kube-apiserver: secrets "kube-apiserver" is forbidden: User "system:bootstrap:1xombd" cannot get secrets in the namespace "kube-system"

Sound like the checkpointer using the kubelet bootstrapping kubeconfig?
If so it seems potentially related to https://github.com/coreos/tectonic-installer/pull/2809/files#r163490474 if we use those flags the checkpointer could pick the valid kubeconfig.
Following a different path it seems we are just missing the role/service-account for the checkpointer on the kube_core_renderer, this should fix it https://github.com/coreos-inc/tectonic-operators/pull/227 cc @diegs

@@ -33,8 +33,8 @@ output "id" {
local_file.apiserver_crt.id,
local_file.kube_ca_key.id,
local_file.kube_ca_crt.id,
local_file.kubelet_key.id,
Copy link
Member

@enxebre enxebre Jan 24, 2018

Choose a reason for hiding this comment

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

This needs (along with everything else) to be kept in sync within contrib/user-provided-certs.
@abhinavdahiya We are in the process of decoupling the tls generation from the installer. Eventually we'll rely on modules/tls/user-provided to just wire the previously generated certificates into the installer.
As a transitional step for automation purposes we plan to rely on contrib/user-provided-certs to pre-generate the certificates before moving to a more suitable tool.

Copy link
Contributor Author

@abhinavdahiya abhinavdahiya Jan 24, 2018

Choose a reason for hiding this comment

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

@enxebre I think i have synced all these changes to contrib/user-provided-certs in this PR iteself .
(771525b#diff-1e46a06517303b3aa2caeddc2865efb5)
(771525b#diff-266340c2b198d2324636d1e007ce3a66)
(771525b#diff-a870b0054dd4ceba57305ced8ff8b116)

Is anything else required?

@abhinavdahiya abhinavdahiya force-pushed the kubelet-tls-bootstrap branch 4 times, most recently from a76dc9b to 004fef4 Compare January 24, 2018 22:47
@abhinavdahiya abhinavdahiya reopened this Jan 25, 2018
@coreosbot
Copy link

Can one of the admins verify this patch?

@cpanato
Copy link
Contributor

cpanato commented Jan 26, 2018

retest this please. govcloud only

@cpanato
Copy link
Contributor

cpanato commented Jan 26, 2018

retest this please. aws only

@cpanato
Copy link
Contributor

cpanato commented Jan 26, 2018

retest this please. metal only

@cpanato
Copy link
Contributor

cpanato commented Jan 26, 2018

all tests are green. aws/azure/metal/govcloud.

config.tf Outdated
etcd = "quay.io/coreos/etcd:v3.2.14"
etcd_operator = "quay.io/coreos/etcd-operator:v0.5.0"
hyperkube = "quay.io/coreos/hyperkube:v1.9.1_coreos.0"
kube_core_renderer = "quay.io/coreos/kube-core-renderer:beryllium-m1"
kube_core_renderer = "quay.io/coreos/kube-core-renderer-dev:6c49ce4da9fc36966812381891b4f558aa53097b"
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess there will be a release of kube-core-renderer before this change needs to merge, so that we don't have to carry the dev tag into installer's master?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

//cc: @diegs

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a serious problem with using dev images on master? Then we cut over to release images for release branches?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have any concerns myself as long as we track the follow-up to catch up with the future release.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's go forward with that for now then.

@abhinavdahiya
Copy link
Contributor Author

friendly ping :)

@cpanato
Copy link
Contributor

cpanato commented Feb 2, 2018

@abhinavdahiya can you please rebase? then I can check the tests. thanks!

@enxebre
Copy link
Member

enxebre commented Feb 2, 2018

retest this please

@abhinavdahiya
Copy link
Contributor Author

abhinavdahiya commented Feb 2, 2018

@cpanato rebased against master

@abhinavdahiya abhinavdahiya force-pushed the kubelet-tls-bootstrap branch 2 times, most recently from 0190675 to f4c51c6 Compare February 6, 2018 23:59
@abhinavdahiya
Copy link
Contributor Author

@cpanato rebased against master as after #2850

@abhinavdahiya
Copy link
Contributor Author

any updates on this. :)

@diegs
Copy link
Contributor

diegs commented Feb 8, 2018

retest this please. Needs to re-run after rebase with all platforms.

@abhinavdahiya
Copy link
Contributor Author

@diegs all green

Copy link
Contributor

@alexsomesan alexsomesan left a comment

Choose a reason for hiding this comment

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

Looks good to me.
All issues raised in conversations seem to have satisfactory solutions / explanations.

@alexsomesan alexsomesan merged commit 41126a3 into coreos:master Feb 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants