The resolution of each camera is determined by the size of the image sensor. These sensors are classified by their number of megapixels (approximately one million pixels).
For example, a 1080p security camera will typically use a 2mp image sensor (1920 x 1080 = 2 million pixels). 2K cameras are a little trickier. Since they are defined as having approximately 2000 horizontal pixels, 2K cameras can use either 3mp, 4mp, or 5mp image sensors. The video quality between a 3mp and 5mp image sensor is quite drastic though, even if they are both classified as 2K. Following suit, a 4K camera will have an 8mp image sensor at its core (3840 x 2160 = 8 million pixels).