  We study the effects associated with nonlinearity of $f(R)$ gravity and of
the background perfect fluid manifested in the Kaluza-Klein model with
spherical compactification. The background space-time is perturbed by a massive
gravitating source which is pressureless in the external space but has an
arbitrary equation of state (EoS) parameter in the internal space. As
characteristics of a nonlinear perfect fluid, the squared speeds of sound are
not equal to the background EoS parameters in the external and internal spaces.
In this setting, we find exact solutions to the linearized Einstein equations
for the perturbed metric coefficients. For nonlinear models with
$f^{\prime\prime}(R_0)\neq0$, we show that these coefficients acquire
correction terms in the form of two summed Yukawa potentials and that in the
degenerated case, the solutions are reduced to a single Yukawa potential with
some "corrupted" prefactor (in front of the exponential function), which, in
addition to the standard $1/r$ term, contains a contribution independent of the
three-dimensional distance $r$. In the linear $f''(R)=0$ model, we generalize
the previous studies to the case of an arbitrary nonlinear perfect fluid. We
also investigate the particular case of the nonlinear background perfect fluid
with zero speed of sound in the external space and demonstrate that a
non-trivial solution exists only in the case of $f''(R_0)=0$.
