Kubernetes microk8s

I am unable to setup GitLab to work with microk8s. Both GitLab and microk8s are self-hosted with self-signed certs.

I have followed the documentation from Gitlab on Kubernetes

here and stack overflow with no success I still receive the same error.

There was a problem authenticating with your cluster. Please ensure your CA Certificate and Token are valid.

Are there logs I could look further into for details?

Any help would be much appreciated!

2 Likes

can someone of GitLab maybe give us a short hint if this is supported at all?
After some hours of research my guess is, that they don’t want it to work with self-hosted Kubernetes… :thinking:

I successfully set up GitLab to work with microk8s. I needed to edit /var/snap/microk8s/current/certs/csr.conf.template and add the hostname and fqdn to the [ alt_names ] section.
For ingress to work properly I had to enable metallb with the IP address of the system running microk8s.

1 Like

Hi! Thanks a lot for the feedback here. Could you please elaborate a bit more on what exactly is to be added and the format?

Below is the content of my /var/snap/microk8s/current/certs/csr.conf.template file after my edits. The only edit was to add the line starting with "DNS.6 = " with the value equal to the dns host name used in API URL gitlab setting.

[ req ]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn

[ dn ]
C = GB
ST = Canonical
L = Canonical
O = Canonical
OU = Canonical
CN = 127.0.0.1

[ req_ext ]
subjectAltName = @alt_names

[ alt_names ]
DNS.1 = kubernetes
DNS.2 = kubernetes.default
DNS.3 = kubernetes.default.svc
DNS.4 = kubernetes.default.svc.cluster
DNS.5 = kubernetes.default.svc.cluster.local
DNS.6 = kubernetes.server.mydomain.com
IP.1 = 127.0.0.1
IP.2 = 10.2.1.1
#MOREIPS

[ v3_ext ]
authorityKeyIdentifier=keyid,issuer:always
basicConstraints=CA:FALSE
keyUsage=keyEncipherment,dataEncipherment,digitalSignature
extendedKeyUsage=serverAuth,clientAuth
subjectAltName=@alt_names