This is one of those areas where the lines can become a little bit blurred for some vegans. Whether it’s through fear, convenience, or just not knowing what else to do people can often contradict their values and act in ways which aren’t consistent with vegan ethics. There are several different opinions on this within the vegan community, all I can really offer here is my own and try to justify as best I can, but I am by no means speaking on behalf of all vegans.
Firstly, I think it’s necessary to distinguish between pests who are deemed so because they pose a genuine risk to human health, and those we call pests simply because we don’t like having them around. Having a rat or mite infestation in your house is a pest problem, because they can post a genuine risk to humans, will make life uncomfortable, could destroy your property and will make living conditions unhygienic. A spider who has wandered into your house to get out of the cold or to hunt is not a pest, and unless they are venomous they pose no genuine safety risk to you or your family.
Even if an animal genuinely is a pest, that is not a good reason to inflict unnecessary cruelty on them. Where a humane alternative exists, which it usually does, there can be no moral justification for choosing to kill an animal when it isn’t necessary to do so. That an animal occupies the same space as you is not a reasonable reason to kill them unless there is literally no other reasonable option available to you. You might be disgusted by an animal in your home, or genuinely frightened of them, but how you feel about a specific animal doesn’t have any impact on whether they deserve to be treated humanely, including allowing them to live where it is possible to do so.
The most humane option for dealing any pest is preventive measures to ensure they don’t enter your home in the first place, including storing food in proper containers, cleaning any food waste regularly, sealing cracks in walls and blocking space under doors, or any other potential points of entry. When a pest problem emerges in a home, it is usually because these steps have not been taken adequately. For specific animals you might have a problem with, there are usually natural deterrents which are very effective, ranging from fruit juices, specific herbs or flowers, and chemical deterrents depending on the animal in question. There will almost always be a way to deter an animal from entering your house in the first place if you know there is a risk of them doing so.
Once a pest has already established itself in your house, deterrent may no longer be an option for you. If capture and release is possible, which it usually is, this should be the first thing you attempt. Humane traps for rats and mice are widely available, cheap and effective, such as this one. When using catch and release traps, these should only be active when you are in the house and can check the traps at least every two hours. Animals become extremely agitated when trapped like this, and can go into shock or harm themselves trying to escape if not released in good time. A local park is the best place to release, do so gently by opening the trap and setting them in the grass, giving them plenty of time to leave of their own accord rather than forcing them to. For insects and arachnids, humane bug catchers like this one are very effective and don’t require you to get close to the animal in question if you’d rather not do that.
If you are dealing with a true infestation and there is no chance of dealing with the issue in a non-lethal manner, then that may be your last resort. If an animal poses a genuine risk to your health or that of your family, then self-defence can be a reasonable cause for killing, when all other options have been exhausted. This is never a good thing and it’s deeply unfortunate, but it can be necessary in some scenarios, particularly when dealing with insect infestations or animals which pose a real risk of infection, like mosquitoes and cockroaches. Keep in mind that veganism is about avoiding unnecessary harm to animals, but we have to acknowledge that not all harm is unnecessary in all circumstances. It would be unreasonable to expect anyone to tolerate an infestation in their home out of a strict adherence to veganism, since all moral frameworks have to be practical or they will become useless and unobtainable.
When it comes to dealing with pests, we need to make sure we don’t leave our veganism at the door and act out of instinct, fear or discomfort, no matter how tempting that might be. That we don’t always like the animals who share our homes with us is no excuse for treating them unkindly, and our personal feelings towards them should have no impact on whether or not they deserve to be alive. We should apply the same logic to rats, mice, insects and arachnids as we do to all animals, that we should avoid harming them wherever possible, and treat them as individuals whose rights and lives must be respected. No matter how small, how scary or how different they are to us, all animals have the right to life a life free from unnecessary suffering, and we should grant them that right whenever it is in our power to do so.