Keg airlocks are now available if you decide that you would like to use your kegs to ferment your beer. I conduct my secondary fermentation in kegs because I am able to store more of them in my fermentation refrigerator than carboys. Since there is only minimal fermentation occurring during secondary, head space is not a real issue.
An airlock or fermentation lock is a single direction sanitary valve used during fermentation. It allows the large quantities of carbon dioxide being produced by the yeast to escape while not permitting outside air\oxygen or contaminants to enter the fermentation chamber. This creates a sanitary seal on the fermenter and helps prevent the oxidization of the fermenting beer.
The airlock or fermentation lock typically contains a sanitizer to help maintain the integrity of the fermenter. Airlocks tend to be made of clear plastic or glass so that the CO2 bubbles passing through them can be monitored as a way of gauging how active the fermentation process is.
Below is an example of a three piece airlock, S shaped airlock, and a blowoff tube.
Example of different types of airlocks/fermentation locks and a blowoff tube.