When pushing on the sidewall at the top of the tire: If just the tire moves, it's the wheel bearings. If the tire and spindle move, it's the ball joints. When pushing on the sidewall at the front of the tire: If just the tire moves, it's the wheel bearings. If the tire and spindle move, it could be the tie rod.
If your truck has high mileage and the wheel has been loose for a while, it would be a good idea to replace the wheel bearings. They are a maintenance item, and are often neglected. The wheel bearings should actually be cleaned, inspected, and repacked every 2 years or 30,000 miles. When you remove the wheel bearings and rotor, you will need a new wheel seal for each side, a new cotter pin, and depending upon the condition of the ones you remove, new dust caps. It's also a good time to check your brake pads, calipers, and rotors. If your rotors show sign of heat cracks, or are badly grooved, they should be replaced at the same time.
This work can be done at home. Aside from your wheel lug wrench, a jack, and some jack stands, you will need a screwdriver to remove the dust caps, a needle nose pliers to remove the cotter pin, a torque wrench to tighten the hub nut, the proper size socket for the torque wrench, the torque specification, some wheel bearing grease, paper towels, and brake cleaner (to clean up the rotor). This should be done in a good clean environment; free of dirt and debris as just a little bit of dirt can wreak havoc on your bearings.