Persist mongodb between invocations in kubernetes on a single-node cluster on windows

6/23/2019

I'd like to keep the data in my mongodb when I restart my kubernetes helm chart, but I can't because mongodb fails to start with the following error when the db is mapped to a host path (I'm running on docker desktop):

2019-06-23T05:40:35.788+0000 I CONTROL  [initandlisten] options: { config: "/opt/bitnami/mongodb/conf/mongodb.conf", net: { bindIpAll: true, ipv6: true, port: 27017, unixDomainSocket: { enabled: true, pathPrefix: "/opt/bitnami/mongodb/tmp" } }, processManagement: { fork: false, pidFilePath: "/opt/bitnami/mongodb/tmp/mongodb.pid" }, security: { authorization: "disabled" }, setParameter: { enableLocalhostAuthBypass: "true" }, storage: { dbPath: "/opt/bitnami/mongodb/data/db", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: true } }
2019-06-23T05:40:35.791+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=989M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-06-23T05:40:37.056+0000 E STORAGE  [initandlisten] WiredTiger error (17) [1561268437:56536][36:0x7f8cc73279c0], connection: /opt/bitnami/mongodb/data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1561268437:56536][36:0x7f8cc73279c0], connection: /opt/bitnami/mongodb/data/db/WiredTiger.wt: handle-open: open: File exists
2019-06-23T05:40:37.063+0000 I STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.6
2019-06-23T05:40:37.069+0000 E STORAGE  [initandlisten] WiredTiger error (1) [1561268437:69980][36:0x7f8cc73279c0], connection: /opt/bitnami/mongodb/data/db/WiredTiger.wt: handle-open: open: Operation not permitted Raw: [1561268437:69980][36:0x7f8cc73279c0], connection: /opt/bitnami/mongodb/data/db/WiredTiger.wt: handle-open: open: Operation not permitted

This error is well known in the sense that the workaround when running with docker is to create a persistent volume:

docker volume create --name=mongodata

And then mount that in the mongodb docker container. (I believe the root cause is that HyperV and VirtualBox do not support memory mapped files across the VM boundary).

The problem is that kubernetes has no storage driver for docker volumes (as far as I can tell). So I need another solution. Does anyone have any ideas? I'd love to have it robust enough that it would survive shutdowns of k8/docker and my machine.

I'm running on the latest stable docker desktop on Windows 10 (backed by Hyper V) (v18.09.2). I'm using the Kubernetes that is supplied with it (v1.10.11).

-- Gordon
docker
docker-desktop
kubernetes
mongodb

0 Answers