Writing down the details of the argument of Ilya Bogdanov, we can obtain the following upper bound:

**Theorem.** $f(n)\le\frac83n-1$ for every $n\ge 2$.

*Proof.* If $n=3k+1$ or $n=3k+2$, then following the idea of Ilya Bogdanov, divide the cake into $k$ pieces of length $\frac1{n-1}+\frac1n+\frac1{n-1}$. This is possible since
$k(\tfrac1n+\tfrac1{n-1}+\tfrac1{n+1})<1$. Cutting each of these pieces into 5 subpieces of lengths $$\tfrac1{n+1},\;\;\tfrac1{n-1}-\tfrac1{n+1},\;\;\tfrac1{n+1}+\tfrac1n-\tfrac1{n-1},\;\;\tfrac1{n-1}-\tfrac1n,\;\; \tfrac1n,$$ we can compose of these subpieces two pieces of any of the lengths: $\frac1{n-1}$, $\frac1n$, $\frac1{n+1}$. Cutting these $k$-pieces with 5 subpieces requires $5k+1$ cuts. To produce the remaining number of pieces it is necessary to make $((n-1)-2k-1)+(n-2k-1)+(n+1-2k-1)=3n-6k-3$ cuts. Summing up we obtain $5k+1+3n-6k-3=3n-k-2$ cuts.

Therefore, for $n=3k+1$ we have the desired upper bound:
$$
\begin{multline*}
f(n)=f(3k+1)\le 3n-k-2=(9k+3)-k-2=8k+1=\\
=\tfrac83(n-1)+1=\tfrac83n-\tfrac53<\tfrac83n-1.
\end{multline*}$$
For $n=3k+2$ we have a similar upper bound:
$$
\begin{multline*}
f(n)=f(3k+2)\le 3n-k-2=(9k+6)-k-2=8k+4=\\=\tfrac83(n-2)+4=\tfrac83n-\tfrac43<\tfrac83n-1.
\end{multline*}$$

For $n=3k$ we divide the cake into $k-1$ pieces of length $\frac1{n-1}+\frac1n+\frac1{n+1}$ and one piece of lenth $\frac1{n-1}+\frac2{n+1}$. Since
$$(k-1)(\tfrac1{n-1}+\tfrac1n+\tfrac1{n+1})+(\tfrac1{n-1}+\tfrac2{n+1})<1$$such division is possible. Then divide each of $(k-1)$ pieces like in the preceding case.
The remaining piece of length $\frac1{n-1}+\frac2{n+1}$ divide into 5 pices of lengths:
$$\tfrac1{n+1},\;\; \tfrac1{n-1}-\tfrac1{n+1},\;\;\tfrac2{n+1}-\tfrac1{n-1},\;\; \tfrac1{n-1}-\tfrac1{n+1},\;\;\tfrac1{n+1}.$$ Of these 5 subpieces we can compose either 2 pieces of length $\frac1{n-1}$ or 3 pieces of length $\frac1{n+1}$.

Then it suffices to make
$$(5k+1)+((n-1)-2k-1)+(n-2(k-1)-1)+((n+1)-(2k+1)-1)=3n-k-1$$cuts to have the required number of pieces of length $\frac1{n-1}$, $\frac1n$ or $\frac1{n+1}$.
Then
$$f(n)=f(3k)\le 3n-k-1=8k-1=\tfrac83n-1.\qquad\square$$

**Remark.** Comparing the known values (and upper bounds) of the function $f(n)$ for $n\le 5$ (resp. for $n\le 8$) with the upper bound $u(k)=\lfloor\frac83n-1\rfloor$, we see that $f(n)=u(n)$ only for $n=2$ and $n=4$:

$f(2)=4=u(2)$,

$f(3)=6<7=u(3)$,

$f(4)=9=u(4)$,

$f(5)=11<12=u(5)$,

$f(6)\le 14<15=u(6)$,

$f(7)=15<17=u(7)$,

$f(8)\le 19<20=u(8)$.

It is interesting to calculate the precise values of $f(n)$ for small $n\ge6$.