I've been trying to authenticate with the K8S API on a cluster on Google Kubernetes Engine, but I'm struggling.
From the GKE API, I have an authentication token for the service account belonging to this project, as well as the certificate belonging to the cluster.
This is what i've got:
const config = new KubeConfig();
config.loadFromOptions({
apiVersion: 'v1',
contexts: [{ context: {} }],
clusters: [{ cluster: { 'certificate-authority-data': GKE.masterAuth.clusterCaCertificate, 'server': `https://${GKE.endpoint}` } }],
users: [{ user: { 'auth-provider': { config: { 'access-token': authToken.credentials.access_token } } } }],
});
const api = config.makeApiClient(CoreV1Api);
Now, this exact config worked fine before using https://github.com/godaddy/kubernetes-client/ However they're merging with https://github.com/kubernetes-client/javascript so I thought I'd migrate across.
However now I get an Error: unable to verify the first certificate
error when attempting to make a request with the API client.