If the underlying storage is slow, there is the chance that the local snap binaries are not installed because the snapd socket / service is not yet fully running and accepting connections / commands.
Error seen:
[ 169.829600] cloud-init[1301]: ++ ls /capi/snap-binaries/core20.snap /capi/snap-binaries/k8s.snap
[ 169.904901] cloud-init[1301]: + snap install --classic --dangerous /capi/snap-binaries/core20.snap /capi/snap-binaries/k8s.snap
[ 192.251006] cloud-init[1301]: error: cannot communicate with server: Post "http://localhost/v2/snaps": write unix @->/run/snapd.socket: use of closed network connection