SAN JOSE — Faced with significant salary hikes and ballooning health benefit and pensions, school districts across the state scrambled to balance their budgets at the end of the fiscal year.

And the outlook for the coming years is even worse.

Current and looming money problems beset school districts small and large, from tiny San Bruno Park — deemed by the state to be at risk of insolvency — to the 41-school San Jose Unified, which expects to cut 150 jobs before school reopens in August.

“It’s like a tidal wave of expenses coming our way,” said San Jose Unified trustee Kimberly Meek.

Across the state, districts struggled to adopt balanced budgets by June 30 for the next three years, as required by law.

“Two-thirds of districts I look at have problems in the third year with deficit spending,” said Ron Bennett, CEO of School Services of California, which advises 850 of the state’s roughly 1,000 districts. About one-third see problems in the second year, and a handful are making big cuts in the first year, 2017-’18, he said.

Among them is Cupertino Union, which faces a $5.6 million deficit next year — even after laying off staff and making $2.6 million in cuts this spring, CBO and co-interim Superintendent Chris Jew said.

It just may be that in 10 years, schools will look back on 2017 as the last good year in recent times for public education.

“We will look back on what has been sacrificed, and what we had to let go,” said Cupertino district spokesman Jeff Bowman.

Despite a bright economic climate, voter-approved state tax hikes and $74.5 billion that California will devote to K-12 education and community colleges in 2017-’18 — a $3.1 billion year-over-year increase — schools are in financial distress.

Put simply, the state budget includes a 1.56 percent cost-of-living increase to districts amid costs that are rising at a starkly higher rate. So districts must cut programs or find out-of-the-box solutions.

To avoid “draconian budget cuts” in the coming school year, the East Side Union High School District board in San Jose signaled that it is prepared to cut 140 jobs in the two years after that, unless negotiations with employee unions come up with other savings. Otherwise, the district faces being $27 million in the hole in 2019-’20.

“The last thing the board and I want to do is lay any employee off,” Superintendent Chris Funk said.

The cuts will be hard to make. With extra cash from the state in recent years, Funk noted, the district has put in place a wider safety net for its students, many from needy families. It’s not anxious to dismantle programs contributing to student success.

But stability for California public schools has been elusive as funding fluctuates with the economy and tax revenues.

With a currently healthy state budget, the biggest threat to balanced school budgets is the growing bite taken by public retirement systems — CalSTRS for teachers and CalPERS for support staff. Next school year, those assessments will be about 15 percent of employer payroll. Four years from now, the CalPERS obligation will exceed one-quarter of salaries and is scheduled to continue growing in an effort to enable it to better cover its projected retirement payouts. District payments to CalSTRS will jump up to 19.1 percent of payroll.

The increases already have had an effect. In the past school year, San Jose Unified’s contributions to retirement systems were more than 2½ times what they were in 2006-07. It’s a $22.3 million increase.

“If the school district gives no raises, our employee costs will still be significantly more year over year,” Deputy Superintendent Stephen McMahon said. “That’s a really tough message for people to understand.”

While the beneficiaries of pensions include local teachers and janitors, secretaries and classroom aides, the costs to districts are set in Sacramento.

The Bay Area’s high cost of living imposes an additional toll on schools. With young families unable to afford housing, school enrollment is declining in many areas, and with it attendance-based school funding.

In San Jose Unified, administrators aim to shed 150 jobs — and anticipate more cuts.

“We are facing challenges much bigger than the school district can fix,” McMahon said.

While the crisis looms in the future for most schools, the wolf has arrived at the door of the San Bruno Park district. Deemed by San Mateo County Office of Education to be in fiscal crisis, the small district racked up a $1.6 million deficit — 9 percent of its revenue — in the past school year. The district runs six elementary and one middle school for fewer than 2,700 students.

Board President Henry Sanchez blamed outsourcing of special-education services as a factor in running up expenses.

The county office of education has been advising San Bruno Park, which has gone through four top business officials in two years. To get the district on a stable footing will take some time, said Denise Porterfield, deputy superintendent of the county office of education.

“I’m estimating no less than a year,” she said.

Other school districts fear ending up as beleaguered as San Bruno Park.

“If this path continues, there’s no way we can provide services to students,” San Jose Unified’s McMahon said. “We are facing challenges much bigger than the school district can fix.”