others-how to resolve helm x509: certificate signed by unknown authority error

Problem

When add repository with helm, sometimes you would get this error:

➜  helm repo add   --username myuser --password mypassword  mychart   https://10.1.1.2/chartrepo

Error: looks like "https://10.1.1.2/chartrepo" is not a valid chart repository or cannot be reached: Get https://10.1.1.2/chartrepo/index.yaml: x509: certificate signed by unknown authority

Reason

This reason is that the certificate of your private repository is not trusted by your MacOS system, e.g. the certifcate of the website “https://10.1.1.2” is not trusted by your system, although it might be trusted by your browser, it still need to be trusted by your OS system.

Solution

You should try to trust the certificate in your MacOS’s keychains.

  • Goto keychains–> choose system from left pane –> drag your certificate (xxx.crt) into the right
  • Double click the certificate, and choose “always trust”.

Test

run the command again:

➜  ~ helm repo add   --username myuser --password mypassword  mychart   https://10.1.1.2/chartrepo

"mychart" has been added to your repositories