It happens when the molecules are more attracted with other molecules, then that of the container. A good example is Mercury and glass, in barometers.
haha I totally thought you were talking about the knee.....Total brain fart! Yup, time for bed!
Its just a natural thing that happens with water because of surface pressure
its surface tention