Commit c114f329 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #26289 from derekwaynecarr/enable_accounting

Automatic merge from submit-queue Enable node e2e accounting on systemd Updated the e2e setup.sh script to enable cpu and memory accounting. Related to https://github.com/kubernetes/kubernetes/issues/26198 /cc @pwittrock
parents 0b7f8e5b 67493aa9
...@@ -25,6 +25,22 @@ ...@@ -25,6 +25,22 @@
# - centos 7 # - centos 7
# - debian jessie # - debian jessie
# RHEL os detection
cat /etc/*-release | grep "ID=\"rhel\""
OS_RHEL=$?
# On a systemd environment, enable cpu and memory accounting for all processes by default.
if [ -d /etc/systemd ]; then
cat <<EOF >kubernetes-accounting.conf
[Manager]
DefaultCPUAccounting=yes
DefaultMemoryAccounting=yes
EOF
sudo mkdir -p /etc/systemd/system.conf.d/
sudo cp kubernetes-accounting.conf /etc/systemd/system.conf.d
sudo systemctl daemon-reload
fi
# Fixup sudoers require tty # Fixup sudoers require tty
sudo grep -q "# Defaults requiretty" /etc/sudoers sudo grep -q "# Defaults requiretty" /etc/sudoers
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
...@@ -44,9 +60,18 @@ fi ...@@ -44,9 +60,18 @@ fi
# Install docker # Install docker
hash docker 2>/dev/null hash docker 2>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
curl -fsSL https://get.docker.com/ | sh # RHEL platforms should always install from RHEL repository
sudo service docker start # This will install the latest supported stable docker platform on RHEL
sudo systemctl enable docker.service if [ $OS_RHEL -eq 0 ]; then
sudo yum install -y docker-latest
sudo groupadd docker
sudo systemctl enable docker-latest.service
sudo systemctl start docker-latest.service
else
curl -fsSL https://get.docker.com/ | sh
sudo service docker start
sudo systemctl enable docker.service
fi
fi fi
# Allow jenkins access to docker # Allow jenkins access to docker
...@@ -55,10 +80,13 @@ sudo usermod -a -G docker jenkins ...@@ -55,10 +80,13 @@ sudo usermod -a -G docker jenkins
# install lxc # install lxc
cat /etc/*-release | grep "ID=debian" cat /etc/*-release | grep "ID=debian"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
sudo apt-get install lxc -y hash apt-get 2>/dev/null
lxc-checkconfig if [ $? -ne 1 ]; then
sudo sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="\1 cgroup_enable=memory"/' /etc/default/grub sudo apt-get install lxc -y
sudo update-grub lxc-checkconfig
sudo sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="\1 cgroup_enable=memory"/' /etc/default/grub
sudo update-grub
fi
fi fi
# delete init kubelet from containervm so that is doesn't startup # delete init kubelet from containervm so that is doesn't startup
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment