Unopened cans of sauerkraut can last up to 5 years but after 3 years it starts to lose it's freshness.
The homemade sauerkraut that remains sealed or remains in canning jars can last up to 5 years or sometimes longer as well.
When sauerkraut has gone bad it will usually turn a different color and have a bad smell to it or have some mold growth in the sauerkraut.
My Grandma used to can sauerkraut and she kept sauerkraut in canning jars that were never opened for 5 and 6 years and it was still good to eat even though it was not as fresh.
But the sauerkraut you buy in stores in the metal cans can last up to 5 years before it starts to go bad.
If the can is rusty or leaking then it should be thrown out.