nabla-containers / runnc

OCI-interfacing Container runtime for Nabla Containers
https://nabla-containers.github.io/
ISC License
257 stars 22 forks source link

Kubernetes - Container fails to start: "nabla-run: Malformed argument to --mem" #78

Closed qvicksilver closed 5 years ago

qvicksilver commented 5 years ago

Running runnc containers on Kubernetes 1.13.5 with containerd 1.2.6 results in the following error:

WARNING: Changing CIDR from 32 to 1 due to Issue https://github.com/nabla-containers/runnc/issues/40
nabla-run arg [/opt/runnc/bin/nabla-run --x-exec-heap --mem=0 --net=tap8084e8fff5bb --disk=/run/containerd/runc/k8s.io/8084e8fff5bba1a4498c93029c99e3a8f622ea2c1952764f48cdc7abd00b8a2f/rootfs.iso /run/containerd/io.containerd.runtime.v1.linux/k8s.io/8084e8fff5bba1a4498c93029c99e3a8f622ea2c1952764f48cdc7abd00b8a2f/rootfs/node.nabla {"env":"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","env":"HOSTNAME=nabla-66456766c6-9294h","env":"KUBERNETES_SERVICE_PORT_HTTPS=443","env":"KUBERNETES_PORT_443_TCP_ADDR=10.233.0.1","env":"NABLA_SERVICE_SERVICE_PORT=8080","env":"NABLA_SERVICE_PORT=tcp://10.233.41.47:8080","env":"NABLA_SERVICE_PORT_8080_TCP_ADDR=10.233.41.47","env":"KUBERNETES_SERVICE_HOST=10.233.0.1","env":"KUBERNETES_SERVICE_PORT=443","env":"KUBERNETES_PORT_443_TCP=tcp://10.233.0.1:443","env":"KUBERNETES_PORT_443_TCP_PROTO=tcp","env":"KUBERNETES_PORT_443_TCP_PORT=443","env":"NABLA_SERVICE_SERVICE_HOST=10.233.41.47","env":"NABLA_SERVICE_PORT_8080_TCP_PROTO=tcp","env":"NABLA_SERVICE_PORT_8080_TCP_PORT=8080","env":"KUBERNETES_PORT=tcp://10.233.0.1:443","env":"NABLA_SERVICE_PORT_8080_TCP=tcp://10.233.41.47:8080","cmdline":"/run/containerd/io.containerd.runtime.v1.linux/k8s.io/8084e8fff5bba1a4498c93029c99e3a8f622ea2c1952764f48cdc7abd00b8a2f/rootfs/node.nabla /home/node/app/app.js","net":{"if":"ukvmif0","cloner":"True","type":"inet","method":"static","addr":"10.233.97.249","mask":"1","gw":"169.254.1.1"},"blk":{"source":"etfs","path":"/dev/ld0a","fstype":"blk","mountpoint":"/"},"cwd":"/"}]
nabla-run: WARNING: The use of --x-exec-heap is dangerous and not recommended as it makes the heap and stack executable.
nabla-run: Malformed argument to --mem

Workaround: Specify resource limits

          resources:
            requests:
              memory: "256Mi"
            limits:
              memory: "256Mi"
lumjjb commented 5 years ago

have a hunch that its possible that if its less than 1 MB, then it becomes 0 because of memory = (*s.Linux.Resources.Memory.Limit) / (1 << 20). https://github.com/nabla-containers/runnc/blob/master/libcontainer/configs/spec.go#L37-L43

A potential fix would be to take the floor of the default memory requirement and the processed one.

lumjjb commented 5 years ago

Fixed by https://github.com/nabla-containers/runnc/pull/79