I have a Rancher based Kubernetes cluster that consists of nodes that are LXD containers. I have been able to deploy services to these nodes successfully. However, Rancher seems to think that each of these nodes has all the resources of the host the LXD container is running on.
For example, I launched a few worker node containers. These were ensured to have limited CPU cores using
lxc config set my-container limits.cpu 4 . This was verified by running
grep -c processor /proc/cpuinfo in the container, which returned
4 as expected. However, Rancher shows the same node as having 56 cores, which is the number of cores on the bare metal where the LXD containers are running. This is shown in the screenshot below:
All the nodes shown in the screenshot were CPU limited as mentioned above, but they are listed as having 56 cores by Rancher. This is problematic, given that many of these containers are on the same host.
I am running LXD 3.0.4 (from the
3.0/stable channel). Based on what I have read about LXCFS, I believe it may solve my problem. However, I am not sure if LXCFS is already running on my snap installed LXD. I see the following process on my machine when I run
ps aux | grep lxcfs:
root 9885 0.0 0.0 160920 1444 ? Sl 17:20 0:00 lxcfs /var/snap/lxd/common/var/lib/lxcfs -p /var/snap/lxd/common/lxcfs.pid
/var/snap/lxd/common/var/lib/lxcfs shown above points to
/var/snap/lxd/common/shmounts/lxcfs, which does not exist (
/var/snap/lxd/common/shmounts/ is an empty directory).
As per this, LXCFS will ensure that
/sys/devices/system/cpu/online is container aware. It seems to me that Rancher obtains resource information from this location, which is why I believe a working install of LXCFS will solve my problem. Please let me know if you have any thoughts on this.
How do I use LXCFS with my snap installed LXD? The instructions here do not seem to be specific to a snap installation.
Anything else I should be considering? Appreciate all feedback and suggestions.