What follows is descriptions of how, according to the Mahabharata arguably the most important text of Ancient India, a caste member can attain a higher caste level.
From the Mahabharata, Anusasana Parva
For Sudra to rise up to a Vaisya
If the Sudra desires to be a Vaisya, he should abstain from meat of animals not slain in sacrifices. He should be truthful in speech, and free from pride and arrogance. He should rise superior to all pairs of opposites (such as heat and cold, joy and sorrow etc.), he should be observant of the duties of peace and tranquillity.
He should adore the deities in sacrifices, attend with devotion to the study and recitation of the Vedas, and become pure in body and mind. He should keep his senses under subjection, honour the Brahmanas, and seek the welfare of all the orders.
Leading the domestic mode of life and eating only twice a day at the prescribed hours he should gratify his hunger with only such food as remains after the needs have been satisfied of all the members of his family with dependants and guests. He should be abstemious in food, and act without being impelled by the desire of reward. He should be free from egotism. He should adore the deities in Agnihotra (Sacred Fire Ceremony) and pour libations according to the ordinance.
Observing the duties of hospitality towards all persons, he should, as already said, eat the food that remains after serving all others for whom it has been cooked. He should, according to the ordinance laid down, worship the three fires.
For Vaisya to rise to a Kshatriya
If a Vaisya,( after becoming a Kshatriya, wishing to become a Brahmana), goes through the usual purificatory rites, becomes invested with the sacred thread, and betakes himself to the observance of vows, he should make presents, adore the deities in great sacrifices with plentiful Dakshinas (gifts), study the Vedas. He should interfere for dispelling the sorrows of the distressed, and should always righteously cherish and protect those subjects that own his sway. He should be truthful, and do all acts that have truth in them and seek happiness in conduct like this. He should induce men to do righteous deeds. . . . He should always observe fasts, keep his soul under control, devote himself to the study of the Vedas, and be pure in body and mind.
He should pursue the aggregate of Three (Virtue, Wealth and Pleasure), and be always cheerful. He should never desire anything from motives of gain or pleasure. He should worship the Pitris (ancestors) and gods and guests.
In his own house, he should live the life of a mendicant. He should duly adore the deities in his Agnihotra, morning, noon and evening every day, by pouring libations agreeably to the ordinance.
For Kshatriya to rise to a Brahman
Endued with knowledge and science, purified from all dross, and fully conversant with the Vedas, a pious Kshatriya, by his own acts, becomes a Brahmana. It is with the aid of these acts, that a person who has sprung from a degraded order, viz., a Sudra, may become a Brahmana refined of all stains and possessed of Vedic lore.
For Brahmana to lower to a Sudra
One that is Brahmana, when he becomes wicked in conduct and observes no distinction in respect of food, falls away from the status of a Brahmanhood and becomes a Sudra.
Even a Sudra that has purified his soul by pure deeds and that has subjugated all his senses, deserves to be waited upon and served with reverence as a Brahmana.. This has been said by the Self-born Brahman Himself. When a pious nature and pious deeds are noticeable in even a Sudra, he should be held superior to a person of the three regenerate classes. Neither birth, nor the purificatory rites, nor learning, nor offspring, can be regarded as grounds for conferring upon one the regenerate status. Verily conduct is the only ground.