The role of Eklavya was to Aura Farm in Mahabharat Epic.
His whole purpose was to show that He was way above than any Student of Guru Dronacharya by himself, Never got any special training from childhood, Trained by himself, No special Guru or Birth, No divinity or special incarnation factors, No Boon nothing.
A single Nishada was superior to all the Kuru Princess combined, His skills put Drona in worry and Arjuna in the Pit of Jealousy and insecurity, Who was occupied with Celestial Weapons and got the knowledge of Dhanurveda fully from Drona himself.
Eklvaya was killed by Lord Krishna in a duel for the welfare of Arjuna, Cause he would have been a huge obstacle for Pandavs later on:
Proud and endued with steady prowess, the Nishada's son, with fingers cased in leathern gloves, looked resplendent like a second Rama. Undeprived of thumb, Ekalavya, O Partha, was incapable of being vanquished in battle by the gods, the Danavas, the Rakshasas, and the Uragas (together). Of firm grasp, accomplished in weapons, and capable of shooting incessantly day and night, he was incapable of being looked at by mere men. For thy good, he was slain by me on the field of battle.
Another reason for his death at the hands of Lord Krishna was Political as mentioned in Udyog Parva:
Ekalavya, the king of the Nishadas, always used to challenge this one to battle; but slain by Krishna he lay dead like the Asura Jambha violently thrashed on a hillock. It was Krishna, who, having Baladeva for his second, slew Ugrasena's wicked son (Kansa), seated in court in the midst of the Vrishnis and the Andhakas, and then gave unto Ugrasena the kingdom.
Eklavya kingdom was the ally of Jarasandha who was the sworn enemy of Lord Krishna and Dwarka. Eklavya served him and was the ace warrior from his side and used to challenge Lord Krishna, Both were opponents rather than sworn Enemies.
My Answer is based on KMG Mahabharat~