From where do the electrons making cathode rays come? How is the gas in a discharge tube ionised? Do cosmic radiations affect it?
First, here's a diagram of a cathode ray tube:
Cathode rays were named as such because they were emitted from the negative electrode, or cathode, of a high voltage generator. This was done in a vacuum tube. In the diagram, you can see the cathode, from which the rays (really electrons) were emitted. You can also see a tube that went to a vacuum pump. At the other end is the anode of the power supply. So, to answer your first question,
To release electrons into the tube, they first must be detached from the atoms of the cathode. In the early cold cathode vacuum tubes, called Crookes tubes, this was done by using a high electrical potential between the anode and the cathode to ionize the residual gas in the tube; the ions were accelerated by the electric field and released electrons when they collided with the cathode.$^1$
So what little gas was left in the vacuum tube was ionized. The particles of gas were then accelerated by the electric field, hit the cathode, and knocked electrons off of the cathode.
Below is a diagram of a discharge tube:
The ions were just naturally present in the air of the tube. The air around us has some ions in it, weakly ionized from cosmic rays or other sources. These ions were then accelerated from the anode to the cathode, creating a glow throughout the tube.
Finally, I'm not sure what you mean by your last question. Cosmic rays weren't really a part of the experiment.
Hope this helps!
You can read more about cathode rays and discharge tubes here.