Spivak, Comprehensive Introduction to Differential Geometry, volume 5, chapter 13, explains how to calculate these using classical invariant theory for all of the classical groups and gives the computations explicitly for $SO(n)$: the Pfaffian (if $n$ is even) and the even degree elementary symmetric functions of the eigenvalues. For $A_2$, the invariant polynomials are the determinant and the trace of the square of each matrix, as the trace is zero. More generally for $A_n$ you get the elementary symmetric functions of the eigenvalues, except for the trace (which is zero), as in the theory of Chern classes.
I think you find all of the invariants written out pretty explicitly in M. L. Mehta, Basic sets of invariant polynomials for finite reflection groups, Comm. in Algebra, 16 (5), 1988, p. 1083-1098. The idea is that any invariant polynomial must restrict to any Cartan subalgebra to become invariant under the Weyl group, and conversely any Weyl group invariant polynomial extends to an invariant polynomial on the Lie algebra.