Applying the maximum principle is hard here, because you need to find the constant independent of f, so you need to find some sort of open sets B such that $ x \in B $ and $ y \in \partial B$ and that you can find construct a suitable cover of K consisting of such sets to use the compactness. Might be possible, but it is really hard to archieve.
Instead, I suggest the approach using mean value formulas and do estimates using the underlying set over which we are going to integrate:
Let $ x,y \in K $. Choose an open ball $ B(r,x)$ such that $ y \in B(r,x) $ and $ B(2r,x) \subset U $. Using the meanvalue property, we get:
$$ f(x)=\frac{1}{|B(2r,x)|}\int_{B(2r,x)}{f(z)dz} \geq \frac{1}{|B(r,x)|2^2} \int_{B(r,y)}{f(z)dz}$$
In this step we have used that $f \geq 0$ and by decreasing the size of the underlying set $B(r,y)\subset B(2r,x)$, we make the integral smaller.
$$
\frac{1}{4 |B(r,y)|}\int_{B(r,y)}f(z)dz=\frac{1}{4}f(y)
$$
by using the mean value property again. Now, by switiching the roles if necessary, we obtain that $4f(y) \geq f(x) \geq 0.25f(y) $ if x,y and close enough to one another. Now we can can use a compactness argument to extent our result from $B(r,x)$ to K since we can reach any point from x by connecting them with a finite amount of Balls (and that is where the connectedness of the set comes into play).