Why dosen't No2 form according to the octet rule?

Supposedly every atom that is in the second period of the periodic table has to obey the octet rule, this means that they have to be surrounded by 8 electrons (or so I was taught). Studying resonance in an exercise they showed how nitrogen as NO2 can form 5 bonds, which would mean that NO2 does not behave according to the rule previously mentioned. I am at a loss, any help would be great. 




No atom has to obey the octet rule. It is a rule. It has no theoretical justification. It works often. But that's all that could be stated. And a lot of compounds are known that do not follow this rule like $O\_2, NO, B\_2H\_6$, etc. And Nitrogen does not form 5 bonds. It cannot. $4$ bonds is the maximum for atoms of the second period (Li, Be, B, C, N, O, F).


 2