The process of a country obtaining its independence is complex, but numerous countries have managed it successfully.
There is no ‘right’ to obtain independence per se, but all groups of people have a right to self-determination and South Africa has repeatedly sworn to uphold this right. It means that groups of people (referred to as ‘peoples’ in international law) can decide for themselves how they want to live and be governed. One way in which to exercise self-determination is through secession (breaking away from another country and becoming an independent state).
In practical terms this would include the following steps: