For PowerShell or GitLab Runner shells, you may need to use double quotes around properties to ensure it is treated as a single argument in the console.
mvn test "-Dsurefire.rerunFailingTestsCount=2" -Dtest="KafkaTestSuite"
maven-surefire-plugin version 3.5.0 with JUnit 5