Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

docker: how does memory allocation work, any docs? #2169

Closed
shinebayar-g opened this issue Nov 7, 2019 · 5 comments
Closed

docker: how does memory allocation work, any docs? #2169

shinebayar-g opened this issue Nov 7, 2019 · 5 comments

Comments

@shinebayar-g
Copy link

Description of problem

I'm trying to use kata containers as regular VM. But having a hard time configuring basic resource allocations for VMs. Right now I can't even allocate correct amount of ram on VM.

docker run -dit -m 1g busybox

Expected result

I assume above command would create VM with 1GB memory?

Actual result

08c5b490c5d33439049d465b0fc6d0d80aa908463e0f1513088cceac1dc46805
docker: Error response from daemon: OCI runtime create failed: Unable to hotplug 1024 MiB memory, the SB has 2048 MiB and the maximum amount is 2846 MiB: unknown.
@grahamwhaley
Copy link
Contributor

@shinebayar-g - there is a similar thread over at #1228 (comment) that may help provide some answers.

Supplying us some details about your host setup and component version numbers may help as well @shinebayar-g . I think the Issue template probably hinted at using kata-collect.sh to obtain that information and attach it to this report?

@jcvenegas , can you clarify on the memory side?

@shinebayar-g
Copy link
Author

Where can I find kata-collect.sh file?

@grahamwhaley
Copy link
Contributor

It may depend on how you installed your kata. On one of my systems it is in /usr/bin. That may have been a package or developer install though. If you installed with kata-deploy, then I'd hope it is in maybe /opt/kata/bin. The source lives at https://github.com/kata-containers/runtime/tree/master/data, but it gets mildly pre-processed during packaging, so I'm not sure you can run that kata-collect.sh.in file directly.

@shinebayar-g
Copy link
Author

I've followed centos installation docs.

@jcvenegas
Copy link
Member

Hi @shinebayar-g,

I assume your Host has 2846Mib of RAM, the way that kata works is the following.

Kata will start the VM with an initial amount of memory defined at
https://github.com/kata-containers/runtime/blob/master/cli/config/configuration-qemu.toml.in#L78

This memory is used for unconstrained containers and kata agent in the Sandbox/Pod.

When you request to create a container with dedicated memory, kata runtime will create a new container with it, so in your case your VM will have 2G (for agent and not constrained containers) + 1G (for the container you requested) - you can also tweak the kata runtime configuration to reduce the amount of initial memory for default is 2G.

egernst pushed a commit to egernst/runtime that referenced this issue Feb 9, 2021
This includes fix for CVE-2019-19921

3291d66b rootfs: do not permit /proc mounts to non-directories
55f8c254 temporarily disable CRIU tests
5c20ea14 fix merging kata-containers#2177 and kata-containers#2169
8541d9cf Fix race checking for process exit and waiting for exec fifo
52951a7c Fix race in tty integration test with slow startup
8ddd8920 libcontainer: add method to get cgroup config from cgroup
Manager
cd7c59d0 libcontainer: export createCgroupConfig
ec49f98d fs2: support legacy device spec (to pass CI)
88e8350d cgroup2: split fs2 from fs
41a20b58 Expose network interfaces via runc events
48b055c4 Makefile: allow overriding `docker` command
42690e68 Make event types public
faf1e44e cgroup2: ebpf: increase RLIM_MEMLOCK to avoid BPF_PROG_LOAD
error
ccd4436f .travis.yml: add Fedora 31 vagrant box (for cgroup2)
faf673ee cgroup2: port over eBPF device controller from crun
74a3fe5d cgroup2: do not parse /proc/cgroups
9c81440f cgroup2: allow mounting /sys/fs/cgroup in UserNS without
unsharing CgroupNS
13919f5d Remove the static_build build tag.
dbd771e4 cgroup2: implement `runc ps`
9996cf7d README.md: clarify cgroup2 support is not ready for production
d918e7f4 cpuset_v2: skip Apply when no limit is specified
033936ef io_v2.go: remove blkio v1 code
a610a848 criu: Ensure other users cannot read c/r files
b28f58f3 Set unified mountpoint in find mnt func
f017e0f9 checkpoint: Set descriptors.json file mode to 0600
4be50fe3 SECURITY: Add Security Policy
2111613c VERSION: back to development
28e58a0f Support different field counts of cpuaact.stats
e63b797f Handle ENODEV when accessing the freezer.state file
5e0e67d7 fix permission denied
056909bd Adds note about user ns for rootless containers

Fixes kata-containers#719

Signed-off-by: Archana Shinde <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants