Connectex no connection could be made because the target machine actively refused it

Connectex no connection could be made because the target machine actively refused it

Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it

Am working on Azure Kubernates where we can store Docker Images in Azure. Here am trying to check my kubectl version, then am getting

Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

So, can you please suggest me “How to resolve for this issue?”

15 Answers 15

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

I think you might missed out to configure the cluster, for that you need to run the below command in your command prompt.

After that you run kubectl get nodes command in your command prompt, then you can get the list of nodes inside the cluster like in the below image.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it For reference follow this Deploy an Azure Kubernetes Service (AKS) cluster.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

I am on windows 10, and for me I did not enable kubernetes on Docker Desktop.

As you can see here, there are no contexts available.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

So go to settings of docker desktop and enable it as follows.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Now run a command as follows.

Ensure you see something like this.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Also you can also try listing the nodes as follows.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

So every time I change the cluster context I need to restart the docker, else I get the same described error.

Unable to connect to the server: dial tcp 127.0.0.1:6443: connectex: No connection could be made because the target machine actively refused it.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

PS: make sure your cluster is started as shown in this picture showing (Stop local cluster)

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

I created a HOME variable with the same value as USERPROFILE and it started working.

I’m using Hyper-V on Local Windows and I met this error because I didn’t configure minikube.

(I know the question is about Azure, not minikube. But this article is on the top for the error message. So, I’ve put the solution here.)

1. enable Hyper-V.

Type in systeminfo on your Terminal. If you can find the line below,

Hyper-V works correctly.

2. Create Hyper-V Network Switch

Open Hyper-V manager. (Searching it is the fastest way.)

Next, click your PC name on the left.

Then, you can find Virtual Switch Manager menu on the right.

Click it and choose External Virtual Switch with name: «Minikube Switch»

Click apply to create it.

3. start minikube

Go back to terminal and type in:

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

I was facing the same error while firing the command «kubectl get pods»

The issue has been resolved by having following steps below:

a) First find out current-context

b) if no context is set then set it manually by using

Hope this will help you.

If you’re facing this error on windows, its possible that your docker instance is not running.

These are the steps I followed to replicate the above error;

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

How did I solve it?

Check if minikube is running in my case this was not running Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Start minikube Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Retry applying your configuration above. In my case see the screenshot below

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Essentially this problem occurs if your minikube or kind isn’t configured. Just try to restart your minikube or kind. If that doesn’t solve your problem then try to restart your hypervisor which minikube uses.

This command solved my issue.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

I had exactly the same problem even after having correct config (by running an azure cli command).

It seems that kubectl expects HOME env.variable set but it did not exist for me. There is however a solution:

If you add a KUBECONFIG environmental variable that will point to config it will start working.

When the variable is present kubectl has no troubles reading from file.

P.S. It is an alternative to setting a HOME variable as suggested in another answer.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

I encountered similar problem:

This setup was working fine until Docker for Desktop bought it’s own copy of kubectl. There are 2 ways to overcome this situation:

I tried both the options and they worked.

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Following @ilya-chernomordik, I’ve added my config path to the System Variable by doing

setx KUBECONFIG «D:\Minikube\Minikube.minikube\config»

I have changed the default Location from C: Drive to D: Drive as i have less space in C.

Now the problem is fixed.

edit: after 5 mins, the api server again stopped. It’s been more than 5-6 hours i’m trying to solve this issue. I’m not sure why this problem is happening, even after adding the coreect path.

Azure self-hosted agent doesn’t have the permission to access Kubernates cluster:

In my situation, I’m in windows with docker desktop in a simple scenario just for studies, but the case is:

In the docker version in 20.10 or above, it come with kubernetes installed. Then it doesn’t necessary installed a cluster adm like minikube. Then, when it just need to enable kubernetes in Docker Desktop configuration. Like:

Go to Docker Desktop: settings > kubernetes > check the box inside section Enable kubernetes and then click in Restart Kubernetes Cluster

When we do this, the docker provide all needed to works Kubernetes properly.

Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it. Windows 10 #53881

Comments

Dev1969 commented Oct 13, 2017

I want to learn Kubernetes and installed it on my laptop that is running Windows 10.

Installed:
minikube using minikube-installer
python-3.6.3
Git-2.14.2.2-64-bit
VirtualBox-5.1.28-117968-Win
kubectl

Install went fine. In the firewall Exception list, I have put minikube and kubectl.

I am getting below error

Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

What could be possible reason for this error? How to fix it?

Please let me know what all information you need to help me on this. I searched for other similar issues but that did not help much.

Thank you in advance.

The text was updated successfully, but these errors were encountered:

dims commented Oct 30, 2017

ddlaat commented Oct 31, 2017

andyzhangx commented Nov 2, 2017

rjmorse commented Jan 29, 2018

This doesn’t look related to running Kubernetes on Windows, but getting Minikube running inside a VM on Windows. This should probably be closed in favor of creating a new question on Stack Overflow, or finding one that is already answered.

fejta-bot commented Apr 29, 2018

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

akochnev commented May 2, 2018 •

I just ran into this issue with VirtualBox, and without minikube.

akochnev commented May 8, 2018

I looked a bit further into my issue, and it turned out that I had a different issue of kubectl not being properly configured with a kubeconfig that points to an actually running API server.

michmike commented May 8, 2018

msiddharthareddy commented Mar 4, 2020

Windows10

Step 2 :
Came back to home directory
C:\Users\msiddhartha>C:\Users\msiddhartha\play\kubernetes\vagrant-provisioning\kubectl
It gives options to run Kubectl

Step 3:
Please copy admin.conf file from master server location(/etc/kubernetes) to C:\Users\msiddhartha.kube

step 4:
rename admin.conf to config in the C:\Users\msiddhartha.kube directory
step5:

C:\Users\msiddhartha>C:\Users\msiddhartha\play\kubernetes\vagrant-provisioning\kubectl cluster-info
Kubernetes master is running at https://192.168.42.100:6443
KubeDNS is running at https://192.168.42.100:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

hasante commented Apr 25, 2020 •

$ kubectl get nodes
Unable to connect to the server: dial tcp IPADDRESS:443: connectex: No connection could be made because the target machine actively refused it.

Even after setting up the KUBECONFIG env variable.

sarojsingh002 commented May 8, 2020

How do you set up environment variable for config. Could some one please explain in details. I am using windows home and trying to docker-compose.yml to k8 but when i do kompose up it says:
Error while deploying application: Get http://localhost:8080/api: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

Thanks in advance

utsavakru commented Aug 19, 2020

Issue : Kubectl get nodes
Unable to connect to the server: dial tcp [::1]:6445: connectex: No connection could be made because the target machine actively refused it.

Reset Kubernetes cluster settings.

Hope this checking configuration properly method helps.

vedantdave77 commented Oct 30, 2020

Hello, I have windows 10 and I also had the same problem, by resetting the kubernetes cluster, now I solved problem.
I was using the docker- desktop and also have the minikube setup. so first I deleted the minikube from the programs and disable the kubernetes from docker desktop.

Then I restart my computer to make sure that the other files removed properly from the file system as well.

For, new installation I used minikube downloading instructions. (https://minikube.sigs.k8s.io/docs/start/). And go with the procedure. After step no. 2, I faced the problem with setup and diverted to «driver page» where, I use the installation with docker section instructions. And, noew my kubernetes works fine.

Short CLI Commands:

ConnectEx tcp: No connection could be made because the target machine actively refused it #1094

Comments

nathanleclaire commented May 2, 2015

Sorry to bring this up on the weekend, I just want to note it down for later reference.

I’m seeing a lot of errors trying to create a machine on my Windows 7 computer at home (this is master branch, probably 03c1fbadc5f53fd863d4149b5b89c9f5bf8e066d ):

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

EDIT: Ah, I wasn’t thinking when I wrote this, but it looks more like a daemon connection issue due to the port 2376 being used.

The text was updated successfully, but these errors were encountered:

ehazlett commented May 19, 2015

Yeah looks like daemon isn’t running. I’ve tested this on Windows 8.1. Perhaps we should set a min version to run with?

ahmetb commented May 19, 2015

@ehazlett I’m not sure if there are any reasons that it wouldn’t run on Win 7.

I’ve seen this error on on OS X as well, for me it was just vbox flakiness, which might very well be happening on Windows as well.

Instead of setting a min version, I would try to find the root cause, because it’s probably the case in newer Windows versions as well if it’s something depending on the setup etc.

nathanleclaire commented May 19, 2015

Yeah, it’s definitely possible it might be something weird in my VBox setup on that computer / Win7. Maybe I can track down another computer with Win7 on it and try to duplicate, and/or try latest master.

ehazlett commented May 19, 2015

nathanleclaire commented Jun 18, 2015

Haven’t been able to dupe this again

nathanleclaire commented Jun 19, 2015

Reopening this. Kitematic is duplicating this with 0.3.0 and some users are running into it. FYI @JeffDM maybe you can provide a little more info about the current situation.

nathanchere commented Jun 29, 2015

Not scientific by any means but I have had the issue on two machines which had VirtualBox already installed, no issue on two boxes where VirtualBox was installed as part of docker-install.exe.
All Windows 7 x64.

leomrocha commented Jul 23, 2015

Same issue,
Running as administrator I get:
Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Running as normal user I get:

Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it

Note that environment variables are OK (yesterday I managed to make it work, but today it stopped working after boot2docker update) and that Set-ExecutionPolicy Unrestricted was executed.

My VBox was installed by hand before having docker installed

Note also that I can connect with boot2docker ssh to the VM and then execute things.

smarques commented Sep 28, 2015

PumpkinSeed commented Oct 25, 2015

Same problem there +1

nathanchere commented Oct 26, 2015

I haven’t dug too far because I simply don’t care as long as it works but here is my anecdotal evidence for what is happening.

With me it appears to have been a VirtualBox-related problem, not something specific to Docker at all. On the machines where I installed VirtualBox myself it was running version 5-point-something. It turns out as of version 4.3.12 there were changes made to VirtualBox where it refuses to start if it fails a ‘hardening’ check on start-up. Amongst other things that check involves an integrity check of the host. In my instance the check failed because I was using a lot of modified files for theming purposes (e.g. replacing icons in shell32.dll).

The Docker-provisioned VirtualBox was installing an older version of VirtualBox so I wasn’t encountering the same issue. Two possible solutions:

dgageot commented Jan 13, 2016

Can @everybody test with docker-machine 0.5.6?

frankschmitt commented Jan 25, 2016

I’m still getting this with docker-machine 0.5.6 (Windows 7 Enterprise, 64bit).

For me, the root cause seems to be my corporate VPN client (Juniper Network Connect).
Whenever I establish a VPN connection, it apparently disables the NIC that VirtualBox uses to communicate with the DockerHost VM. When I shutdown the VPN client, everything starts working again properly.

dipaktelangre commented May 16, 2017

I started getting this issue after docker update

Vespira commented May 22, 2017 •

EDIT : Actually the issue is happening with latest Docker version as well (17.03).

loza0269 commented Jun 7, 2017

I’m getting the same error on Windows 7 enterprise. The only thing I can think of is that SEP is blocking it. Could that be possible?

SKKOVVURI commented Jan 16, 2018 •

(default) DBG | ip addr show
(default) DBG | Error dialing TCP: dial tcp 127.0.0.1:22: connectex: No connection could be made because the target machine actively refused it.
(default) DBG | Error dialing TCP: dial tcp 127.0.0.1:22: connectex: No connection could be made because the target machine actively refused it.
(default) DBG | Error dialing TCP: dial tcp 127.0.0.1:22: connectex: No connection could be made because the target machine actively refused it.
(default) DBG | Error dialing TCP: dial tcp 127.0.0.1:22: connectex: No connection could be made because the target machine actively refused it.

If I open VirtualBox and try running docker from inside the default VM, I get

docker: Error response from daemon, Get https://registry-1.docker.io/v2/ net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).

SKKOVVURI commented Jan 25, 2018 •

I was able to resolve one piece. I just changed NAT to «Bridged» and restarted the VM. so I am able to pull and run images from inside the VM.
Still have the issue from connecting docker-machine (ssh) to the default VM.

127.0.0.1:22: connectex: No connection could be made because the target machine actively refused it.

BTW, I am running on Win 7. Any thoughts??

sinramyeon commented Feb 16, 2018

Still happening on Win7, Redis on docker is running and could check on cli, but can’t connect with gui or api.

dataspun commented Mar 1, 2018 •

Happening on Windows 10 64-bit
Docker version 17.12.0-ce, build c97c6d6
docker-machine version 0.13.0, build 9ba6da9

Any workaround, fix or troubleshooting tips?

MikyChow commented Apr 24, 2018 •

+1,
i am using docker machine 14.0 and docker 18.03.0-ce on windows 10 64bit
does any know how to resolve it?
docker-machine.log

mastrolinux commented Jun 28, 2018

are you all behind a proxy by any chance?

iwaqarhussain commented Nov 26, 2018

palade commented Feb 5, 2019

Happening on Windows 10 64-bit
Docker version 17.12.0-ce, build c97c6d6
docker-machine version 0.13.0, build 9ba6da9

Any workaround, fix or troubleshooting tips?

same problem here

simonm3 commented Mar 3, 2019

I have same problem windows 10 64bit, DockerVersion 2.0.0.2 (30215)

cenelsen commented May 7, 2019

Same problem here with 64-bit Windows 7. Stripe seems flummoxed by it and ngrok hasn’t responded to a support request. After two days, my best guess is Satanic possession, but if Stripe or ngrok come through with a fix, I’ll post it here.

khannaabhi commented Oct 20, 2019

If you are using Virtual Box, there is a chance port only got exposed in VM. Go to VM VirtualBox and do port forwarding.

No connection could be made because the target machine actively refused it. #3501

Comments

KoichiSenada commented Mar 4, 2019

Expected behavior

It is expected that once Docker Desktop is installed on Windows, the hello-world sample should run with the default settings. It is also expected that known problems with that should be published on https://docs.docker.com/docker-for-windows/troubleshoot/

Actual behavior

Run the same «docker run hello-world» command again.

Hello from Docker!
This message shows that your installation appears to be working correctly.

Information

The problem is that the default configuration for Docker Desktop is not compatible with the hello-world example, and there is no related explanation on the troubleshooting page.

Steps to reproduce the behavior

The text was updated successfully, but these errors were encountered:

ebriney commented Mar 6, 2019

Hi @KoichiSenada, docker cli should use named pipe endpoint and not localhost. So perhaps you have DOCKER_HOST set, just unset all DOCKER_* envs.

KoichiSenada commented Mar 18, 2019 •

Hi @KoichiSenada, docker cli should use named pipe endpoint and not localhost. So perhaps you have DOCKER_HOST set, just unset all DOCKER_* envs.

But how is all that related?
Why does that variable break it?

nbv2222 commented May 23, 2019 •

@KoichiSenada Check «Expose daemon on tcp. without TLS» in general settings in docker desktop

docker-desktop-robot commented Aug 21, 2019

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

amit-verma911 commented Nov 2, 2019

I have been facing a similar issue where in when I try to start my Docker Quickstart terminal, and put in the first command (for eg docker run hello-world) i get the below error :

So, I did some digging and found this and Ibelieve this occurs when your VM is inactive.
Here’s how I remedied the situation

docker-machine rm default
after it’s cleaned up you can create a new default machine (assuming you haven’t heavily modified it, then you’ll probably want to script/automate that with packer/terraform etc)

docker-desktop-robot commented Jul 5, 2020

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

Footer

© 2022 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

dial tcp [::1]:5432: connectex: No connection could be made because the target machine actively refused it #1

Comments

lchhieu commented Apr 17, 2017 •

i get error «dial tcp [::1]:5432: connectex: No connection could be made because the target machine actively refused it».
I using win 10
Connectex no connection could be made because the target machine actively refused it. Смотреть фото Connectex no connection could be made because the target machine actively refused it. Смотреть картинку Connectex no connection could be made because the target machine actively refused it. Картинка про Connectex no connection could be made because the target machine actively refused it. Фото Connectex no connection could be made because the target machine actively refused it
thanks

The text was updated successfully, but these errors were encountered:

gernest commented Apr 17, 2017

@lchhieu It looks like postgresql db issue! Have you tried to check your postgresql installation? Can you connect to the database? can you run commands in the database?

gernest commented Apr 17, 2017

My guess your machine doenst have an open port running postgres. Try connecting by hand then you can specify the connection string in your app.

lchhieu commented Apr 18, 2017

@gernest i have db name: golang-todo, pass: », what’s string database_conn

gernest commented Apr 18, 2017

Database is the name of Relational database you are using, this is with reference to the driver of that database

relational databasedatabase name( to appear in confic)
postgresqlpostgres
MySQLmysql

The database_conn is the full connection string for the database you can google for that, how to connect to a database or database connection URL

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *