The ban in the 8th amendment is on "cruel and unusual punishments". Therefore punishments that are cruel or unusual, but not both, are not banned.
For example it would be hard to argue that excessive prison time is at all unusual in this country. So no matter how cruel it may be, it passes muster. Conversely Shena Hardin was given the unusual punishment of having to stand on a particular sidewalk wearing a sign that said, "Only an idiot would drive on the sidewalk to avoid a school bus." (She was, in fact, said idiot.) The punishment was unusual, but not cruel. It therefore passed constitutional muster.
However being kept in an overly crowded prison without appropriate medical care qualifies as both cruel and unusual punishment and is therefore unconstitutional. (As a variety of courts have had to repeatedly point out to California. Personally I'd love to see the fraction of the prison population that is over the design capacity of prisons in California become the portion of the year that key officials should have to spend inside of said prisons. I'm sure that we'd see Jerry Brown stop dragging his feet on the issue fairly promptly...)