Preheat your oven to 425°F.
In a large bowl, toss the green beans with 2 tablespoons of olive oil, salt, black pepper, garlic powder, and red pepper flakes if using. Spread the green beans in a single layer on a baking sheet.
In a skillet over medium heat, add the remaining tablespoon of olive oil and the sliced onions. Cook the onions, stirring occasionally, for about 15-20 minutes until they are soft and caramelized. If they start to stick, add a splash of water to deglaze the pan.
Once the onions are caramelized, add them to the baking sheet with the green beans. Drizzle the balsamic vinegar over the mixture and toss to combine.
Roast in the preheated oven for 20-25 minutes, stirring halfway through, until the green beans are tender and slightly crispy.
Serve warm as a side dish.