Expected HTTP 101 response but was ‘500 Internal Server Error’

Today I found a problem in our Jenkins instance. the build is failing, I checked the log on jenkins master and found the following:

 12:11:18 Expected HTTP 101 response but was '500 Internal Server Error'
12:11:18 	at
12:11:18 	at$2.onResponse(
12:11:18 	at okhttp3.RealCall$AsyncCall.execute(
12:11:18 	at
12:11:18 	at java.util.concurrent.ThreadPoolExecutor.runWorker(
12:11:18 	at java.util.concurrent.ThreadPoolExecutor$
12:11:18 	at

It looks like jenkins agent is not able to talk to jenkins master. so agent thur out a 500 error. After the investigation I found out that was due to the network policy that my colleague was testing.

During the troubleshooting, I found someone else had the same problem. and Jenkins official answers this supposed to be a kubernetes issue rather than jenkins. So this also explains.