-
Notifications
You must be signed in to change notification settings - Fork 519
chore(CIS): add protect-kernel-defaults #999
Conversation
/azp run pr-e2e |
Azure Pipelines successfully started running 1 pipeline(s). |
Codecov Report
@@ Coverage Diff @@
## master #999 +/- ##
==========================================
+ Coverage 74.43% 74.43% +<.01%
==========================================
Files 131 131
Lines 18318 18319 +1
==========================================
+ Hits 13635 13636 +1
Misses 3902 3902
Partials 781 781 |
it looks like this flag would make kubelet down:
/hold |
This comment has been minimized.
This comment has been minimized.
/hold |
Interesting thing:
That's the reason why this PR always failed. |
@cchildress @khenidak @cpuguy83 Any thoughts on changing the host OS setting |
f74dfa3
to
83014d0
Compare
Thanks guys, I have figured out that I should set kernel turnable falgs before set up kubelet, it works now. |
/hold cancel |
@andyzhangx I've moved bits around here:
I'd still like a review from one of @cchildress @khenidak @cpuguy83 @weinong @yangl900 before merging |
1c88f15
to
f5a3008
Compare
net.ipv6.conf.default.accept_redirects = 0 | ||
# refer to https://github.com/kubernetes/kubernetes/blob/75d45bdfc9eeda15fb550e00da662c12d7d37985/pkg/kubelet/cm/container_manager_linux.go#L359-L397 | ||
vm.overcommit_memory = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackfrancis I found this code change will fail all e2e test, and actully the kernel flags are not set correctly after this PR:
Failed to start ContainerManager [Invalid kernel flag: kernel/panic, expected value: 10, actual value: 0, Invalid kernel flag: kernel/panic_on_oops, expected value: 1, actual value: 0, Invalid kernel flag: vm/overcommit_memory, expected value: 1, actual value: 0]
There is also no /etc/sysctl.d/60-CIS.conf
file under /etc/sysctl.d/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed by putting the whole thing behind "if ubuntu distro" only logic. Once the changes in this file are baked into the VHD then we can turn the functionality on, and run tests, by default
@andyzhangx, we haven't baked this new config file into a VHD yet, so we need to verify this functionality by using the "ubuntu" distro. I've just made a change to do that, and validated that it works:
|
Validated new E2E test coverage on "ubuntu" distro:
|
/azp run pr-e2e |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx, mboersma 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 |
@@ -81,6 +81,12 @@ func (cs *ContainerService) setKubeletConfig() { | |||
"--streaming-connection-idle-timeout": "5m", | |||
} | |||
|
|||
// "--protect-kernel-defaults" is true is currently only valid using base Ubuntu OS image | |||
// until the changes are baked into a VHD | |||
if cs.Properties.IsUbuntuDistroForAllNodes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it will always return false now @jackfrancis
// IsUbuntuDistroForAllNodes returns true if all of the agent pools plus masters are running the base Ubuntu image
func (p *Properties) IsUbuntuDistroForAllNodes() bool {
if len(p.AgentPoolProfiles) > 0 {
for _, ap := range p.AgentPoolProfiles {
if ap.Distro != Ubuntu && ap.Distro != Ubuntu1804 {
return false
}
}
}
if p.MasterProfile != nil {
return p.MasterProfile.Distro == Ubuntu || p.MasterProfile.Distro == Ubuntu1804
}
return true
}
I think I have already tried the latest Ubuntu version:
"agentpoolosImageSKU": {
"value": "aks-ubuntu-1604-201904"
},
"agentpoolosImageVersion": {
"value": "2019.04.24"
},
Reason for Change:
fix: add protect-kernel-defaults for CIS conformance
about
protect-kernel-defaults
: Default kubelet behaviour for kernel tuning. If set, kubelet errors if any of kernel tunables is different than kubelet defaults.Issue Fixed:
Fixes #446
Requirements:
Notes:
/assign @jackfrancis @CecileRobertMichon
cc @feiskyer