patternkubernetesMinor
k3s: The connection to the server localhost:8080 was refused - did you specify the right host or port?
Viewed 0 times
thek3syoulocalhostrefuseddid8080washostport
Problem
When I run any
The connection to the server localhost:8080 was refused - did you specify the right host or port?
kubectl commands, I'm gettingThe connection to the server localhost:8080 was refused - did you specify the right host or port?
Solution
This problem is likely caused by a bad
The contents of
Note in order to tell k3s to use this config file you'll want to configure
You should persist this by having it set in
~/.kube/config perhaps you have a file from a different kubernetes install (minikube) or an older k3s. If the server is local you can fix this by running these commands,mkdir ~/.kube
sudo k3s kubectl config view --raw | tee ~/.kube/config
chmod 600 ~/.kube/configThe contents of
~/.kube/config need to have the same information as /etc/rancher/k3s/k3s.yaml when the server was started (the keys, ip, and ports).Note in order to tell k3s to use this config file you'll want to configure
KUBECONFIG.export KUBECONFIG=~/.kube/configYou should persist this by having it set in
~/.profile or ~/.bashrcCode Snippets
mkdir ~/.kube
sudo k3s kubectl config view --raw | tee ~/.kube/config
chmod 600 ~/.kube/configexport KUBECONFIG=~/.kube/configContext
StackExchange DevOps Q#16013, answer score: 7
Revisions (0)
No revisions yet.