# Drone server changing ports/protocol

**URL:** <https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400>\
**Category:** Drone Support\
**Created:** [March 28, 2019, 7:44pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400 "2019-03-28T19:44:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisghill](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@chrisghill](https://drone.discourse.group/u/chrisghill)\
**Post date:** [March 28, 2019, 7:44pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/1 "2019-03-28T19:44:43Z")

</div>

I’m trying to get Drone working in Kubernetes. I had the service and statefulset working yesterday, but it appears I might have made changes to configs that is causing the server port to change, making it inaccessible.

 ![logs](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/3/37dca901b3bc2068d71f50e0fcd08b230be7ada1.png)

I’ve attached my kibana logs. You can see that yesterday it was starting the server on port 80. Then today its starting it on 443 with the IP address included. But in reality the server is completely inaccessible.

I’ve tried port-forwarding to ports 80, 443 and 8000 of the pod, and when I curl it the connection is always refused:

```auto
$ kc port-forward pod/drone-server-0 8000:80 -n drone
Forwarding from 127.0.0.1:8000 -> 80
Forwarding from [::1]:8000 -> 80
Handling connection for 8000
E0328 13:04:53.046536 5562 portforward.go:331] an error occurred forwarding 8000 -> 80: error forwarding port 80 to pod d3e349ef5ae522344e350de9508ae93df598f8ae18c20c22611eb3a9e6eb8c37, uid : exit status 1: 2019/03/28 19:04:53 socat[29230] E connect(5, AF=2 127.0.0.1:80, 16): Connection refused

```

The same thing happens for ports 443 and 8000 on the pod. I’ve also tried `kubectl exec`ing into the pod and trying to curl from there. Same thing…connection is always refused.

```auto
$ kc exec -it drone-server-0 -n drone -- /bin/sh
... (install curl)
/ # curl localhost:80
curl: (7) Failed to connect to localhost port 80: Connection refused
/ # curl localhost:443
curl: (7) Failed to connect to localhost port 443: Connection refused
/ # curl localhost:8000
curl: (7) Failed to connect to localhost port 8000: Connection refused
/ # curl tcp://localhost:80

```

What could be causing drone to change the server? You can also see I changed the ENV variable `DRONE_SERVER_PROTO` from http to https and that doesn’t seem to make any difference either.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 28, 2019, 7:46pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/2 "2019-03-28T19:46:34Z")

</div>

did you deploy Drone on Kubernetes with a service called `drone-server`? This causes kubernetes to automatically set `DRONE_SERVER_*` variables including `DRONE_SERVER_PROTO` which causes problems because these are actual variables used by Drone. You should disable these default Kubernetes variables, or rename the service.

---

<div class="post-metadata">

**Author:** ![chrisghill](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@chrisghill](https://drone.discourse.group/u/chrisghill)\
**Post date:** [March 28, 2019, 7:48pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/3 "2019-03-28T19:48:00Z")

</div>

Yes I did! I’m trying to get secrets to work so I renamed the statefulset and service from just `drone` to `drone-server` to be more explicit (drone secrets deployment named `drone-secrets`. It sounds like I should undo that and just leave it as `drone`? Let me give that a shot.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 28, 2019, 7:49pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/4 "2019-03-28T19:49:49Z")

</div>

I think you can also try and override the variable. This will reset the value to what Drone is expecting and should override the Kubernetes service variables

```auto
env:
- name: DRONE_SERVER_PORT
  value: ":80"

```

---

<div class="post-metadata">

**Author:** ![chrisghill](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@chrisghill](https://drone.discourse.group/u/chrisghill)\
**Post date:** [March 28, 2019, 7:56pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/5 "2019-03-28T19:56:16Z")

</div>

Just tried changing `DRONE_SERVER_PROTO` to `:80` and that doesn’t seem to fix it. Specifically the URL portion of the log message looks broken:

```auto
{"acme":false,"host":"drone.organization.io","level":"info","msg":"starting the http server","port":"tcp://100.67.65.37:443","proto":":80","time":"2019-03-28T19:53:01Z","url":":80://drone.organization.io"}

```

I’m going to try renaming things back to just “drone”. Stand by…

Okay, changed all the names back to `drone` instead of `drone-server` and everything is working again.

```auto
{"acme":false,"host":"drone.organization.io","level":"info","msg":"starting the http server","port":":80","proto":"https","time":"2019-03-28T20:01:42Z","url":"https://drone.organization.io"}

```

Thanks for your help - this was a subtle bug.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 28, 2019, 8:04pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/6 "2019-03-28T20:04:52Z")

</div>

also my previous message had a typo / error … I meant to suggest setting `DRONE_SERVER_PORT=:80`, not `DRONE_SERVER_PROTO`

---

<div class="post-metadata">

**Author:** ![Rick-Jongbloed](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/rick-jongbloed/32/5168_2.png) [@Rick-Jongbloed](https://drone.discourse.group/u/Rick-Jongbloed)\
**Post date:** [July 24, 2019, 7:30pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/7 "2019-07-24T19:30:22Z")

</div>

This threat is very old, but i think there should be a note in the kubernetes part of the documentation, that the service name shouldn’t be drone-server 🙂

---

<div class="post-metadata">

**Author:** ![Rick-Jongbloed](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/rick-jongbloed/32/5168_2.png) [@Rick-Jongbloed](https://drone.discourse.group/u/Rick-Jongbloed)\
**Post date:** [January 18, 2020, 11:04pm UTC](https://drone.discourse.group/t/drone-server-changing-ports-protocol/11400/8 "2020-01-18T23:04:08Z")

</div>

> [@On another topic](https://drone.discourse.group/t/4144/7):
>
> drone

I ran into this again 🙂 Is this bug already logged?
