Hi being new to LXD, I have a few questions I need clarification on for my intended usage. I plan to setup Ubuntu 18.0.4 with LXD and create 2 LXD containers one for Ubuntu 18.0.4 LEMP stack and one for CentOS 7.5 Centmin Mod LEMP stack for intended purposes in benchmarking the performance between the 2 LXD container’s LEMP stacks.
Questions
1. system TCP/Kernel tuning /etc/sysctl.conf at LXD container and host level.
Where does /etc/sysctl.conf come into this setup ? LXD container’s inherit host level /etc/sysctl.conf settings ? or can each LXD container set it’s own /etc/sysctl.conf settings separate from host level ?
2. LXD container identification methods ?
My CentOS Centmin Mod LEMP stack project auto installer auto tunes a server environment based on server resources as well as virtualisation type detected i.e. kvm, xen and openvz and optimises accordingly. For OpenVZ detection, i script and check for /proc/user_beancounters. So with LXD containers, is there anything similar within the container to allow me to identify that the environment is LXD container based ?
Containers will inherit sysctls from the host and in most cases cannot override them. There are a number of exceptions to that, mostly around IPC and network sysctls where some of them will be tied to the IPC or NET namespaces. Easiest here is to try, if the LXD container can modify the sysctl, it’s namespaced, if not, then it’s not.
systemd-detect-virt if present should do the trick. Otherwise you can manually check the environment of PID1 for the container= variable (cat /proc/1/environ | tr '\0' '\n')
The Linux scheduler is usually pretty smart and so in most cases, even in production, you’re unlikely to really need to use any CPU limits. That being said, for benchmarking purposes, if you can afford it, having each container pinned to two CPU cores that aren’t used for anything else would likely give the fairest environment (while still allowing for multi-threading). You could set limits.cpu=1-2 on the first container and limits.cpu=3-4 on the second. That assumes that you have at least 5 cores/threads available on your system (as CPU count starts at 0). CPU 0 is the usual target for IRQs so not particualrly fair to use that one when benchmarking.
One more noob question. My scripted LEMP installer checks to see Linux Kernel has IPSET module support. But what’s the best way to check this within the LXD guest container itself ?
from lxd guest I get
find /lib/modules/`uname -r` -name 'ipset'
find: '/lib/modules/4.15.0-22-generic': No such file or directory
csf -u
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "C.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
csf is already at the latest version: v12.04
locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=C.UTF-8
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=
on lxd host Ubuntu 18.04
localectl status
System Locale: LANG=en_US.UTF-8
VC Keymap: n/a
X11 Layout: us
X11 Model: pc105
The containers are using the Linux kernel of the host.
Therefore, you would first need to load that kernel module on the host.
Then, it’s up to the way that the LXD confinement works, whether that kernel module is accessible.
Obviously, the unprivileged container cannot load a Linux kernel module.
You might have to relax the confinement of the containers in order to provide access to that kernel module.
But try first whether you can use it in the container.
First, you need to check whether it works or not.
I do not know where you can get documentation for that.
I think it’s a natural default to set the default timezone to UTC. People use containers in different timezones depending on the location of the datacenter and it would be very messy to try to autoguess what timezone to use. Therefore, it is up to use to set a timezone or other parameters.
Use lxc profile to set these to the default profile, so that they are applied automatically.
If you have existing containers, you can re-apply a profile to them.
I am new to lxd containers. I have a three node cluster - with two containers per node. The containers on a single node can communicate via the network. But I can not communicate to containers on other nodes.
All of my containers are on one bridge
lxdbr0 | bridge | YES | | 6 | CREATED
I am running lxd 3.0.
What do I need to do/configure to facilitate communication between all containers across all nodes? I also want to communicate to other servers in my lab.