Bulidkit fails to start

One of the buildkit pod of my Okteto instance is failing to start with the following error log:

time="2025-08-13T13:43:08Z" level=info msg="buildkitd is running with auth required"
buildkitd: could not lock /var/lib/buildkit/buildkitd.lock, another instance running?
main.main.func3
 /src/cmd/buildkitd/main.go:356
github.com/urfave/cli.HandleAction
 /src/vendor/github.com/urfave/cli/app.go:524
github.com/urfave/cli.(*App).Run
 /src/vendor/github.com/urfave/cli/app.go:286
main.main
 /src/cmd/buildkitd/main.go:440
runtime.main
 /usr/local/go/src/runtime/proc.go:272
runtime.goexit
 /usr/local/go/src/runtime/asm_amd64.s:1700

How do I recover from this?

This error typically happens when BuildKit is not shut down correctly. Some of our community members have seen this when running the Buildkit pods on ephemeral VMs (e.g. spot instances) or when using autoscalers like Karpenter.

Buildkit is a stateful component (e.g. it keeps a cache of images and previous builds), so we don’t recommend deploying it to ephemeral pods, or attaching them to autoscalers.

If you run into the issue described above, we recommend that you manually delete the pod.

kubectl -n <ns> exec -it <buildkit-pod> -- sh -lc 'rm -f /var/lib/buildkit/buildkitd.lock'
kubectl -n <ns> delete pod <buildkit-pod>

If the issue continues to happen, delete the lock file manually, and then delete the podBuildKit instance as well as the BuildKit pod.

kubectl -n <ns> exec -it <buildkit-pod> -c buildkitd -- sh -lc 'rm -f /var/lib/buildkit/buildkitd.lock'
kubectl -n <ns> delete pod <buildkit-pod>