Kripke is making clear that there are two different kinds of distinction here (or maybe more than two). There is a distinction between necessary and contingent on the one hand, and a distinction between a priori knowable and a posteriori knowable on the other. The first is a metaphysical distinction and is concerned with what could or could not have been otherwise, while the second is an epistemic distinction and is concerned with what is knowable by rational thought alone versus what is knowable only through empirical observation.
Earlier philosophers had always assumed that all necessary truths are knowable a priori and that anything knowable a priori is necessary. Hence the two categories of necessary and a priori were taken to be coextensive, as were contingent and a posteriori. Against this, Kripke argues that there can be truths that are necessary and a posteriori, and also truths that are contingent and a priori. He gives a number of arguments for this position in his book, Naming and Necessity, and this is not the place to rehearse them. Given that you agree with the necessity of "Hesperus is Phosphorus", you understand the distinction, and concur, at least in part, with Kripke's view of the matter.
On Kripke's account, Hesperus and Phosphorus are rigid designators, and so denote the same individual in all possible worlds. And since every individual is necessarily identical with itself, this identity is necessary. The corollary is that non-identity is also necessary. If two names a and b rigidly designate individuals in the actual world that are not identical, then this is also necessary. What remains is an illusion of contingency, whereby we could imagine circumstances in which qualitatively identical observations might lead to two distinct heavenly bodies being named Hesperus and Phosphorus, in which case "Hesperus is Phosphorus" would be false under those circumstances.
Kripke's views are highly influential, though I would say not amounting to a consensus. The nature of the necessity he speaks of can be thought of as resulting from a linguistic convention that chooses to treat names as rigid designators. In the case of necessary a posteriori truths, empirical facts make them true and linguistic conventions make them necessary. If one wished to argue against Kripke's position, one might object that modal language can be understood only in the context of some theory, and that there is no single theory that allows us to say unequivocally what is necessary and what is not. Rather, we are left with a piecemeal approach of identifying what is necessary or contingent relative to some given theory or set of presuppositions.