Shred the cabbage.
Thinly slice the onion.
Add salt to the cabbage and onion and let it sit for 30 minutes.
Squeeze out the water from the salted vegetables.
Place the cabbage and onion into a sterilized glass jar.
Mix vinegar, sugar, water, black pepper, and whole peppercorns to make the pickling liquid.
Pour the pickling liquid into the jar and seal tightly.
Let it ferment at room temperature for 2 to 3 days, then store in the refrigerator.