The best examples of insects with bright colors that are either poisonous to eat or carry venom glands include butterflies and stinging insects such as bees and wasps. Butterflies often lay their eggs on toxic plants so that their larvae can feed on the plants and ingest the toxins.
These toxins cause both the larvae and the adults to be bitter tasting to predators. While the amount of toxin in the insects is usually not enough to kill a predator, it is enough to make predators ill and thus unlikely to attempt to eat brightly-colored insects in the future.