-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat: add trigger to restart kube-apiserver when config files change #12172
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
Conversation
Welcome @hhk7734! |
Hi @hhk7734. 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 Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
Are you sure the kube-apiserver isn't reloading changed config file dynamically ? If I recall correctly, I was told that at least for structured authentication. |
Here's how I tested it: kubernetes_audit: true
audit_policy_custom_rules: |
- level: Metadata ansible-playbook -i inventory -b -e "@kubespray_vars.yaml" cluster.yml After creating a cluster, I confirmed that auditing was working by checking kubernetes_audit: true
audit_policy_custom_rules: |
- level: None ansible-playbook -i inventory -b -e "@kubespray_vars.yaml" upgrade-cluster.yml --tags master After applying the changes, I noticed that although the After applying this PR, I deleted the contents of ansible-playbook -i inventory -b -e "@kubespray_vars.yaml" upgrade-cluster.yml --tags master This time, the changes were applied correctly. |
Should I change it to this? - name: Write api audit policy yaml
template:
src: apiserver-audit-policy.yaml.j2
dest: "{{ audit_policy_file }}"
mode: "0640"
register: apiserver_audit_policy_update
when: kubernetes_audit | default(false) or kubernetes_audit_webhook | default(false)
notify: Control plane | Restart apiserver |
Ok, thanks for testing 👍 |
/ok-to-test |
/retest-failed |
/retest |
This looks fine, thanks ! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hhk7734, VannTen 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 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
When the kube-apiserver config files change, some users may not realize that they need to manually restart the kube-apiserver because the manifest itself remains unchanged and kubelet does not automatically restart the Pod.
With this PR, even if the manifest is not modified, the kube-apiserver will be restarted whenever related config files change.
For example, if
audit_policy_custom_rules
is modified andansible-playbook upgrade-cluster.yml --tags master
is run, the kube-apiserver will be automatically restarted to apply the updated audit policies.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: