Physicists frequently talk about symmetries of a theory, and them being generated by Killing vectors. While this is clear to me in the context of gravity, where a Killing field $\xi$ is defined by $\mathcal{L}_\xi g = 0$, I am confused by the concept in the context of Yang-Mills. Below are my thoughts about the matter, please do correct any wrong statements.

I understand that there are similarities between gravity and Yang-Mills: the Yang-Mills curvature $F_{\mu \nu} = [D_\mu, D_\nu]$ is a bit like the Riemann curvature $R_{\cdot \cdot cd} = [\nabla_c, \nabla_d]$ of a Lorentzian manifold, where $D$ and $\nabla$ denote the respective covariant derivatives, even though in Yang-Mills everything is happening on representations of a principal $G$-bundle, while in gravity on the tangent bundle. This is why gravity is not a gauge theory.

**So what is a Killing vector in a Yang-Mills theory?** By example of gravity, one could imagine writing down the Killing equation $$ \nabla_a \nabla_b \xi^c = R^c_{\phantom{c}dab} \xi^d, $$ and attempting to transfer to this to the context of Yang-Mills by putting $\nabla \to D$, $R \to F$. But this feels wrong, at least at first sight, since the indices on $R$ are all on equal footing, whereas the indices on $F$ are of two different types, the 2-form indices, and the Lie algebra indices. I guess this comes back to the fact that in gravity we have a metric that we can use to raise and lower indices, but do not in Yang-Mills, or at least the connection $D$ is not the Levi-Civita connection of a metric (is it?).

Apparently one can think of Killing vectors in Yang-Mills as covariantly constant $\mathfrak{g}$-valued vector fields $\xi$, $D \xi=0$. Where does this definition (if it is a definition) come from? And how does it relate to the usual definition $\mathcal{L}_\xi g =0$?