Why do we need a boundary condition in quantum field theories? When we discuss quantum field theory defined on manifolds with a boundary, we always choose a boundary condition for the fields. And the argument usually says that we need the boundary condition to have a well-defined variational problem.
However, what we actually want is a well-defined Hilbert space. How can we see the connection between these two seemingly different things?
The above question makes sense for quantum field theories defined through a classical action. If we consider more general quantum field theories without referring to the action, why do we need a boundary condition for the theory to be well-defined?
 A: Well, if you want to think of QFT in its most general formulation -- I would say that, it is not as much as you must choose boundary conditions, but that you can.
Let $\mathcal H_b$ be the Hilbert space associated to a boundary condition $b$. If you do not want to impose boundary conditions, you could instead declare that your Hilbert space is
$$
\mathcal H=\bigotimes_b\mathcal H_b
$$
where the sum is over all admissible boundary conditions you may be interested in. (For example, if you are dealing with a CFT, you may want to sum over b.c.'s that are conformal only, etc.)
So, technically, you don't need to specify a boundary condition. You could leave $b$ arbitrary, just by allowing any and all boundary conditions.
But, the interesting aspect is that you can choose a boundary condition. Instead of working with the absurdly large Hilbert space $\mathcal H$, you can consistently select a smaller space $\mathcal H_b$. This is not something you can do in general: if you begin with some Hilbert space, you cannot typically select a smaller space and still get a consistent theory. A subspace of a theory does not usually give you a good theory by itself: you may lose unitarity/locality/causality, the subspace might not preserve all the symmetries you need (e.g., Poincaré), etc. The claim is that, for boundary conditions, the space $\mathcal H_b\in\mathcal H$ gives you a good theory by itself.
In this sense, you can think of boundary conditions as giving you "irreducible components" of a QFT, similar to what irreducible representations do to general representations. Reps do not have to be irreducible, but it is useful to work with irreps because any other can be written as a sum of these. And irreps cannot be further subdivided, so they are minimal. Similarly, you may leave b.c.'s unspecified, but it is useful to work with specific b.c.'s because QFTs without b.c.'s can be thought of as a collection of QFTs with b.c.'s.
