Skip to content

Commit

Permalink
Make 'kube-bench' happy.
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
  • Loading branch information
bmcustodio authored and mogren committed Nov 14, 2019
1 parent c7528b5 commit 593691e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions files/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,13 @@ fi
systemctl daemon-reload
systemctl enable kubelet
systemctl start kubelet

# Wait for the TLS certificate and private key to be present and add these to the config file so they are picked up the next time the kubelet starts.
# These cannot be added upfront because they are not present when the kubelet first starts, and adding them would cause the kubelet to crash.
TLS_CERT_FILE="/var/lib/kubelet/pki/kubelet-server-current.pem"
while [[ ! -f $TLS_CERT_FILE ]]
do
sleep 1
done
echo "$(jq ".tlsCertFile=\"$TLS_CERT_FILE\"" $KUBELET_CONFIG)" > $KUBELET_CONFIG
echo "$(jq ".tlsPrivateKeyFile=\"$TLS_CERT_FILE\"" $KUBELET_CONFIG)" > $KUBELET_CONFIG
3 changes: 3 additions & 0 deletions files/kubelet-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
"hairpinMode": "hairpin-veth",
"cgroupDriver": "cgroupfs",
"cgroupRoot": "/",
"eventRecordQPS": 0,
"featureGates": {
"RotateKubeletServerCertificate": true
},
"protectKernelDefaults": true,
"readOnlyPort": 0,
"serializeImagePulls": false,
"serverTLSBootstrap": true
}
10 changes: 10 additions & 0 deletions install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ EOF
sudo mv /tmp/release /etc/eks/release
sudo chown root:root /etc/eks/*

################################################################################
### Stuff required by "protectKernelDefaults=true" #############################
################################################################################

cat <<EOF | sudo tee -a /etc/sysctl.d/99-amazon.conf
vm.overcommit_memory=1
kernel.panic=10
kernel.panic_on_oops=1
EOF

################################################################################
### Cleanup ####################################################################
################################################################################
Expand Down

0 comments on commit 593691e

Please sign in to comment.