0

AKS (Kubernetes) and no connection could be made because the target machine actively refused it

A client of my had an error while connecting to different resources within their Kubernetes cluster in Azure (AKS).

Kubectl error

On the kubectl commands kubectl proxy and kubectl get nodes they got the error:

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

The complete message after visiting the dashboard (that wasn’t loaded) on the command kubectl proxy was:

http: proxy error: dial tcp 127.0.0.1:8080: connectex: No connection could be made because the target machine actively refused it.

Kubectl Proxy

The problem occurs because the command line isn’t able to load the correct config file from the file system. The config file is saved within an environment variable that you can change or alter.

Solution

The solution to the problem was changing or setting the environment variable to the kubernetes config file name “KUBECONFIG”. You can do this by performing the following PowerShell command.

[Environment]::SetEnvironmentVariable("KUBECONFIG", $HOME + "\.kube\config", [EnvironmentVariableTarget]::Machine)

 

Related Posts

Azure DevOps Automation A couple of weeks ago the rename / rebranding of Visual Studio Team Services to Azure DevOps was announced. The rebranding is a great step forward int...
Kubernetes (AKS) attached to Azure Storage (Files) Kubernetes (AKS) can be used for many situations. For a client we needed to make files available trough a Kubernetes Pod. The files needed to be share...
Local Kubernetes cluster with Dashboard When developing containers or applications that need to be hosted on Kubernetes it is handy to have a local Kubernetes cluster. With the use of Doc...
Resource Group deployment via ARM templates When deploying an Azure Resource Manager (ARM) template you have to create a resource group within Azure. To deploy a template via script your script ...
Azure Managed Service Identity and Local Development Instead of storing user credentials of an external system in a configuration file, you should store them in the Azure Key Vault. Before MSI (Managed S...
The securitydata Azure resource group Most of the times companies have rules in place for managing their Azure environment. The main rules that should be in place are “Azure Policies” and ...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.