colima kubernetes start ends with 'error: no context exists with the name: "colima"'

816 Views Asked by At

I am running colima version 0.5.5 on a Mac M1. When I start Kubernetes via

colima kubernetes start

the command ends with the following error message:

FATA[0093] error starting kubernetes: error running [lima kubectl cluster-info], output: "time=\"2023-06-21T18:15:41Z\" level=fatal msg=\"exec format error\"", err: "exit status 1"

When I check my ˜/.kube/kubeconfig.yaml, this is the content that I get:

apiVersion: v1
clusters: null
contexts: null
current-context: ""
kind: Config
preferences: {}
users: null

I can "manually" get the corresponding kubeconfig via

colima ssh -- cat /etc/rancher/k3s/k3s.yaml > $KUBECONFIG

and replace the default naming with colima and things seem to work as expected afterwards. Still I am wondering what is the proper way of fixing this issue and how do I get a proper kubeconfig after colima kubernetes start?

1

There are 1 best solutions below

1
On

Export KUBECONFIG as follows:

export KUBECONFIG="${KUBECONFIG}:${HOME}/kube/config"

Use context as colima:

kubectl config use-context colima