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$? 



Killing fields for Yang-Mills
An infinitesimal diffeomorphism, generated by $\xi^a$, acts on the metric as $g\_{ab} \mapsto g\_{ab} + 2 \nabla\_{(a} \xi\_{b)}$. The last term is zero precisely when $\nabla\_{(a} \xi\_{b)} = 0$, that is, when $\xi^a$ is a Killing vector.


An infinitesimal gauge transformation on a principal bundle, generated by a $\mathfrak{g}$-valued scalar $\xi$, acts on a connection on the principle bundle as $A\_a \mapsto A\_a + D\_a \xi$. The last term is zero precisely when $D\_a \xi = 0$. So, by analogy, a covariantly constant $\mathfrak{g}$-valued scalar may as well be considered as the Yang-Mills analog of a Killing vector in General Relativity. This analogy may be the source of the definition you mentioned at the bottom of your question.


To extend the analogy further, recall how a conservation law arises from the existence of a Killing vector and a conserved stress-energy tensor:
$$
 \nabla\_a (\xi\_b T^{ab}) - \xi\_b \nabla\_a T^{ab} = (\nabla\_{(a} \xi\_{b)}) T^{ab} = 0 .
$$
This means that $Q^a = \xi\_b T^{ab}$ is a conserved current whenever $\nabla\_a T^{ab} = 0$, which is precisely the integrability condition on the stress-energy tensor to be compatible with the Bianchi identity of the Einstein equations $R\_{ab} - \frac{1}{2} R g\_{ab} = T\_{ab}$ in the presence of matter.


Now, for Yang-Mills theory, the existence of the Killing vector and a conserved conserved charge current also gives rise to a conservation law:
$$
 \nabla\_a \langle \xi, J^a \rangle - \langle \xi, D\_a J^a \rangle
 = \langle D\_a \xi, J^a \rangle = 0 ,
$$
where $\langle -,-\rangle$ is the invariant inner product on the Lie algebra (which by coincidence also carries Killing's name). This means that $Q^a = \langle \xi , J^a \rangle$ is a conserved current whenever $D\_a J^a = 0$, which is precisely the integrability condition for the Bianchi identity of the Yang-Mills equations $D^b F\_{ab} = J\_a$ in the presence of charged sources.


