Go see a doctor!!!
It's probably something you do wrong. I used to have a similar problem because I often 'overstreched' my knees. When you do this it feels like the leg is relaxed, but actually all weight is carried by the knee and bone structure in stead of by the muscles (i think). I was told by a doctor to simply start paing a lot of attention to the position of my knees and in a couple of months I had changed my habits so that my knees are now a little bend at at (allmost) all times.
Another possible reason could be, that you twist your knee while doing some kind of footwork. Just like you back you knees can take a lot of hard work but they will only take a little abuse before they will alert you by pain.
Finally: If you sit a lot on a chair during day, and you feet can't quite reach the floor (flat feets on the floorsurface) then that will strain your knees too. Soulution: get a small stool (or one or two phonebooks tied together with duct tape) to give your feet the neccesary support.
Anyway: try to focus on the types of movements you knees do when the pain is beginning and go talk to a doctor about it. And remember to take good care of them. I have seen a couple of karate-ka's forced to leave karate due to bad knees and it's a sad sight.
Take care of yourself