I’m attempting to setup kubo in Kubernetes as a StatefulSet. In order to facilitate this I’m creating a ConfigMap that has all the node configs indexes by name and mounted into the pod.
The command being used to start it is: `sh -c “/sbin/tini – /usr/local/bin/start_ipfs --config-file /var/lib/ipfs/configs/${HOSTNAME} daemon”`.
The problem is it doesn’t appear to actually be reading that file in. If I cat the file it’s correct. The output of ipfs config show has what appears to be the default generated config.
How do I get this to properly honor the config file I’m attempting to pass to it?
I’m afraid rhe --config-file flag is a legacy option from the go-ipfs (early Protocol Labs) era that was never properly wired across Kubo’s codebase. Most commands ignore it and default to reading config from repo ($IPFS_PATH/config).
In the meantime, if you don’t want to wait, here are two workarounds for Kubo 0.39:
Option 1: Use --init-config with config deletion
The --init-config flag copies a config template to $IPFS_PATH/config during initialization. The catch is it only works once (when the repo doesn’t exist). To make it work on every pod restart:
# In your entrypoint script:
rm -f /data/ipfs/config
exec ipfs daemon --init --init-config /var/lib/ipfs/configs/${HOSTNAME}
This works because:
Deleting the config makes Kubo think the repo needs initialization
--init-config then copies your ConfigMap config to /data/ipfs/config
The datastore and keystore are preserved (init skips files that already exist)
Caveats:
You’ll see “initializing IPFS node…” in logs on every restart
Config now exists in two places (ConfigMap and repo), and changes done via ipfs config will be lost unless you add manual synchronization back to ConfigMap
Option 2: Use /container-init.d scripts
The official Kubo Docker image supports custom initialization scripts.
Mount your script to /container-init.d/:
Your script can copy the per-pod config etc, this could take care of config copying or biderctional config synchronization (if you care about persisting config changes).