In order to get Iron Nuggets and Gold Nuggets, you’ll need to have a Shovel. It’s advised that you have an upgraded one since flimsy versions will break fast. You can get Iron Nuggets and Gold Nuggets by hitting rocks with your shovel.
The drop of these items isn’t high, so you’ll have to check all rocks in your Island each day. You can also use a Nook Miles ticket to visit another island for gathering resources. Make sure that you have enough space in your inventory before going. You can obtain items from a rock each day so be careful not to break the ones on your island.
Tip: You can have a maximum of 7 items that you can obtain from each rock. Hitting the rock with your Shovel will cause your villager to flinch backwards.
Each time you hit a rock, make sure to move towards the rock before hitting it again. You should try to land 7 hits within a short time window in order for you to get all rewards from the rock. If not, you'll just flinch back and you won't be able to hit the rock in time.
We have questions and answers related to this topic which may also help you: