We prove the integral Hodge conjecture for all 3-folds $X$ of Kodaira dimension zero with $H^{0}(X,K_{X})$ not zero. This generalizes earlier results of Voisin and Grabowski. The assumption is sharp, in view of counterexamples by Benoist and Ottem. We also prove similar results on the integral Tate conjecture. For example, the integral Tate conjecture holds for abelian 3-folds in any characteristic.