The incident occurred at about 8:45 a.m. at the hospital, located at 747 52nd St., at Martin Luther King, Jr. Way.
Alameda County sheriff's Sgt. J. D. Nelson said deputies who provide security at the hospital asked the man to drop his knife but that he refused to do so.
Nelson said one of the deputies then fired his Taser stun gun at the man to get him under control. The man was then taken to the John George Psychiatric Pavilion in San Leandro to be evaluated.
He said no one else was injured in the incident.
Nelson said he is waiting to get more information about how the incident began but said the man's family members told authorities that the man said he wanted police to kill him.
Oakland police Sgt. Chris Bolton said Oakland police responded to the incident and helped sheriff's deputies detain the man.