Firstly, as Peter mentioned, your equations implicitly assume that the fluid inside is causing the acceleration. Otherwise you need to specify that the system is being pulled. I'll deal with both situations here.
If the water causes the acceleration
Unfortunately, we can't directly deal with the individual cylinder caps because the cylinder tube exerts a force on them. Whenever you have a body, if you want to consider a part of it as a system you need to consider internal forces as well.
So, first lets just look at the cylinder (without the fluid). The $p_0A$ cancels out, and what is left is $p_2A-p_1A$ to the right. So $ma=A(p_2-p_1)$.
From this we can easily tell that $p_2>p_1$ as acceleration is towards the right.
In retrospect, this is obvious, as the fluid is making the cylinder accelerate to the right -- it needs to exert more pressure on the right wall outwards for this effect to take place.
Now, to calculate force on a single cap, we have $(p_2-p_0)A-T_1=m_{cap}a$. Here, $T_1$ is the internal stress between the right cap and the tube. We can write a similar expression for the left cap with a different stress, and write a third expression for the tube itself ($T_1-T_2=m_{tube}a$). Plugging in the values, you will be able to solve for $T_1$ and $T_2$.
If the cylinder is being pulled
In such a case, you will be pulling it with a force $F=(m_{cyl}+m_{fluid})a$ (as this is the only unbalanced horizontal force on the object.
In such a case, there still will be a pressure gradient in the fluid. Easiest way to see this is by considering forces on the shell: There is a balanced $p_0A$ on both sides, there's an $F=m_{cyl}a$ pulling it to the right, and a $(p_2-p_1)A$ to the right from the water pressure. We need $m_{cyl}a+(p_2-p_1)A=m_{shell}a$, and we get $(p_2-p_1)A<0$, so the left side exerts more pressure on the cylinder.
Where does this pressure gradient come from? The acceleration. It's the same thing that creates a gradient in water in the presence of gravity. If you move to the accelerating frame, the pseudo force is just like a gravitational force acting to the left, and it creates the required gradient (force/pressure are frame-invariant, so a gradient in the accelerated frame persists in the static frame).