Deploy Blockscout on K8s

We are deploying Besu networks on k8s. The idea is to include Blockscout as a Besu network Blockexplorer. Our idea is to also deploy also Blockscout on k8s. I couldn’t find docs available about deploying in k8s and I’ve seen that the Docker integration is not production ready. Can you help me, please? Is there something planned in the roadmap to fix this?
Thank You in Advance


You’re right. Deploying Blockscout in Kubernetes is not documented yet because we didn’t try this setup yet. Honestly, it is not on our radar in the near future. However, you may give a try documented docker setup to prepare Blockscout image for k8s. Although it is marked as for local usage only, we use that Dockerfile to prepare images of the explorer for some chains.

Thank you for your quick response @viktorbaranov. I’ll try it.

@Albert_Ruiz Were you able to successfully deploy using K8s?

I’ve been running it and in itself no major k8s/docker specific issues. Some things to note though:

  • blockscout requires write access to the directory /opt/app/_build/prod/lib/tzdata/priv/ to write the last update time of tz database (?). If you want to run the container as a non-root user (recommended), you have to address this somehow. I built my own image based on the default, adding the line RUN chmod -R 777 /opt/app/_build/prod/lib/tzdata/priv/ before the last line in the Dockerfile.

  • For most configuration, you can address this with environment variables. There are some things that can only be changed by modifying the source files, though (e.g. concurrency settings). If you need to adjust this, you have 3 options:

    1. Modify blockscout to read this as env var and build your imaged based on that, submit PR upstream (preferrable, helps others!)
    2. Hardcode in your own value and build image based on that (easiest but requires maintaining your own fork)
    3. Make a new entrypoint for the image that reads the parameter from env var and replaces values in source files before starting application (hacky but works)
  • Base image only comes in amd64 flavor. If you want to run on e.g. arm64, you have to make a new image (if you do, consider making a PR :))

  • You still need to initialize the db and do the migration. What I did was just running a one-shot job first changing the command to run the migration.

blockscout comes with a Makefile and commands for “dockerized deployment” but this is, as documented, intended for local usage (it spins up a dev postgres container, amongst other things). You can use the Dockerfile but the rest can just be ignored if you’re deploying it with e.g. k8s.

DATABASE_URL can be managed as k8s secret.


Nice feedback. Thank you. Do you mind to share which project is using deployment on k8 for BlockScout?

Oh, this is just for internal/personal ETH mainnet (and testnets) use - decentralization means nothing if everyone’s relying on etherscan and cloud services; this whole movement will be fruitless unless we start with ourselves. Very grateful for you guys putting in the work and giving back to the community.

Also, I’m actually running on nomad using the docker driver, not k8s. But for all intents and purposes it shouldn’t be any differences there.

I have several issues with indexing mainnet still, but I’m sure that’s orthogonal to running containerized.


we have a snapshot of BlockScout mainnet on around half a year ago if you are interested. It’s ~ 3Tb on S3