Let $M$ be a Riemannian manifold and $S \subset M$ a compact submanifold of strictly lower dimension. Does every smooth function on $S$ extend to a harmonic function on a neighborhood of $S$?
This is not possible in general, for example because of constraints related to the analyticity of the extension.
For a concrete example, let $M = \mathbf{R}^2$, and $S \subset \mathbf{R}^2$ be a smooth, simple closed curve in the plane so that in the unit disc \begin{equation} S \cap D_1 = \{ x_2 = 0 \} \cap D_1 = (1,1) \times \{ 0 \}. \end{equation}
On $S$ define a function $u_0$ so that on the portion lying inside $D_1$, \begin{equation} u_0: x_1 \in D_1 \cap S \mapsto \mathrm{e}^{1/x_1^2}. \end{equation} This is not analytic, whereas a harmonic extension to a neighbourhood of $S$, say $u$ would be.
The existence of such a harmonic extension $u$ is therefore absurd. In conclusion: no matter how small $\delta > 0$ is chosen, there is no harmonic function $u: D_\delta \to \mathbf{R}$ extending $u_0$, let alone a function defined on a neighbourhood of $S$.

$\begingroup$ (+1) Thanks for your answer; that's very interesting. In the examples that I had in mind, the submanifold $S$ was actually realanalytic (in fact holomorphic). Do you think there can still be an issue? $\endgroup$ Oct 28 at 16:15

$\begingroup$ I think the issue would basically be the same: you can't extend nonanalytic 'initial data'. That being saidand perhaps you're already aware of thisif the given function $u: S \to \mathbf{R}$ is analytic, then some form of CauchyKovalevskaya should give you the desired harmonic extension. $\endgroup$– Leo MoosOct 28 at 16:21

$\begingroup$ That's interesting. In my setup, I can actually assume that $u : S \to \mathbf{R}$ is analytic. So you say the answer to my question is 'yes' if $S$ and $u$ are analytic? $\endgroup$ Oct 28 at 16:25

1$\begingroup$ The answer should indeed be 'yes', at least if $S$ has codimension one. The result should follow from CauchyKovalevskaya theory. Unfortunately I don't know the best reference, but I think Evans covers some of this. Whether there are some issues if $S$ is not embedded or $\dim S \leq \dim M  2$ I do not know. $\endgroup$– Leo MoosOct 28 at 16:40

$\begingroup$ Thanks so much! All you said is very helpful. $\endgroup$ Oct 28 at 17:13