Error Bootstrapping Localhost Cloud

I’m running the following to bootstrap my Juju localhost Juju cloud controller and I’m getting an error:

Error

ERROR unable to connect to API: x509: certificate is valid for 10.176.158.122, not juju-apiserver

Command

export NO_PROXY=$(echo localhost 127.0.0.1 10.176.158.{1..255} | sed 's/ /,/g')

juju bootstrap --debug \
--model-default http-proxy=$HTTP_PROXY \
--model-default snap-http-proxy=$HTTP_PROXY \
--model-default https-proxy=$HTTPS_PROXY \
--model-default snap-https-proxy=$HTTPS_PROXY \
--model-default no-proxy="$NO_PROXY" \
--model-default cloudinit-gitignore.yml \
localhost lxd

I’ve used this same script before without issues on the same OS, Ubuntu Bionic. I don’t really know how to debug this.


Here is the output of juju --debug --show-log status:

22:15:34 INFO  juju.cmd supercommand.go:83 running juju [2.7.2  gc go1.10.4]
22:15:34 DEBUG juju.cmd supercommand.go:84   args: []string{"/snap/juju/10671/bin/juju", "--debug", "--show-log", "status"}
22:15:34 INFO  juju.juju api.go:67 connecting to API addresses: [10.176.158.122:17070]
22:15:34 INFO  juju.juju api.go:67 connecting to API addresses: [10.176.158.122:17070]
22:15:34 INFO  juju.juju api.go:67 connecting to API addresses: [10.176.158.122:17070]
22:15:34 INFO  juju.juju api.go:67 connecting to API addresses: [10.176.158.122:17070]
ERROR unable to connect to API: x509: certificate is valid for 10.176.158.122, not juju-apiserver
22:15:34 DEBUG cmd supercommand.go:519 error stack: 
x509: certificate is valid for 10.176.158.122, not juju-apiserver
/build/juju/parts/juju/go/src/github.com/juju/juju/api/apiclient.go:1111: 
/build/juju/parts/juju/go/src/github.com/juju/juju/api/apiclient.go:1071: unable to connect to API
/build/juju/parts/juju/go/src/github.com/juju/juju/api/apiclient.go:967: 
/build/juju/parts/juju/go/src/github.com/juju/juju/api/apiclient.go:622: 
/build/juju/parts/juju/go/src/github.com/juju/juju/api/apiclient.go:207: 
/build/juju/parts/juju/go/src/github.com/juju/juju/juju/api.go:72: 
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/modelcmd/base.go:214: 
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/modelcmd/modelcommand.go:424: 
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/modelcmd/modelcommand.go:405: 
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/modelcmd/modelcommand.go:311: 
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/status/status.go:199: 
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/status/status.go:232: 
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/status/status.go:274:

I figured it out. I needed to set the no_proxy environment variable in my shell as well as in the Juju bootstrap, because my local Juju CLI was attempting to use my SSL Bump proxy. Adding the Juju controller address to my no_proxy env fixed the issue.

4 Likes

Awesome, glad it you got it figured out and thanks for sharing.

1 Like

thank you for this case to give me important clue.

In fact, we need to keep the identical value in:

  1. your model-default file which always YAML file.
  2. your no_proxy of OS environment variable.
  3. your /etc/environment file.
1 Like