I'm trying to use the Kubernetes JS client library, and when i try it on a local environment (i am using docker to run a local kubernetes) it works fine, i am creating a pod for testing purposes and the pod is created. When i try on Google Kubernetes Engine i get "HttpError: HTTP request failed".
Here is how i am using the library:
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
Then i use the following method to create a pod, using a V1Pod body:
k8sApi.createNamespacedPod("default", pod).then(
(response) => {
console.log(`Created pod -> ${response}`);
},
(err) => {
console.log(`Error: ${err}`);
}
);