Aiming at the problem of difficult crack detection in underground urban sewage pipelines, a lightweight sewage pipeline crack detection method based on sewage pipeline robots and improved YOLOv8n is proposed. The method uses pipeline robots as the equipment carrier to move rapidly and collect high-definition data of apparent diseases in sewage pipelines with both water and sludge media. The lightweight RGCSPELAN module is introduced to reduce the number of parameters while ensuring the detection performance. First, we replaced the lightweight detection head Detect_LADH to reduce the number of parameters and improve the feature extraction of modeled cracks. Finally, we added the LSKA module to the SPPF module to improve the robustness of YOLOv8n. Compared with YOLOv5n, YOLOv6n, YOLOv8n, RT-DETRr18, YOLOv9t, and YOLOv10n, the improved YOLOv8n has a smaller number of parameters of only 1.6 M. The FPS index reaches 261, which is good for real-time detection, and at the same time, the model also has a good detection accuracy. The validation of sewage pipe crack detection through real scenarios proves the feasibility of the proposed method, which has good results in targeting both small and long cracks. It shows potential in improving the safety maintenance, detection efficiency, and cost-effectiveness of urban sewage pipes.