Lord Krishna incarnated as Lord Rama in the Treta yuga to display the pasttimes of an ideal King, to perform heruclean tasks and to please the demi-gods by vanquising their enemy Ravana:
vitarasi dikṣu raṇe dik-pati-kamanīyaḿ
daśa-mukha-mauli-balim ramaṇīyam
keśava dhṛta-rāma-śarīra jaya jagadiśa hare
O Kesava! O Lord of the universe! O Lord Hari, who haze assumed the form of Ramacandra! All glories to You! In the battle of Lanka You destroy the ten-headed demon Ravana and distribute his heads as a delightful offering to the presiding deities of the ten directions, headed by Indira. This action was long desired by all of them, who were much harassed by this monster. (Sri Dasavatara Stotram, verse 7)
In Srimad Bhagavatam, Canto 1, Chapter 3, Sri Suta Gosvami explains to the Sages of Naimisaranya who where headed by Sri Saunaka Rsi, that it is Lord Krishna who is the source of everything! In verse 22, he explains the incarnation of Lord Rama:
nara-devatvam āpannaḥ
sura-kārya-cikīrṣayā
samudra-nigrahādīni
cakre vīryāṇy ataḥ param
SYNONYMS
nara—human being; devatvam—divinity; āpannaḥ—having assumed the form of; sura—the demigods; kārya—activities; cikīrṣayā—for the purpose of performing; samudra—the Indian Ocean; nigraha-ādīni—controlling, etc.; cakre—did perform; vīryāṇi—superhuman prowess; ataḥ param—thereafter.
TRANSLATION
In the eighteenth incarnation, the Lord appeared as King Rāma. In order to perform some pleasing work for the demigods, He exhibited superhuman powers by controlling the Indian Ocean and then killing the atheist King Rāvaṇa, who was on the other side of the sea.
PURPORT
The Personality of Godhead Śrī Rāma assumed the form of a human being and appeared on the earth for the purpose of doing some pleasing work for the demigods or the administrative personalities to maintain the order of the universe. Sometimes great demons and atheists like Rāvaṇa and Hiraṇyakaśipu and many others become very famous due to advancing material civilization by the help of material science and other activities with a spirit of challenging the established order of the Lord. For example, the attempt to fly to other planets by material means is a challenge to the established order. The conditions of each and every planet are different, and different classes of human beings are accommodated there for particular purposes mentioned in the codes of the Lord. But, puffed up by tiny success in material advancement, sometimes the godless materialists challenge the existence of God. Rāvaṇa was one of them, and he wanted to deport ordinary men to the planet of Indra (heaven) by material means without consideration of the necessary qualifications. He wanted a staircase to be built up directly reaching the heavenly planet so that people might not be required to undergo the routine of pious work necessary to enter that planet. He also wanted to perform other acts against the established rule of the Lord. He even challenged the authority of Śrī Rāma, the Personality of Godhead, and kidnapped His wife, Sītā. Of course Lord Rāma came to chastise this atheist, answering the prayer and desire of the demigods. He therefore took up the challenge of Rāvaṇa, and the complete activity is the subject matter of the Rāmāyaṇa. Because Lord Rāmacandra was the Personality of Godhead, He exhibited superhuman activities which no human being, including the materially advanced Rāvaṇa, could perform. Lord Rāmacandra prepared a royal road on the Indian Ocean with stones that floated on the water. The modern scientists have done research in the area of weightlessness, but it is not possible to bring in weightlessness anywhere and everywhere. But because weightlessness is the creation of the Lord by which He can make the gigantic planets fly and float in the air, He made the stones even within this earth to be weightless and prepared a stone bridge on the sea without any supporting pillar. That is the display of the power of God.
Srila Prabhupada has described the pasttimes of Lord Rama in Srimad Bhagavatam, Canto 9, Chapter 10
The arrangement of the stars and planets when Lord Krishna appeared as Lord Rama:
In Bala kaand, Sarga 18, verses 8-11 the arrangement and placements of the stars and planets are described when Lord Krishna incarnated as Lord Rama:
Twice six months had rolled away since the great sacrifice was over and, in the first month of the New Year, on the ninth day of the bright fortnight, the Lord of the worlds chose to take human form and sent down half of His essence as the son of Kausalya (thenceforth to be known as Rama), the world-honored One, the crowning glory ot the grand line of Ikshwaku, and the sum of all perfections. The constellation Punarvasu, of which Aditi was the regent, was chosen to preside at his birth. The Sun, Mars, Jupiter, Venus, and Saturn were in ascension in their respective houses. Aries, Capricornus, Cancer, Pisces and the Libra, Jupiter and the Moon were in conjunction ; the rising sign was Cancer. And Kausalya, shone with unparalleled effulgence, even as Aditi when she gave birth to Indra, the lord of the Shining Ones, the Vajra-wielder. - C. R. Sreeniuasa Aiyangar, 1910.