Unable `go get` a repository via an HTTP proxy - go

When I am trying to install Burrow https://github.com/linkedin/Burrow#build-and-install
go get github.com/linkedin/Burrow
I am getting the following error :
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1"
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)
I have already set up proxy by:
export http_proxy=myproxy:port
export https_proxy=myproxy:port
Edit:
go get -u gopkg.in/gcfg.v1
also gives the same error:
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1"
(https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)
Edit1:
go get -v gopkg.in/gcfg.v1
Fetching https://gopkg.in/gcfg.v1?go-get=1
https fetch failed: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused
package gopkg.in/gcfg.v1: unrecognized import path "gopkg.in/gcfg.v1" (https fetch: Get https://gopkg.in/gcfg.v1?go-get=1: proxyconnect tcp: dial tcp :0: getsockopt: connection refused)

I was also getting the same error. Turns out that my https proxy was incorrect. Make sure both http and https proxy are pointing to same proxy starting with http.
export http_proxy=<http://proxy:port>
export https_proxy=<http://proxy:port>

Remove env HTTPS_PROXY from your PC:
SystemProperty - Environment - current user variable/system variable : find and remove HTTPS_PROXY.
Restart your terminal to enable env modification to take effect.

I solved the problem using:
export https_proxy=$http_proxy
To a more long lasting solution the /etc/environment can be updated.

Related

Error Connecting to ElasticSearch on CapRover

Have installed ElasticSearch on CapRover using One-Click install; but got the following error when trying to connect:
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000019CF191C370>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
CapRover remaps the port of ElasticSearch: 9200 -> 80
so need to either explicitly specify the port 80:
"<your url or ip>:80"
or alternatively you can change CapRover's port mapping to 9200

kubefwd with microk8s: 127.0.0.1:8080: connect: connection refused

Trying to run kubefwd with microk8s:
sudo kubefwd svc
It fails with an error:
Runtime error: pkg/mod/k8s.io/client-go#v0.0.0-20191108070106-f8f007fd456c/tools/cache/reflector.go:108:
Failed to list *v1.Service: Get "http://localhost:8080/api/v1/namespaces/default/services?
limit=500&resourceVersion=0": dial tcp 127.0.0.1:8080: connect: connection refused
kubefwd does not use kubectl, only the configuration files, so ask microk8s to write its config as its README.md says:
sudo microk8s.kubectl config view --raw > $HOME/.kube/config
After this step kubefwd should work.

Error querying Consul agent: Get http://127.0.0.1:8500/v1/kv/vault?recurse=: dial tcp 127.0.0.1:8500: connect: connection refused

~]$ /apps/bin/consul/consul kv export vault
Error querying Consul agent: Get http://127.0.0.1:8500/v1/kv/vault?recurse=: dial tcp 127.0.0.1:8500: connect: connection refused
I'm trying to export entire vault/ folder from consul.
seeing the below error
Error querying Consul agent: Get http://127.0.0.1:8500/v1/kv/vault?recurse=: dial tcp 127.0.0.1:8500: connect: connection refused
You have to change the http/s address of Consul agent to which you're trying to connect. The default one is http://127.0.0.1:8500 and it doesn't work as you can see in the error.
To do this, set the following environment variable using the export command:
export CONSUL_HTTP_ADDR = <http/s_address_to_consul_agent>
If connecting via TLS, set also:
export CONSUL_CACERT = <path_to_cert_file>
Alternatively, you can set the above values as the parameters to consul kv export command:
consul kv export -http-addr=<http/s_address_to_consul_agent> -ca-file=<path_to_cert_file>

How to enable remote access to Master's proxy - "Failed connect to <ip>:8080; Connection refused"

I am playing with Kubernetes on https://labs.play-with-k8s.com.
I tried to use the kubectl proxy following the instructions in Kubernete's website.
On the Master node (192.168.0.13) I ran: kubectl proxy --port=8080:
[node1 ~]$ kubectl proxy --port=8080
Starting to serve on 127.0.0.1:8080
On the Worker node I ran curl -v http://192.168.0.13:8080 and it failed:
[node2 ~]$ curl -v http://192.168.0.13:8080
* About to connect() to 192.168.0.13 port 8080 (#0)
* Trying 192.168.0.13...
* Connection refused
* Failed connect to 192.168.0.13:8080; Connection refused
* Closing connection 0
curl: (7) Failed connect to 192.168.0.13:8080; Connection refused
Any idea why the connection is refused ?
Starting to serve on 127.0.0.1:8080
As shown in the message it emits on startup, that is because kubectl proxy only listens on localhost (i.e. 127.0.0.1), unless you instruct it otherwise:
kubectl proxy --address=0.0.0.0 --accept-hosts='.*'
and that --accept-hosts business is a regular expression for hosts (presumably Referer headers? DNS lookups?) from which kubectl will accept connections, and .* is a regex that matches every string including the empty ones.

Golang mobile package installation issue

I am trying to install go package for mobile using,
desktop:~$ go get golang.org/x/mobile/cmd/gomobile
But it gives this error
package golang.org/x/mobile/cmd/gomobile: unrecognized import path
"golang.org/x/mobile/cmd/gomobile" (https fetch: Get
https://golang.org/x/mobile/cmd/gomobile?go-get=1: http: error
connecting to proxy http://192.168.0.136:8080/: dial tcp
192.168.0.136:8080: getsockopt: connection refused)

Resources