Do we need inertial frames in Lagrangian mechanics? Do Euler-Lagrange equations hold only for inertial systems? If yes, where is the point in the variational derivation from Hamilton's principle where we made that restriction?
My question arose because I was thinking how could you describe the motion of pendulum with an oscillating suspension point, something like this:

If you take your coordinate frame fixed in the suspension point, you would get the motion of a simple pendulum, which is false (because it's a non-inertial frame and you should have virtual forces).
But if it were moving at constant speed, a moving coordinate frame should give the same equations of motion.
So where does the restriction to non-inertial frames come from in the Lagrangian formalism? I've read that in non-inertial frames the lagrangian would be $L(q,\dot q, \ddot q, \dddot q..., t)$, but I didn't see a detailed explanation.
And I'm not sure if the situation would be similar to Kepler's problem in polar coordinates.
 A: It depends on how you "derive" Lagrange's equations, whether taking Newton's laws as fundamental or by assuming an action integral and minimizing it. However, there is no such requirement that you be in an inertial frame of reference.
Thus, to look at your pendulum problem, you could start with the Lagrangian
\begin{equation}
L = \frac{1}{2} I \dot{\theta}^2 + m g r \cos \theta
\end{equation}
and this would be in the reference frame of sitting still relative to the pendulum. Now, you could just as well take yourself to be riding on a simple pendulum, and take a new coordinate
\begin{equation}
\vartheta = \theta - \cos\left ( \sqrt{\frac{mgr}{I}} t \right )
\end{equation}
which gives you a new Lagrangian
\begin{equation}
L' = \frac{1}{2} I \left ( \dot{\vartheta} - \sqrt{ \frac{mgr}{I}} \sin \left ( \sqrt{ \frac{mgr}{I}} t \right ) \right )^2 + mgr \cos \left ( \vartheta + \cos\left ( \sqrt{\frac{mgr}{I}} t \right ) \right )
\end{equation}
and then the equations of motion for $\vartheta$ will tell you how far away you are from the linear problem. This is certainly an allowed transformation which, you can confirm by direct substitution yields the correct equations of motion.
A: I) In e.g. Ref. 1 is shown that there exist (possibly velocity-dependent) generalized potentials for all the fictitious forces, such as, e.g., the centrifugal force, the Coriolis force and the Euler force. So Yes, there exist Lagrangian formulations for non-inertial accelerated reference frames. 
II) OP's image shows Kapitza's pendulum. Kapitza's pendulum is e.g. interesting because it has surprisingly a stable equilibrium at the inverted/upper vertical position. A detailed Lagrangian formulation (including a slow-mode effective formulation) of Kapitza's pendulum is given on the Wikipedia page.
References: 


*

*L.D. Landau & E.M. Lifshitz, Mechanics, vol. 1 (1976) $\S$ 39.

A: The use of inertial frames in Lagrangian mechanics is by no means compulsory and everything can be done in any reference frame provided one takes all forces, real and inertial, into account.
Actually there are two possibilities in interpreting the question.


*

*We work in a non inertial frame  $R'$ (instead of an inertial one $R$) because we are adopting coordinates $q'^k$ at rest with $R'$. In other words: If we keep all the $q'^k$ fixed, the points of matter the physical system stay at rest in $R'$.

*We work in a non inertial frame  $R'$ (instead of an inertial one $R$)  because the  Lagrangian encompasses all forces (real forces and inertial ones) appearing in $R'$.
These are two completely independent viewpoints whose interplay I go to illustrate.
Everything relies upon the following general result.
I will refer now to a generic pair of reference frames $R$ and $R'$ without assuming that one of both are inertial.
Proposition.
Suppose that a Lagrangian $L|_R(r,q, \dot{q})$ is both


*

*(a) constructed out of the forces appearing in a reference frame $R$, 

*(b) using coordinates $q^k$ at rest with that frame. 
If that Lagrangian is described passing to coordinates $q'^h$ ($*$)  at rest with another reference frame $R'$, i.e,:
$$L'|_R(t, q', \dot{q}'):= L|_R(t, q(t,q'), \dot{q}(t,q', \dot{q}'))$$
then it produces the correct equations of motion in $R'$, though, in general it may happens that:
$$L'|_R(t, q', \dot{q}') \neq L|_{R'}(t, q', \dot{q}')$$
where, in the RHS a Lagrangian takes place directly constructed out of all the forces manifesting in $R'$ and referred to coordinates at rest with $R'$.
The said result has two remarkable consequences: (i) The Lagragian of a given system is not uniquely given, (ii) as soon as we make a choice of a Lagrangian of a system we can suppose that it transform as scalar without affecting the equations of motion, written in whatever reference frame.
The mentioned result implies something for the special case where $R$ is inertial and $R'$ is not. Let us start constructing $L|_R$ in $R$. For the sake of simplicity we stick to the form:
$$L|_R(t,q, \dot{q}) = T|_R(q,\dot{q}) - U|_R(q)\quad (1)$$
i.e. all forces are supposed to be conservative in $R$. The more general case of real forces due to a generalized potential (see below),  like electromagnetic forces, does not involve any further difficulty.
In $R'$ the real forces associated with $U$ keep existing, but new inertial forces show up described by some added term $-V$ below, so the Lagrangian must  be of the form:
$$L|_{R'}(t,q', \dot{q}') = T|_{R'}(q',\dot{q}') - U|_R(q(t,q')) - V(t, q', \dot{q}')\quad (2)$$
Making use of (1) and (2) we conclude that:
$$V(t,q',\dot{q}') = T|_{R'}- T|_R \quad (3)$$
It is easy to see,  by direct inspection form (3), that:
$$V(t,q',\dot{q}') = \phi(t,q') + \sum_{k=1}^n A_k(t,q')\dot{q}'^k\quad (4)$$
This object is called a generalized potential. Physicists are familiar with it, because it appears when dealing with the Lagrangian of charged particles immersed in a given (non-stationary) electromagnetic field. Inertial forces are described by a similar theoretical object. A closer scrutiny of the motion equations:
$$\frac{d}{dt} \frac{\partial L|_{R'}}{\partial \dot{q}'} - 
\frac{\partial L|_{R'}}{\partial q'}=0$$
namely:
$$\frac{d}{dt} \frac{\partial T|_{R'}}{\partial \dot{q}'} - 
\frac{\partial T|_{R'}}{\partial q'}= -\frac{\partial  U|_R(q(t,q')) }{\partial q'} 
- \frac{\partial V}{\partial q'} + \frac{d}{dt} \frac{\partial V}{\partial \dot{q}'} $$
proves that the last two terms in the RHS are, in fact,  responsible for all inertial forces (e.g. centrifugal and Coriolis' forces and all remaining ones for a generic motion of $R'$ with respect to $R$). In a sense, in particular Coriolis' force is similar to magnetic force and is associated with the functions $A_k$ in (4).

footnotes
($*$) I assume here that the coordinate transformation is adapted to the structure of the manifold on which $L$ is defined. The structure is that of a fiber bundle (a jet bundle) over the line of time  $\mathbb R$. So:
$$t'=t\:, \quad q'^k = q'^k(t,q)\:, \quad \dot{q}'^k = \frac{\partial q'^k}{\partial t} + \sum_{h=1}^n \frac{\partial q'^k}{\partial q^h} \dot{q}^h$$
