This research study presents a resilient control scheme for an islanded DC microgrid (DC MG) integrating solar photovoltaic (PV), battery storage (BESS), and piezoelectric (PE) energy harvesting modules. The microgrid (MG) case study represents an energy hub designed to provide electricity for lighting systems in transportation, roads, and other infrastructure. To enhance practicality, the PE is modeled using the real data captured from a traffic simulator. The proposed reinforcement learning (RL) method was tested against four severe and unexpected failure scenarios, including short circuit at the load side, sudden and severe change of load, open circuit, and converter failure. The performance of the controller was quantitatively compared with a conventional PI controller. The results show marginal improvement in one scenario and significant improvement in the other three, suggesting that the proposed scheme is a robust candidate for microgrids with high levels of uncertainty, such as those involving solar and PE harvesters.