To avoid insects and bugs in your kitchen pantry items follow the following methods;
- Before storing and lentils or pulses make sure to sun dry them for 6 hours or dry roast them (i.e. fry in a pan without oil) and after they cool down store them in clean air-tight containers. Follow this step even if you have got them freshly from the grocery store. Do not roast them too much.
 - Add a piece of asafoetida or hing into the storage boxes/containers.
 - Spread some turmeric powder inside the containers to avoid insects.
 - To avoid ants put some cloves inside the sugar storage containers.
 - Always use dry and clean containers, spoons or spatulas. Usage of airtight containers reduces the infection risk.
 - If there are any pulses/lentils/rice infected with the bugs discard them immediately. Or spread them under sun for 6 hours, from morning to noon. Then use them immediately. If you store them, they may get infected again.
 - During frequent intervals (say for about once in 2 months) dry roast or sun dry the stored pulses/lentils. Do this especially when the climate is humid.
 - Spread some neem leaves in the pantry shelves.
 
If you follow the above tips bugs and insects will never ever peep into your kitchen :)