The Marlins have begun the painful task of revamping their rotation following the death of ace Jose Fernandez. They reached a deal with free agent Edinson Volquez on Monday.

The former Kansas City Royals starter agreed to a two-year deal worth $22 million, a source told ESPN's Jim Bowden.

The agreement, which is pending a physical, was first reported by The Miami Herald and confirmed by ESPN.

The 33-year-old Volquez was the Royals' opening day starter last season and an important piece of the rotation during last year's World Series run, in which he started five postseason games. He struggled with inconsistency in 2016 and finished the season winless in his final seven starts. Overall, Volquez went 0-1 with a 6.48 ERA in eight home starts after the All-Star break. He finished with a 10-11 record and 5.37 ERA and allowed 217 hits, second-most in the AL.

An All-Star in 2008 when he went 17-6 with a 3.21 ERA for the Cincinnati Reds, Volquez signed a $20 million, two-year contract with the Royals in 2014 after coming off one of the best seasons of his career with Pittsburgh. He spent 2012 and part of the 2013 season with the Padres, finished that season with the Dodgers and joined Pittsburgh in 2014.

Veteran right-hander Edinson Volquez has agreed to a two-year deal with the Marlins, according to a source. Ed Zurga/Getty Images

Miami's rotation is also expected to include Tom Koehler, Adam Conley and Wei-Yin Chen, who combined to go 22-24 in 2016.

Fernandez died in a boating accident a week before the end of the regular season in September. He went 16-8 with a 2.86 ERA this year.

The right-handed Volquez went 13-7 with a career-best 3.04 ERA for Pittsburgh in 2014, and he ended the season with a career-best 18 straight scoreless innings and had a 1.08 ERA in September that season.

Volquez made his major league debut with Texas in 2005 and went 0-4 with a 14.21 ERA. He went a combined 3-7 the next two seasons and was traded to the Reds for outfielder Josh Hamilton in December 2007. He was suspended 50 games in 2010 following a positive test for a banned fertility substance.

Volquez became a free agent this month when he declined his mutual option with the Royals.

Information from The Associated Press was used in this report.