How to enable cgroups V2 in Alpine Linux

I am running K3S cluster to host some of my applications. After trying to start some of the Helm chart (especially some PostgreSQL charts) I got an error saying that containerD is not able to read some cgroups data. Actuall error message was saying following:

  Warning  Unhealthy  3m46s                  kubelet            Readiness probe errored: rpc error: code = Unknown desc = failed to exec in container: failed to start exec "<container_id>": OCI runtime exec failed: exec failed: unable to start container process: error adding pid 18381 to cgroups: failed to write 18381: open /sys/fs/unified/kubepods/burstable/pod<random_id>/<some_id>/cgroup.procs: no such file or directory: unknown

The root cause of this message was missing cgroups V2 configuration. To enable it you need to edit /etc/rc.conf configuration file and the following line:

rc_cgroup_mode="unified"

After reboot your K3S cluster should stop to complain about this error.