I understand that despite she was a convenient guardian for the Cirith Ungol pass, the orcs may still need to patrol the area (or close to it) , but knowing that such creature hunts there, why would the orcs get even close to her lair?
The specific case where they found Frodo was simple enough, as the Choices of Master Samwise explains. Orders:
'Hola! Gorbag! What are you doing up here? Had enough of war already?'
'Orders, you lubber. And what are you doing, Shagrat? Tired of lurking up there? Thinking of coming down to fight?'
'Orders to you. I'm in command of this pass. So speak civil. What's your report?'
Nonetheless they don't like being there, but despite that do use it on other occasions where it's a matter of simple expedience. But they do take appropriate precautions to avoid Shelob (from slightly later in the same chapter):
Orcs go fast in tunnels, and this tunnel they knew well; for in spite of Shelob they were forced to use it often as the swiftest way from the Dead City over the mountains. In what far-off time the main tunnel and the great round pit had been made, where Shelob had taken up her abode in ages past, they did not know; but many byways they had themselves delved about in on either side, so as to escape the lair in their goings to and fro on the business of their masters.
i think it was like cop being told to patrol watts or a soldier told to walk point... you don't like it, but those are your orders