Make sure you are using your knees correctly.
Body mechanics is a big deal. My doctor was on the road to a knee replacement 25 years ago, and decided he really did not want that. So he learned Tai Chi from an real expert. Tai Chi, as designed, is to train proper body mechanics (in a martial arts context). This made him rethink how he used his knees, and that was the end of the problem! I think martial arts experts that competent are hard to find, so I would talk to a sports medicine doctor. I would be cautious about talking to knee doctors, because they are not in the prevention business, they are in the replacement business.
I find when my knees hurt, I remember my martial arts training and shift my body mechanics, and it helps a lot. Of course it's nearly too late at that point; better to use good body mechanics all the time.
The following is not well-rounded and is far too incomplete to be a lesson on the subject, in a topic that doesn't even lend itself to stating in words. But people asked, so let me try a few things.
Keep your knee with your toe... without actually showing you, what that means is keep 3 lines all in the same plane: hip-knee, knee-heel, and heel-toe. It helps to stretch and open up your hips.
Interesting fact: people have two hips. People often carry them rigidly and locked; it helps to unlock them.
Don't lock your knees, i.e. Don't put them at limits of travel, and especially don't ask them to carry weight.
Imagine a vector line showing how your weight is being carried from your knee to your foot. You want that vector going more-or-less straight down your leg (e.g. Tibia bone), not going through empty space to your midfoot or toe (requiring you to use power to avoid falling forward; the issue isn't the use of power, it's what the stance does to your knee). Since the tibia enters the foot somewhat forward of the heel, that means most of your weight will be on the heel with some on the toe. (If you think about it, that makes sense, right? Less weight on the toes, which allows them to function as trim stabilizers and sensors.)
Since your foot is in a rather heavy hiking boot, it's easy to lose track of these subtleties and just think of the entire foot as a single immobile hammerhead-like object at the end of your tibia. That is how you forget good body mechanics.
That leads to thinking it's a hammer you stomp down, either before or as you put weight on it. Especially if the military has trained you to do that for the cool sound it makes. Impact loads are much worse than static loads (ask a bridge engineer). (And the military tells you to stop stomping on bridges. It's no better for your knees than the bridge). So stop stomping, absolutely, 100%. Consciously place (soft-land) your foot on the surface, then transfer weight to it.
If your footfalls are making more noise than a carefully placed foot, that probably indicates poor placement.
There is no speed limit; you can consciously place as fast as you are able. The point is to rely on placement skills you are learning dynamically for this here surface, not robotically repeating skills you learned 30 years ago.
None of this advice is any substitute for a sports medicine doctor and/or highly competent martial arts training. Tai Chi is a top choice, being an internal martial art (about you and your body rather than external actions), and also providing a context for daily practice.