A cantonment is a military base in India. The Kipling Society notes that the Segowlee Cantonment is a fictitious location; however, a cantonment is a real place where soldiers live and train. A cantonment is a place for warriors.
It makes sense that this story happens in a place where warriors live because Rikki-tikki is a warrior. He may not be fighting humans, and he may not have human weapons of war, but that doesn't mean Rikki-tikki isn't a warrior with warrior weapons. He's very quick, and has teeth that are capable of stabbing flesh for the killing blow. Rikki-tikki is asked to put his warrior skills into practice during this story too. He kills three deadly snakes over the course of the short story. For a children's story, the body count is fairly high.
The opening paragraph of the story also helps sell the cantonment setting.
This is the story of the great war that Rikkitikki-tavi fought single-handed. . .
Readers are introduced to a character fighting a war. Active combat soldiers live in military bases. Rikki-tikki is an active warrior in this story, and he is housed in a cantonment.