I’ve solved the jgit problem; the issue is the security context fsgroup, runasgroup, and runasuser. Jnlp uses uid 1000, so changing it to 1000 works.
For error Caused by: java.net.ProtocolException: Expected HTTP 101 response but was '403 Forbidden
was solved with adding rbac rules to the role:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: jenkins
name: jenkins-agent
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get","list","watch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]