The multidimensional gravity on the total space of principal bundles is considered. In this theory the gauge fields arise as nondiagonal components of a multidimensional metric. The spherically symmetric and cosmological solutions for gravity on an SU(2) principal bundle are obtained. The static spherically symmetric solution is a wormhole-like solution located between two null surfaces, in contrast to 4D Einstein-Yang-Mills theory where the corresponding solution (black hole) is located outside of the event horizon. The cosmological solution has (at least locally) the bouncing-off effect for the spatial dimensions.