Morale is a huge issue on boomers and subs, which patrol for months at a stretch, generally submerged the entire time (the whole idea being for your adversary to not know where you are). Crap food on top of the isolation and lack of outdoor exposure fares poorly (so to speak).
Fresh produce is limited to the first week or so of cruise AFAIU, but preserved/frozen and dry goods are available for the duration. I don't know if there's any fresh-grow possible, though there've been experiments.
(General information, no direct experience.)
Some sources:
"Everything you wanted to know about food on a US submarine" https://www.popularmechanics.com/military/navy-ships/a147643...
"Sub Grub Is Navy’s Five-Star Secret" (2003) https://www.latimes.com/archives/la-xpm-2003-jan-18-fi-subma...
"US navy researchers conduct tests to grow vegetables on submarines" (2016) https://www.theguardian.com/us-news/2016/jul/06/vegetable-ga...