Extension of continuous function

The question is: Let $(K,\rho)$ be compact metric space. $F\subset K$ closed. $f:F\rightarrow \mathbb{R}$ continuous. Is there a continuous extension of $f$ on $K$?

Attempt: Suppose there exists neighbourhood $G$ of $F$; $G=\{x\in K : \rho(x,F)\leq \epsilon\}$. That for every $x\in G$ there exists exactly one $y\in F$ that $\rho (x,F) = \rho (x,y)$.

Than define $f(x) = f(y)\frac{\epsilon - \rho(x,y)}{\epsilon}$ for $x\in G$. Where $y\in F$ and $\rho(x,F) = \rho(x,y)$.

$f(x)=0$ for $x\in K \setminus G$

Function defined like this should be continuous. Problem is that not for every $F$ exists neighbourhood $G$ with desired properties. Is there a way to fix this?

Like define functions $f_\epsilon$ for $\epsilon > 0$. And than somehow mix those functions.

-