This paper addresses the problem of voltage restoration and reactive power sharing of inverter-based distributed generations (DGs) in an islanded microgrid subject to denial-of-service (DoS) attacks. Note that DoS attacks may block information exchange among DGs by jamming the communication network in the secondary control level of a microgrid. A two-layer distributed secondary control framework is presented, in which a state observer employing the multiagent system (MAS)-based ternary self-triggered control is implemented for discovering the average information of voltage and reactive power in a fully distributed manner while highly reducing communication burden than that the periodic communication way. The compensation for the reference signal to the primary control is acquired according to the average estimates to achieve voltage restoration while properly sharing reactive power among DGs. An improved ternary self-triggered control strategy integrating an acknowledgment (ACK)-based monitoring mechanism is established, where DoS attacks are modeled by repeated cycles of jamming and sleeping. A new triggering condition is developed to guarantee the successful information exchange between DGs when the sleep period of DoS attacks is detected. Using the Lyapunov approach, it is proved that the proposed algorithm allows agents to reach consensus regardless of the frequency of the DoS attacks, which maintains the accurate estimation of average information and the implementation of the secondary control objectives. The performance of the proposed control scheme is evaluated under simulation and experimental conditions. The results show that the proposed secondary control scheme can highly reduce the inter-agent communication as well as improve the robustness of the system to resist DoS attacks.