Do I need a ground rod in addition to a pipe? Subpanel in separate structure
The NEC requires &quot;grounding electrode(s)&quot;, a ground rod is one acceptable electrode. All electrodes that are present are required to be bonded to the service.
To qualify as a service electrode NEC 250.52(A)(5) allows pipe or conduit 8' long, 3/4&quot; min diameter, with a corrosive resistant coating to be used as an electrode.  250.53 requires it be driven to a depth of 8' unless hitting rock bottom, then it can be driven at a 45 degree angle or buried in a trench a minimum 30&quot; deep. Your pipe horizontally buried 18&quot; deep in a trench for convenience it is quite likely to be rejected by the local AHJ. 250.53 also specifies plate, pipe, and rod spacing to be at least 6'.
The connector to the pipe must be NRTL (UL,CSA,MET) Listed for the purpose.
There is also some disagreement about how many electrodes you need, using only a plate, rod, or pipe electrode at a service requires a supplemental electrode. Some jurisdictions allow a single plate, rod, or pipe electrode at an accessory building. I think the argument for the code allowing that is weak, although the logic of a 4th rod electrode could be understandably be argued redundant.