Here are some examples:
* Correct: Add water as needed.
* Correct: Take medication as needed.
* Correct: I go to the gym as needed.
However, if "as needed" is part of a longer phrase and the phrase itself needs a comma, then you'll need to use a comma.
Here's an example:
* Correct: I will go to the doctor as needed, but I don't think it's necessary at this time.
In this sentence, the comma is used to separate the two clauses, not specifically because of "as needed."