SQL-Neuling
SQL-Neuling

Reputation: 1829

Using helm and a Kubernetes Cluster with Microk8s on one or two local physical Ubuntu server

I installed Microk8s on a local physical Ubuntu 20-04 server (without a GUI):

microk8s status --wait-ready
microk8s is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    ha-cluster           # Configure high availability on the current node
    helm                 # Helm 2 - the package manager for Kubernetes
  disabled:

When I try to install something with helm it says:

Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp 127.0.0.1:8080: connect: connection refused

What configuration has to be done to use the MicroK8s Kubernetes cluster for helm installations? Do I have to enable more MicroK8s services for that? Can I run a Kubernetes cluster on one or two single local physical Ubuntu server with MicroK8s?

Upvotes: 3

Views: 4931

Answers (2)

Eric Prince
Eric Prince

Reputation: 1

check to see if there is any ~/.kube/config if there is a .kube/config just run

[microk8s] kubectl config view --raw > ~/.kube/config    

or if there is non then you will get

Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp 127.0.0.1:8080: connect: connection refused 

may be when you try to install with helm.

so run microk8s config to output the kubeconfig file from MicroK8s. If you have not already configured kubectl on the host, you can just open a terminal and generate the required config:

cd $HOME
mkdir .kube
cd .kube
microk8s config > config 

following this steps the problem was resolved

Upvotes: 0

kkopczak
kkopczak

Reputation: 862

Searching for solution for your issue, I have found this one. Try to run:

[microk8s] kubectl config view --raw > ~/.kube/config

Helm interacts directly with the Kubernetes API server so it needs to be able to connect to a Kubernetes cluster. Helms reads the same configuration files used by kubectl to do it automatically.

Based on Learning Helm by O'Reilly Media:

Helm will try to find this information by reading the environment variable $KUBECONFIG. If that is not set, it will look in the same default locations that kubectl looks in.


See also:

Upvotes: 5

Related Questions