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

Set default container runtime to containerd #10370

Merged

Conversation

bmelbourne
Copy link
Contributor

What this PR does / why we need it:
As Kubernetes will deprecate Docker runtime support from version 1.20 and will be removed in a future release (currently planned for the 1.22 release in late 2021), set the default container runtime to containerd from kOps 1.20.

https://github.com/kubernetes/kubernetes/tree/master/CHANGELOG/CHANGELOG-1.20.md#deprecation

Which issue(s) this PR fixes
#10356

Special notes for your reviewer:
Merge this PR in to kOps 1.20 release milestone.

@k8s-ci-robot k8s-ci-robot added 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 5, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @bmelbourne. 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.

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 area/documentation size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 5, 2020
@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch from 1dab78d to 15d87e5 Compare December 5, 2020 19:53
@bmelbourne bmelbourne changed the title Set default container runtime to containerd [WIP] Set default container runtime to containerd Dec 5, 2020
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 5, 2020
@olemarkus
Copy link
Member

This only changes the default for new clusters. It does not change anything for existing.

I would think that you need a check for k8s version. We only support/test containerd as of k8s 1.18. I suspect we want the default to change only for 1.20+ clusters.

@bmelbourne
Copy link
Contributor Author

bmelbourne commented Dec 6, 2020

This only changes the default for new clusters. It does not change anything for existing.

I would think that you need a check for k8s version. We only support/test containerd as of k8s 1.18. I suspect we want the default to change only for 1.20+ clusters.

I'm working on exactly that scenario and testing various cluster configs including Terraform to ensure the default container runtime remains as docker for kOps versions up to 1.19.

I pushed my initial commits somewhat early to the PR before completing testing of the final solution.

@olemarkus
Copy link
Member

Right now, it looks like we are setting defaults in two places. The one in create_cluster.go that you already changed, and in pkg/model/components/defaults.go. I would completely remove the one in create_cluster.go and rely on the other one instead. Here you have better access to the kubernetes version.

@hakman
Copy link
Member

hakman commented Dec 6, 2020

The point of setting the container runtime in 2 places was to be able to change the default only for newly created clusters.
At the moment, there is a pending discussion in the Office Hours meeting about when would be the right time and how to approach this change in kOps.

That being said, I think getting this to ready is a good step and I think 1.20 is a good goal to change the default for newly created clusters.

/ok-to-test
/hold until agreement is reached

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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 6, 2020
@olemarkus
Copy link
Member

It makes sense to perhaps to make the change only for new clusers, perhaps not. At some point we need to change the default for everyone anyway.

You can have a look at new_cluster.go then. There are some options there that are set based on k8s version.

@hakman
Copy link
Member

hakman commented Dec 6, 2020

I think for now it's ok to not think about k8s version. I think we will switch it on for all new clusters.
To make this work, this will have to be relaxed and not require a containerd version and run hack/update-expected.sh:

if b.IsKubernetesGTE("1.19") {
containerd.Version = fi.String("1.4.3")
} else if b.IsKubernetesGTE("1.18") {
containerd.Version = fi.String("1.3.4")
} else {
return fmt.Errorf("containerd version is required")
}

@bmelbourne
Copy link
Contributor Author

bmelbourne commented Dec 6, 2020

It makes sense to perhaps to make the change only for new clusers, perhaps not. At some point we need to change the default for everyone anyway.

You can have a look at new_cluster.go then. There are some options there that are set based on k8s version.

My initial testing had been based on new code introduced in new_cluster.go but with the deprecation release note, I thought this would result in some potentially confusing scenarios for users creating new and upgrading existing clusters to K8s 1.20+, so I moved the code to defaults.go where it could be better maintained going forward.

If users then choose to continue using Docker as their (unsupported) container runtime beyond K8s and kOps versions 1.20+, then they would need to override the default setting using either --container-runtime=docker or containerRuntime: docker. From an Operations perspective, this is very clear and obvious to all support engineers maintaining K8s/kOps clusters.

@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch from f2582e6 to dd1cc2b Compare December 6, 2020 15:20
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 6, 2020
@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch 2 times, most recently from af1675e to a639bef Compare December 12, 2020 11:23
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 12, 2021
@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch from 05500e6 to 7e98674 Compare January 12, 2021 20:51
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 12, 2021
@bmelbourne
Copy link
Contributor Author

/retest

@hakman
Copy link
Member

hakman commented Jan 13, 2021

/test pull-kops-e2e-kubernetes-aws

@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch from 7e98674 to 17ba475 Compare January 13, 2021 20:14
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 13, 2021
@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch from 17ba475 to e0ecd74 Compare January 14, 2021 18:51
@hakman
Copy link
Member

hakman commented Jan 15, 2021

@bmelbourne after discussing a bit, decided to set the k8s version from integration tests to "1.20.0" and thought it was best to do it before this PR, to see changes. Also, the networking is set to "cni" to avoid extra customizations for that.
Does this sound good to you? If so, can you rebase and update the PR? I plan to take a look at it this weekend anyway.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 15, 2021
@bmelbourne
Copy link
Contributor Author

@bmelbourne after discussing a bit, decided to set the k8s version from integration tests to "1.20.0" and thought it was best to do it before this PR, to see changes. Also, the networking is set to "cni" to avoid extra customizations for that.
Does this sound good to you? If so, can you rebase and update the PR? I plan to take a look at it this weekend anyway.

That was good timing, I'm just in the process of rebasing the other containerd changes now.
Once I've completed my own integration testing, I should have everything committed sometime tomorrow.

@hakman
Copy link
Member

hakman commented Jan 15, 2021

Thanks! No worries, I can look at the code without the tests part too.

Copy link
Member

@hakman hakman left a comment

Choose a reason for hiding this comment

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

As promised, I made another pass over the PR. Looks pretty well, just small changes needed.
Please rebase and use the k8s versions and network settings that were updated in #10591. The changes to the integration tests should be smaller like this.

pkg/model/components/containerd.go Outdated Show resolved Hide resolved
pkg/model/components/defaults.go Outdated Show resolved Hide resolved
upup/pkg/fi/cloudup/containerd_test.go Outdated Show resolved Hide resolved
docs/releases/1.20-NOTES.md Outdated Show resolved Hide resolved
docs/cluster_spec.md Outdated Show resolved Hide resolved
@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch from ac6b95b to 632a23c Compare January 16, 2021 12:23
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 16, 2021
@bmelbourne bmelbourne force-pushed the set-default-runtime-containerd branch from 632a23c to 337c9c4 Compare January 16, 2021 15:39
@bmelbourne
Copy link
Contributor Author

bmelbourne commented Jan 16, 2021

@bmelbourne after discussing a bit, decided to set the k8s version from integration tests to "1.20.0" and thought it was best to do it before this PR, to see changes. Also, the networking is set to "cni" to avoid extra customizations for that.
Does this sound good to you? If so, can you rebase and update the PR? I plan to take a look at it this weekend anyway.

That was good timing, I'm just in the process of rebasing the other containerd changes now.
Once I've completed my own integration testing, I should have everything committed sometime tomorrow.

I've completed the rebasing of the latest master changes and local integration testing.

I've also updated tests\integration\create_cluster\minimal\options.yaml to K8s v1.20.0 as I believe this was missed in previous commits.

@hakman
Copy link
Member

hakman commented Jan 16, 2021

This looks perfect now @bmelbourne. Thanks!
/retest
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 16, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bmelbourne, hakman

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 16, 2021
@hakman
Copy link
Member

hakman commented Jan 16, 2021

/test pull-kops-e2e-k8s-containerd

@k8s-ci-robot k8s-ci-robot merged commit 2cc4d16 into kubernetes:master Jan 16, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Jan 16, 2021
@bmelbourne bmelbourne deleted the set-default-runtime-containerd branch January 16, 2021 18:28
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. area/documentation 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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants