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

update coredns for security best practice #8550

Closed
wants to merge 2 commits into from
Closed

update coredns for security best practice #8550

wants to merge 2 commits into from

Conversation

Ewocker
Copy link

@Ewocker Ewocker commented Feb 13, 2020

  • use non-root user
  • remove container privilege
  • change core port so that no need cap NET_BIND_SERVICE
  • update service kube-dns to use targetPort name to be kube-dns compatible on migration

Note:
During migration when kops is patching service kube-dns, duplicate port number might cause issue that only the first port has the correct targetPort name. In this case kubectl replace needs to be use to resolve the problem. See issue kubernetes/kubernetes#47249

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 13, 2020
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please log a ticket with the Linux Foundation Helpdesk: https://support.linuxfoundation.org/
  • Should you encounter any issues with the Linux Foundation Helpdesk, send a message to the backup e-mail support address at: [email protected]

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 cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 13, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @Ewocker. 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 the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 13, 2020
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 13, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ewocker
To complete the pull request process, please assign kashifsaadat
You can assign the PR to them by writing /assign @kashifsaadat in a comment when ready.

The full list of commands accepted by this bot can be found 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

@johngmyers
Copy link
Member

/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 Feb 13, 2020
@Ewocker Ewocker marked this pull request as ready for review February 19, 2020 00:33
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 19, 2020
@johngmyers
Copy link
Member

/retest

@johngmyers
Copy link
Member

I'm not quite sure what to do with this apparent bug in the core/v1 ServiceSpec API. It's not like we can neuter the kube-dns service and put in a kube-dns-kops service instead.

We're execing kubectl apply -f, so we don't seem to have much opportunity to recognize the case and do an update instead of a strategic patch.

@Ewocker Ewocker requested a review from liggitt February 19, 2020 22:17
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 25, 2020
@johngmyers
Copy link
Member

In researching for the kops office hours, I found that "server side apply" is the Kubernetes-level fix for the broken strategic patch. That is a beta feature right now.

The decision from office hours is that server side apply is too new and risky to take on now. The approach would be to get channels to use delete-and-replace instead of apply.

The question then becomes how to decide to do delete-and-replace. Some options I see:

  • Pull the "kubectl apply -f" logic into channels so that we can add code to detect when the patch doesn't apply correctly and then choose an alternate update flow.
  • Add metadata to the addon to tell channels to use the alternate flow across a particular version boundary.

We should consider whether an option can also address the immutable field problem.

@rifelpet
Copy link
Member

While this isn't directly related, I think one other issue that could benefit from adjusting how Kops applies channels is the removal of resources. If a manifest no longer defines a resource (either during an upgrade or downgrade) kubectl apply -f will not delete it which leaves it lingering and unmanaged in the cluster. kubectl apply has a prune field but I'm not sure if that is sufficient. If the new channel application strategy could handle that as well, that'd be great.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2020
@Ewocker
Copy link
Author

Ewocker commented Mar 3, 2020

While this isn't directly related, I think one other issue that could benefit from adjusting how Kops applies channels is the removal of resources. If a manifest no longer defines a resource (either during an upgrade or downgrade) kubectl apply -f will not delete it which leaves it lingering and unmanaged in the cluster. kubectl apply has a prune field but I'm not sure if that is sufficient. If the new channel application strategy could handle that as well, that'd be great.

@rifelpet In this case while transitioning from kubedns to coredns, would kubedns be removed? Is that what we want, or we want the user to manually remove one of them?

@rifelpet
Copy link
Member

rifelpet commented Mar 3, 2020

The current migration instructions require the user manually remove the KubeDNS deployment. It would be great if Kops could do that automatically, but in the case of KubeDNS/CoreDNS I think knowing when it is safe to remove might add significant complexity. All of the CoreDNS pods need to be Ready, the replica count would need to match, etc. I think that might be too much to strive for with this migration.

@Ewocker
Copy link
Author

Ewocker commented Mar 3, 2020

@johngmyers

I am not sure what other options do we have for alternate flow other then replace (delete then create), but I can see some problems of doing that:

  • If using kubectl replace but if an addon add a new resource which was not previously in the manifest, then replace will fail. Similar things will happen for first delete then create. If a resource is removed from new version, deletion will miss the removed resources (which is already a problem in kops).
  • Workload can have down time because we need to first delete which might not be acceptable for some addon, ex. dns. (This might be the same in the other approach though since we are doing a single apply using a multi-resource file)

In the original comment where I was able to do this without service down time is to only replace the kube-dns service instead of all. But I am not sure if it is possible to implement this today in kops.

In this case I will assume that we need to live with the fact that there can be a blip in this type of immutable or conflicting update.

@Ewocker Ewocker closed this Mar 3, 2020
@Ewocker Ewocker reopened this Mar 3, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 2, 2020
@k8s-ci-robot
Copy link
Contributor

@Ewocker: PR needs rebase.

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 18, 2020
@k8s-ci-robot
Copy link
Contributor

@Ewocker: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kops-verify-cloudformation 18b1e22 link /test pull-kops-verify-cloudformation
pull-kops-verify-hashes 18b1e22 link /test pull-kops-verify-hashes
pull-kops-e2e-k8s-containerd 18b1e22 link /test pull-kops-e2e-k8s-containerd

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 11, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 11, 2021
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants