This is a very common question among international students. As long as the rental income is passive, and does not require your active work or participation, then it should be fine. It is best to hire a property manager to deal with the active work aspects of the endeavor and maintain good documentary records of how other people have been hired to perform the active labor involved, e.g. cleaning, repairs, etc.
F-1 students are only permitted to work on campus while in school full time, and in fields related to their major in CPT or OPT. There is no black line test for what is considered work, but the factors that are most important are the amount of time you spend on the endeavor and the amount of active work you do. Just collecting rent is fine, but if you are spending many hours per month searching for tenants, addressing their needs, cleaning, making repairs, etc. it may start to look more like a job than a passive investment.
Nonresident aliens pay a high tax rate for domestic passive income as well, so you may wish to consult with a licensed tax professional to make sure you structure your investment in the most favorable way possible and plan ahead to cover future taxes that may be due.
When buying real estate in California it is also advisable to consult with an attorney regarding estate planning and asset protection to reduce personal liability and make it easier to transition ownership upon death or incapacity.