I would wait for 24 hours after the injection, BUT if you get a flare up of your pain following the injection, then wait until it has settled before driving.
I have been twice for these - once on my shoulder & once on my ankle. Drove immediately afterwards with no problems. Knees are different of course & what Sqad says seems sensible.
I'm not totally sure of my ground, but based on the occasion that a scan revealed my TIA, the consultant told me that under DVLA laws I should not drive.
If you risked it and had an accident then it would all come to light.
Footnote: under these circumstance the NHS apparently do not advise the DVLA, but you are liable for a very stiff fine if you fail to do so.
NHS doctors can and do report drivers to the DVLA in some circumstances, they just need to be able to justify that they did so to protect the wider public. They don't have to obtain the patient's consent nor tell them they will be/have been reported.
After steroid injections into my wrist, I reckoned on 4/5 hours to drive home before the pain kicked in and put driving out of sensible bounds for a few days.