serverless / serverless-kubeless

This plugin enables support for Kubeless within the Serverless Framework.
Apache License 2.0
303 stars 81 forks source link

Unable to verify the first certificate error when attempting to connect to Docker CE for Windows (Edge) Kubernetes #111

Closed redlava closed 6 years ago

redlava commented 6 years ago

Using Docker CE for Windows (Edge) with Kubernetes enabled and Kubeless v0.5.0 installed, I receive the following error when executing serverless info on the example project:

Error --------------------------------------------------

Error: unable to verify the first certificate

Docker has setup my .kube/config with a https url and insecure-skip-tls-verify: true.

Looking into lib/crd.js of 0.4.0 I can see request being called with connectionOptions, but helper.getConnectionOptions does not include the strictSSL option, which would prevent request from rejecting an invalid connection.

Adding connectionOptions.strictSSL = false; after connectionOptions.insecureSkipTlsVerify = true; on line 139 of lib/helpers.js should resolve this, assuming I've understood the issue correctly.

andresmgot commented 6 years ago

Yes, it seems that for Docker for Windows/Mac it is not enough to set the property insecureSkipTlsVerify would you mind sending a PR with the patch?

Also, note that you would get the same result exporting the environment variable NODE_TLS_REJECT_UNAUTHORIZED=0

mcolomerc commented 6 years ago

$ export NODE_TLS_REJECT_UNAUTHORIZED=0 has solved the issue

Thanks!

andresmgot commented 6 years ago

Let me apply the fix proposed by @redlava so no one finds this issue again.