I have bought a virtual private server with a default CentOS 7 installed upon. But I like to know is it possible for me to remove that OS and replace it with CentOS 8? The only way I have access t the server is thrugh SSH
Without knowing more details about the VPS and the provider you are using, it's difficult to answer.
Some provider offer an access to the VPS "BIOS" or to panel like Openstack Horizon to load your own ISO and install it, other providers do not offer this kind of feature.
The short reply is that via SSH you most likely can't "remove" the OS, otherwise you would lose SSH connection itself: you can perhaps check how to upgrade kernel and OS version through EPEL repositories.