Vasudeva was bound to deliver Krsna to the hands of Kamsa because he had promised to turn over all his children. But out of his great love for Krsna he broke his promise, and the Lord was very pleased with Vasudeva for his transcendental mentality
SB Canto 3
Lord Kṛṣṇa begged pardon from His parents for Their (Kṛṣṇa's and Balarāma's) inability to serve their feet, due to being away from home because of great fear of Kaṁsa. He said, "O mother, O father, please excuse Us for this inability." All this behavior of the Lord gives me pain at heart.
It appears that Lord Kṛṣṇa and Baladeva were both very greatly afraid of Kaṁsa, and therefore They had to hide Themselves. But if Lord Kṛṣṇa and Baladeva are the Supreme Personality of Godhead, how was it possible that They were afraid of Kaṁsa? Is there any contradiction in such statements? Vasudeva, due to his great appreciation for Kṛṣṇa, wanted to give Him protection. He never thought that Kṛṣṇa was the Supreme Lord and could protect Himself; he thought of Kṛṣṇa as his son. Because Vasudeva was a great devotee of the Lord, he did not like to think that Kṛṣṇa might be killed like his other children. Morally, Vasudeva was bound to deliver Kṛṣṇa to the hands of Kaṁsa because he had promised to turn over all his children. But out of his great love for Kṛṣṇa he broke his promise, and the Lord was very pleased with Vasudeva for his transcendental mentality. He did not want to disturb the intense affection of Vasudeva, and thus He agreed to be carried by His father to the house of Nanda and Yaśodā. And just to test the intense love of Vasudeva, Lord Kṛṣṇa fell down in the waters of the Yamunā while His father was crossing the river. Vasudeva became mad after his child as he tried to recover Him in the midst of the rising river.
These are all glorified pastimes of the Lord, and there is no contradiction in such manifestations. Since Kṛṣṇa is the Supreme Lord, He was never afraid of Kaṁsa, but to please His father He agreed to be so. And the most brilliant part of His supreme character was that He begged pardon from His parents for being unable to serve their feet while absent from home because of fear of Kaṁsa. The Lord, whose lotus feet are worshiped by demigods like Brahmā and Śiva, wanted to worship the feet of Vasudeva. Such instruction by the Lord to the world is quite appropriate. Even if one is the Supreme Lord, one must serve his parents. A son is indebted to his parents in so many ways, and it is the duty of the son to serve his parents, however great the son may be. Indirectly, Kṛṣṇa wanted to teach the atheists who do not accept the supreme fatherhood of God, and they may learn from this action how much the Supreme Father has to be respected. Uddhava was simply struck with wonder by such glorious behavior of the Lord, and he was very sorry that he was unable to go with Him.