The adrenal glands are located above the kidneys and are composed of an outer cortex and inner medulla. The cortex produces three types of hormones - glucocorticoids, mineralocorticoids, and sex hormones. Glucocorticoids such as cortisol help regulate metabolism and the stress response, while mineralocorticoids like aldosterone control water and electrolyte balance. The medulla secretes adrenaline and noradrenaline in response to sympathetic nervous system stimulation to initiate the fight-or-flight response. Both parts of the adrenal glands help maintain homeostasis during stress.