Some trucks have replaceable ball joints but they typically require a pneumatic chisel to remove the old ones. If yours doesn’t have serviceable ball joints, you’ll need to replace the upper control arms. Here’s a video of how to replace these. Even if your ball joints are serviceable you’ll need to remove the control arms from the vehicle to get them out. Good luck!
https://www.youtube.com/watch?v=yB28GJv1zIM