It is helpful to think of the yield $r_b$ of a risky bond (say a corporate) in your country as the yield of the risk-free government bond $r_f$ plus a "spread" $r_s$ ($r_b = r_f + r_s$). This extra spread is the extra yield that the market needs to be paid to purchase the corporate bond instead of buying an equivalent amount of risk-less bonds. In other words $r_s$ the (annualized) rate needed to pay someone to take the risk on losing their money if that particular bond defaults.
In a credit default swap the protection buyer generally pays a annualized rate $r_{cds}$ to the protection seller and the protection seller pays the buyer if a bond (like the corporate bond above) defaults. In particular the amount the seller pays is designed to be fairly close to what an owner of the corporate bond would lose if the bond were to default. So, buying protection using CDS is like having insurance on a bond.
Now, if you had perfect insurance on a domestic corporate bond then it is a risk-free bond. So, the risk-free rate should be the bond rate minus the cost of insurance ($r_f \approx r_b - r_{cds}$) or spread due to risk should be approximately the cds rate ($r_s \approx r_{cds}$).
There are a metric ton of messy details here, especially for cds indices which are not weighted indices like a stock/bond index, but this gets the main relationship across. Essentially, a risky bond index like Barclays Bond Indicies will change both if the risk-free rate changes and also when the "average" default risk changes for those bonds. A CDS index changes (mostly) on just that default risk part.