The *generalized Cantor space* is the space $2^\kappa$, with basic open sets
$$
[\sigma] := \{f\in 2^\kappa : \sigma\subseteq f\},
$$
for $\sigma\in 2^{<\kappa}$.

A space is *$\kappa$-compact* if every open cover has a subcover of cardinality (strictly) smaller than $\kappa$.

**Problem.** For which cardinals $\kappa$ does the generalized Cantor space $2^\kappa$ 
embed as a subspace of every $\kappa$-compact set $C\subseteq 2^\kappa$ with $|C|>\kappa$?

It is a classic result that this holds for $\kappa=\omega$. 

In the original formulation of this problem, I mentioned that,
in light of [an earlier answer][1], the case where $\kappa$ is weakly compact
is particularly interesting, and the expected answer is "for all of these".
According to Yair Hayut's answer below, this is wrong. The full problem,
as stated above, remains open (we need cardinals for which the
answer is positive).

  [1]: https://mathoverflow.net/questions/233018/when-is-the-generalized-cantor-space-kappa-compact