GitLab agent installation with self-signed certificate and SANs fails with x509 error

I am trying to install gitlab-agent using helm with a self-signed certificate that has SANs for the IP address I have created the certificate using OpenSSL with the following configuration file:

distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no

C = VN
O = GitLab
CN =

keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names

IP.1 =

I have regenerated and signed the certificate request with my own CA after changing the configuration file.

However, when I run this helm command:

helm upgrade --install test-tool gitlab/gitlab-agent
--namespace gitlab-agent-test-tool
--set image.tag=v15.9.0
--set config.token=xxx-xxx
--set config.kasAddress=wss://
--set config.caCert="$(cat /home/worker1/helm/server.pem)"
--set kas.sslCertFile="$(cat /home/worker1/helm/server.pem)"

I get the following error:

Connect(): rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: failed to WebSocket dial: failed to send handshake request: Get "": x509: certificate relies on legacy Common Name field, use SANs instead"

What am I doing wrong and how can I fix it?