# Localhost:8080 was refused

**URL:** https://forums.suse.com/t/localhost-8080-was-refused/18434
**Category:** k3s, k3OS, and k3d
**Created:** [September 26, 2020, 11:50pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434 "2020-09-26T23:50:13Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Pete\_Noto](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/pete_noto/32/6705_2.png) [@Pete\_Noto](https://forums.suse.com/u/Pete_Noto)
#### Post date: [September 26, 2020, 11:50pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/1 "2020-09-26T23:50:13Z")

</div>

Hello all,

I am a total noob regarding Kubernetes so please forgive me if this is an obvious one and I’m just not seeing it.

I’ve been following this [GUIDE](https://kauri.io/install-and-configure-a-kubernetes-cluster-with-k3s-to-self-host-applications/418b3bc1e0544fbc955a4bbba6fff8a9/a) to set up a cluster of Raspberry Pi’s.

I believe I have the server up and running, but both of my agents are returning an error when I run `kubectl get nodes -o wide` they both return `The connection to the server localhost:8080 was refused - did you specify the right host or port?`

Any guidance you can lend would be most appreciated.

Cheers…

---

<div class="post-metadata">

### Author: ![Magnus\_Grongaard](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/magnus_grongaard/32/6677_2.png) [@Magnus\_Grongaard](https://forums.suse.com/u/Magnus_Grongaard)
#### Post date: [September 28, 2020, 8:19am UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/2 "2020-09-28T08:19:10Z")

</div>

On my cluster, I receive the same message when running the command from nodes instead of the master, maybe that’s doing it?

---

<div class="post-metadata">

### Author: ![Pete\_Noto](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/pete_noto/32/6705_2.png) [@Pete\_Noto](https://forums.suse.com/u/Pete_Noto)
#### Post date: [September 28, 2020, 7:54pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/3 "2020-09-28T19:54:39Z")

</div>

@Magnus_Grongaard yes this is what is causing it. I learned that the other night with help from the Rancher Slack channel. Forgot to circle back and update this post.

Cheers…

---

<div class="post-metadata">

### Author: ![TimVanDerMeulen](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/timvandermeulen/32/7480_2.png) [@TimVanDerMeulen](https://forums.suse.com/u/TimVanDerMeulen)
#### Post date: [April 17, 2021, 5:14pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/4 "2021-04-17T17:14:55Z")

</div>

Got the same issue here. It’s the only node I have so I assumed it to already be a master.  
config:

```
hostname: k3s-master-60
ssh_authorized_keys:
  - xxx

write_files:
  - path: /var/lib/connman/default.config
    content: |-
      [service_eth0]
      Type=ethernet
      IPv4=192.168.178.60/255.255.255.0/192.168.178.60
      IPv6=off
      Nameservers=192.168.178.52

k3os:
  ntp_servers:
  - 0.de.pool.ntp.org
  - 1.de.pool.ntp.org
  - 2.de.pool.ntp.org
  - 3.de.pool.ntp.org
  - ptbtime1.ptb.de
  - ptbtime2.ptb.de
  - ptbtime3.ptb.de
  dns_nameservers:
  - 8.8.8.8
  - 1.1.1.1
  token: serverSecret
  password: xxx 

```

where serverSecret is the actual text for the token.  
I even tried a config with

```
k3s_args:
  - server
  - "--disable-agent"

```

and without setting the token but it did’nt help.

Since [Release v0.11.1 · rancher/k3os · GitHub](https://github.com/rancher/k3os/releases/tag/v0.11.1) did not boot on my rpi4 I used [GitHub - sgielen/picl-k3os-image-generator: Generate images for k3os compatible with various armv8/aarch64/arm64 devices](https://github.com/sgielen/picl-k3os-image-generator) to generate my img. I don’t know if it matters =)

Screenshot of the error and netstat:

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/d/d8c8dcff842f65cccac60ca25837a970427fba26.png)

What am I missing?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![TimVanDerMeulen](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/timvandermeulen/32/7480_2.png) [@TimVanDerMeulen](https://forums.suse.com/u/TimVanDerMeulen)
#### Post date: [April 17, 2021, 5:16pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/5 "2021-04-17T17:16:02Z")

</div>

And as a side problem… my time is broken as well:

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/9/9aee9008239cf9c6158e666a05d025734e43819e.png)

Sorry for the split of the comments, but I am not allowed to put that Screenshot into the first comment, because my account is new. =)

---

<div class="post-metadata">

### Author: ![TimVanDerMeulen](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/timvandermeulen/32/7480_2.png) [@TimVanDerMeulen](https://forums.suse.com/u/TimVanDerMeulen)
#### Post date: [April 21, 2021, 11:46am UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/6 "2021-04-21T11:46:40Z")

</div>

I found the solution myself:  
I randomly stumbled across the solution after punching my rpi4 with all commands I could find. After a lot of trial and error which commands were the ones I actually needed I shrinked it to the addition of the following config. No guarantees, that it is working 100% of the time but I tried it a few times booting the image after a new flash and it worked all the time.

```
boot_cmd:
  - "ln -sf /etc/init.d/swclock /etc/runlevels/boot/swclock"
run_cmd:
  - "service ntpd start"

```

Source of the needed code:

- boot\_cmd → [Issues · rancher/k3os · GitHub](https://github.com/rancher/k3os/issues/381blog)
- run\_cmd → [k3OS - Kubernetes on Intel Compute Stick - CodeNotary](https://www.codenotary.com/blog/k3os-kubernetes-on-intel-compute-stick/)

**Edit** : Forgot to mention that the time issue caused the initial localhost:8080 issue from above. That’s why the new config just starts the time service again after it crashed in the original call by k3os itself.

---

<div class="post-metadata">

### Author: ![evo4np](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/evo4np/32/8043_2.png) [@evo4np](https://forums.suse.com/u/evo4np)
#### Post date: [September 24, 2021, 1:01pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/7 "2021-09-24T13:01:47Z")

</div>

This could help you if you haven’t managed to solve the problem.

1. First check if the k3s service is running

- systemctl status

1. If it is running then copy the k3s.yaml file

- sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config

This should work.

---

<div class="post-metadata">

### Author: ![mtrmm](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mtrmm](https://forums.suse.com/u/mtrmm)
#### Post date: [November 27, 2023, 6:16pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/8 "2023-11-27T18:16:22Z")

</div>

Hi 2 years later I am dealing with the same problem, again it is a raspbery pi and a k3s installation on the pi this time it is an arm64. All the solutions above did not help. It looks like that the kubectl does not even consider the config file and tries to contact the server at 8080, while it is running on 6443.

😣 Please help

---

<div class="post-metadata">

### Author: ![Lyndsey\_Paxton](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lyndsey_paxton/32/10780_2.png) [@Lyndsey\_Paxton](https://forums.suse.com/u/Lyndsey_Paxton)
#### Post date: [December 12, 2023, 1:13pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/9 "2023-12-12T13:13:08Z")

</div>

Okay, so as i understand it

1. The errors are Expected when run from a Node rather than the master. This is because the node does not have a config file by default.
2. To address this, copy the config file from the master /etc/rancher/k3s/k3s.yaml to a new folder on the agent ~/.kube/k3s.yaml

Running `k3s kubectl get node` on the agent then gave a similar error, but mentioned port 127.0.0.1:6443 rather than the prior 127.0.0.1:8080.

This led me to modify the newly copied file on the agent to point to the masters IP address  
server: [https://192.168.10.211:6443](https://192.168.10.211:6443)

Running `k3s kubectl get node` on the agent then gave the expected response  
NAME STATUS ROLES AGE VERSION  
rpi3 Ready 173m v1.28.4+k3s2  
rpi1 Ready control-plane,master 5d2h v1.27.7+k3s2  
rpi2 Ready 4d6h v1.28.4+k3s2  
rpi4 Ready 170m v1.28.4+k3s2

This solution FEEELS wrong, but APPEARS to be working. Happy for someone to educate me further.

---

<div class="post-metadata">

### Author: ![malcolmlewis1](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis1/32/10022_2.png) [@malcolmlewis1](https://forums.suse.com/u/malcolmlewis1)
#### Post date: [December 12, 2023, 1:27pm UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/10 "2023-12-12T13:27:19Z")

</div>

@Lyndsey_Paxton Hi no that is the correct/preferred/suggested way… I don’t do anything on the nodes themselves, just on a local machine (I’m on openSUSE Tumbleweed)…

```auto
mkdir -p ~/some_cluster
cd some_cluster
scp -- root@master-xxx:/etc/rancher/k3s/k3s.yaml $(pwd)
sed -i 's/127.0.0.1/xxx.xxx.xxx.xxx/g' k3s.yaml
export KUBECONFIG=$(pwd)/k3s.yaml

kubectl get nodes

```

---

<div class="post-metadata">

### Author: ![Nghia\_D\_ng](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/nghia_d_ng/32/11277_2.png) [@Nghia\_D\_ng](https://forums.suse.com/u/Nghia_D_ng)
#### Post date: [June 11, 2024, 7:50am UTC](https://forums.suse.com/t/localhost-8080-was-refused/18434/11 "2024-06-11T07:50:44Z")

</div>

Hi all, I am installing rke2 cluster with rancher

I have 3 servers as follows  
10.40.81.x - master  
10.40.81.y - node  
10.40.81.z - rancher  
OS ubuntu 22.04

And I’m practicing the installation, my server goes through a proxy to access the internet, and I’m following the instructions and the following error appears. I haven’t been able to fix it yet. Please help me!  
link: [Simple RKE2, Longhorn, and Rancher Install](https://ranchergovernment.com/blog/article-simple-rke2-longhorn-and-rancher-install)  
Link: [installing-rke2-on-ubuntu -](https://eli-bukin.com/projects/installing-rke2-on-ubuntu/)

`The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?`

```auto
kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

```
