Job Failed: "You must be logged in to the server (the server has asked for the client to provide credentials)"

I have my project set up on gitlab.com as a private repository.

My project is pointing to my external k8s cluster and I have verified I can communicate with kubernetes via a cluster-admin role (based on the gitlab.com documentation). I have tested the connection to kubernetes by installing helm via the kubernetes dashboard on the gitlab.com project page.

When I attempt to do a deployment via my pipeline I am receiving the following error message:

$ kubectl version
Client Version: version.Info{Major:“1”, Minor:“13”, GitVersion:“v1.13.2”, GitCommit:“cff46ab41ff0bb44d8584413b598ad8360ec1def”, GitTreeState:“clean”, BuildDate:“2019-01-10T23:35:51Z”, GoVersion:“go1.11.4”, Compiler:“gc”, Platform:“linux/amd64”}
error: You must be logged in to the server (the server has asked for the client to provide credentials)This is my Service Account and ClusterRoleBinding configuration

apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab
namespace: default

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gitlab-cluster-admin
subjects:

  • kind: ServiceAccount
    name: gitlab
    namespace: default
    roleRef:
    kind: ClusterRole
    name: cluster-admin
    apiGroup: rbac.authorization.k8s.io

Any tips on where to look next would be greatly appreciated.

This appears to be some kind of bug within gitlab.com.

To fix this I removed the Kubernetes configuration via the gitlab.com dashboard and then added a new one.

1 Like

Every once in a while I keep getting that error, anyways I can solve this issue once and for all? It doesn’t make sense that everything this issue happens, we will remove and add the settings again. Can you please advise @sedonami

If someone ever gets this error again, I solved it by clearing the cluster cache in the Kubernetes administration panel

1 Like