kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

new incluster swagger loading doesn;t work but depricated does

Open macakmujo opened this issue 4 years ago • 2 comments

after getting this message kubernetes-client deprecated getInCluster see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md#request-kubeconfig- at .out/ReadOperator.js:7:48

I changed to new verion. That stopped working thios morning for no real reason so I consider it unstable const kubeconfig = new k8s.KubeConfig(); kubeconfig.loadFromCluster(); const backend = new Request({ kubeconfig }); const client = new Client({ backend: backend /, version: "1.13"/ }); // swagger-1.13.json.gz await client.loadSpec().catch((e: any) => console.log(e));

I am using minikube with k8 1.15.5

I switched back to depricated style and this started to work :)

const backend = new Request(Request.config.getInCluster()) const client = new Client({ backend }) await client.loadSpec()

Error that I was getting was "Error: Failed to get /openapi/v2 and /swagger.json: forbidden: User "system:anonymous" cannot get path "/swagger.json"

I guess it did not create right context since it is depending on other external library

Thanks

macakmujo avatar Aug 19 '20 14:08 macakmujo

lol ticket 666 you should ban this number :)

macakmujo avatar Aug 19 '20 14:08 macakmujo

We are also using deprecated methods due to the same reason. It would be great if the examples are provided on how to initialize using the new constructor.

jaliph avatar Sep 07 '20 08:09 jaliph