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

kubeadm: change the default bootstrap token TTL to 24 hours #48783

Merged

Conversation

mattmoyer
Copy link
Contributor

@mattmoyer mattmoyer commented Jul 11, 2017

What this PR does / why we need it:
This PR changes the TTL for the default bootstrap token generated by kubeadm init (without the --token-ttl parameter) and kubeadm token create (without the --ttl flag). Previously, the default TTL was infinite. After this change it is 24 hours.

The reasoning for 2 hours as a default is that it's 1) long enough that someone manually using kubeadm (copy-pasting) shouldn't have any issues and 2) short enough that if something is going to break, it should break while the user/admin is still paying attention to the cluster. I'm open to bikeshedding about the exact value, 2 hours is a bit of a strawman.

Edit: updated this to 24 hours instead of 2 hours.

This is a breaking change if you rely on infinite TTL tokens (e.g., if you had an ASG group of worker nodes). The old behavior is easily restored by passing --token-ttl 0 to kubeadm init or the --ttl 0 flag to kubeadm token create.

Which issue this PR fixes: fixes kubernetes/kubeadm#343

Special notes for your reviewer:
This was discussed earlier today in SIG-cluster-lifecycle

Release note:

Change the default kubeadm bootstrap token TTL from infinite to 24 hours. This is a breaking change. If you require the old behavior, use `kubeadm init --token-ttl 0` / `kubeadm token create --ttl 0`.

cc @jbeda

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 11, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @mattmoyer. Thanks for your PR.

I'm waiting for a kubernetes 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.

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

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 11, 2017
@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 11, 2017
@resouer
Copy link
Contributor

resouer commented Jul 12, 2017

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 12, 2017
// Default behaviour is "never expire" == 0
DefaultTokenDuration = 0
// Default behaviour is 2 hours
DefaultTokenDuration = 2 * time.Hour
Copy link
Contributor

Choose a reason for hiding this comment

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

As you said this have possibility to break existing users, @luxas Do we have any rollout plan to avoid this?

Copy link
Member

Choose a reason for hiding this comment

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

Inform users very well I suppose

@luxas
Copy link
Member

luxas commented Jul 12, 2017

@mattmoyer Please cc me on kubeadm PRs so it's easier for me to notice ;)

@jbeda @mattmoyer Could we make this a day (24 hrs) instead?

@mattmoyer mattmoyer force-pushed the change-kubeadm-default-token-ttl branch from 7b5f534 to 59f9841 Compare July 12, 2017 17:48
@mattmoyer mattmoyer changed the title kubeadm: change the default bootstrap token TTL to 2 hours kubeadm: change the default bootstrap token TTL to 24 hours Jul 12, 2017
mattmoyer added a commit to mattmoyer/kubernetes that referenced this pull request Jul 14, 2017
This adds a warning to `kubeadm init` and `kubeadm token create` if they are run without the `--token-ttl` / `--ttl` flags. In 1.7 and before, the tokens generated by these commands defaulted to an infinite TTL (no expiration) in 1.8, they will generate a token with a 24 hour TTL.

The actual default change is in kubernetes#48783. This change is separate so we can cherry pick the warning into the release-1.7 branch.
@luxas luxas added release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 14, 2017
@luxas
Copy link
Member

luxas commented Jul 14, 2017

/lgtm

Thanks @mattmoyer!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 14, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: luxas, mattmoyer

Associated issue: 343

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 14, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 48572, 48838, 48931, 48783, 47090)

@k8s-github-robot k8s-github-robot merged commit 47f86dd into kubernetes:master Jul 14, 2017
hh pushed a commit to ii/kubernetes that referenced this pull request Jul 14, 2017
…t-token-ttl-warning

Automatic merge from submit-queue (batch tested with PRs 48572, 48838, 48931, 48783, 47090)

kubeadm: add a warning about the default token TTL changing in 1.8

**What this PR does / why we need it**:
This adds a warning to `kubeadm init` and `kubeadm token create` if they are run without the `--token-ttl` / `--ttl` flags. In 1.7 and before, the tokens generated by these commands defaulted to an infinite TTL (no expiration) in 1.8, they will generate a token with a 24 hour TTL.

The actual default change is in kubernetes#48783. This change is separate so we can cherry pick the warning into the `release-1.7` branch.

**Which issue this PR fixes**: ref kubernetes/kubeadm#343

**Special notes for your reviewer**:
This change is blocked on kubernetes/kubeadm#343. These warnings should probably be removed in the 1.9 cycle.

**Release note**:
```release-note
Add a runtime warning about the kubeadm default token TTL changes in 1.8.
```

/assign @luxas
@mattmoyer mattmoyer deleted the change-kubeadm-default-token-ttl branch July 14, 2017 18:03
mattmoyer added a commit to mattmoyer/kubernetes that referenced this pull request Jul 14, 2017
This adds a warning to `kubeadm init` and `kubeadm token create` if they are run without the `--token-ttl` / `--ttl` flags. In 1.7 and before, the tokens generated by these commands defaulted to an infinite TTL (no expiration) in 1.8, they will generate a token with a 24 hour TTL.

The actual default change is in kubernetes#48783. This change is separate so we can cherry pick the warning into the release-1.7 branch.
mattmoyer added a commit to mattmoyer/kubernetes that referenced this pull request Oct 26, 2017
This was broken because the API machinery defaulting mechanism couldn't differentiate between an unset value (which should default to 24 hours) and a value explicitly set to 0 (which should mean infinite).

The fix is to change `TokenTTL` from a `metav1.Duration` to `*metav1.Duration` so that `nil` can represent the unspecified value.

This bug was introduced in kubernetes#48783.
mattmoyer added a commit to mattmoyer/kubernetes that referenced this pull request Oct 26, 2017
This was broken because the API machinery defaulting mechanism couldn't differentiate between an unset value (which should default to 24 hours) and a value explicitly set to 0 (which should mean infinite).

The fix is to change `TokenTTL` from a `metav1.Duration` to `*metav1.Duration` so that `nil` can represent the unspecified value.

This bug was introduced in kubernetes#48783.
mattmoyer added a commit to mattmoyer/kubernetes that referenced this pull request Nov 7, 2017
This was broken because the API machinery defaulting mechanism couldn't differentiate between an unset value (which should default to 24 hours) and a value explicitly set to 0 (which should mean infinite).

The fix is to change `TokenTTL` from a `metav1.Duration` to `*metav1.Duration` so that `nil` can represent the unspecified value.

This bug was introduced in kubernetes#48783.
adnavare pushed a commit to adnavare/kubernetes that referenced this pull request Nov 13, 2017
This was broken because the API machinery defaulting mechanism couldn't differentiate between an unset value (which should default to 24 hours) and a value explicitly set to 0 (which should mean infinite).

The fix is to change `TokenTTL` from a `metav1.Duration` to `*metav1.Duration` so that `nil` can represent the unspecified value.

This bug was introduced in kubernetes#48783.
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. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. 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.

kubeadm init should default to a finite token TTL
7 participants