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

[PodSecurityPolicy] Move the install of psp #8744

Merged

Conversation

robinAwallace
Copy link
Contributor

@robinAwallace robinAwallace commented Apr 25, 2022

What type of PR is this?
/kind bug

What this PR does / why we need it:

I have found that there is an issue when installing HA etcd with kubeadm for kubernetes v1.22+ with 3 or more control planes when psp is enabled. Where kubelet on control plane 1 is up but non of the pods are mirrored because there is no psp to validate the request.

Apr 25 06:35:55 wallace-sc-k8s-master-nf-1 kubelet[11318]: E0425 06:35:55.993906   11318 kubelet.go:1701] "Failed creating a mirror pod for" err="pods \"etcd-wallace-sc-k8s-master-nf-1\" is forbidden: PodSecurityPolicy: no providers available to validate pod request" pod="kube-system/etcd-wallace-sc-k8s-master-nf-1"

Which is a problem when control plane 2 and 3 does kubeadm join which receives 0 etcd pods from control-plane 0 and fails.

This PR insures that the psp are installed before ´kubeadm join` is executed on the other control planes.

The issue have been traced down to this change:
kubernetes/kubernetes@8b9d0dc#diff-1671fef50296cdc263fe784ea570d008c1e123d15c2efb9aea27554a82080aaaR128

Which fails if the number of etcd pods is 0:
kubernetes/kubernetes@8b9d0dc#diff-1671fef50296cdc263fe784ea570d008c1e123d15c2efb9aea27554a82080aaaR143

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

This is a issue from v2.18.0+

Does this PR introduce a user-facing change?:

Fix issue when PodSecurityPolicy is enabled static pods are now mirrored earlier by kubelet. Problem when installing HA etcd via kubeadm.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. 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 Apr 25, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @robinAwallace. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 25, 2022
@cristicalin
Copy link
Contributor

Thanks @robinAwallace !

/approve
/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 Apr 28, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cristicalin, robinAwallace

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 Apr 28, 2022
Copy link
Contributor

@oomichi oomichi left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, most part seems good for me.
just one comment.

/cc @oomichi

roles/kubernetes/control-plane/tasks/psp-install.yml Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot requested a review from oomichi April 28, 2022 19:01
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 3, 2022
@robinAwallace robinAwallace force-pushed the rw/fix-psp-issue branch 2 times, most recently from e5dbedb to 44aa66e Compare May 4, 2022 12:52
@oomichi
Copy link
Contributor

oomichi commented May 4, 2022

Thanks for updating.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 4, 2022
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2022
@oomichi
Copy link
Contributor

oomichi commented May 9, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2022
@k8s-ci-robot k8s-ci-robot merged commit 42fc71f into kubernetes-sigs:master May 9, 2022
@oomichi oomichi mentioned this pull request May 28, 2022
@rptaylor
Copy link
Contributor

@robinAwallace I have exactly the same problem, thank you so much for determing the cause and fixing this!!

Kubespray 2.18 remains broken for deployment of PSP-enabled clusters however.

@robinAwallace
Copy link
Contributor Author

@robinAwallace I have exactly the same problem, thank you so much for determing the cause and fixing this!!

Kubespray 2.18 remains broken for deployment of PSP-enabled clusters however.

If i remember correctly it should just be a problem when using kubernetes v1.22+. So if you are specifying the kubernetes v1.22+ and still running kubespray-2.18 i guess you need to cherry pick this fix or use kubespray v2.19.

Hope this helps you a bit 🙂

@rptaylor
Copy link
Contributor

Yes, k8s 1.22 is the default version in Kubespray 2.18.2 , so it is affected. I cherry picked the fix it into my branch.

LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jun 30, 2023
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Oct 23, 2023
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. kind/bug Categorizes issue or PR as related to a bug. 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/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