# port setup problems using openshift/k8s

**URL:** <https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644>\
**Category:** Uncategorized\
**Tags:** solved, docker, server\
**Created:** [March 10, 2020, 12:05pm UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644 "2020-03-10T12:05:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![roland](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@roland](https://support.prodi.gy/u/roland)\
**Post date:** [March 10, 2020, 12:05pm UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644/1 "2020-03-10T12:05:49Z")

</div>

Hi all,

having the most strange of problems when setting up prodigy inside a docker container inside of openshift/k8s.

The demo setup is most simply:

```python
{
  "host": "0.0.0.0",
  "port": 8080,
  "db_settings": {"sqlite": {"name": ":memory:"}}
}

```

with the container exposing 8080.

And it all results in this error:

 ![20200310_kubernetes_prodigy_problem](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/2/2c2c9ae33189f019a4757fc824dc5127b0a871ee.png)

So, my question is: How does prodigy set the port and may I override this?

It's a weird interaction and confusing me.

Best,

Roland

---

<div class="post-metadata">

**Author:** ![roland](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@roland](https://support.prodi.gy/u/roland)\
**Post date:** [March 10, 2020, 2:27pm UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644/2 "2020-03-10T14:27:55Z")

</div>

I think the problem is related to this one here: [Deploy prodigy with Kubernetes and SQLite](https://support.prodi.gy/t/deploy-prodigy-with-kubernetes-and-sqlite/1265)

I'm trying to remove the host/port config no completely as implied by @honnibal's comment.

---

<div class="post-metadata">

**Author:** ![roland](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@roland](https://support.prodi.gy/u/roland)\
**Post date:** [March 10, 2020, 2:34pm UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644/3 "2020-03-10T14:34:11Z")

</div>

Nope, wasn't the solution. It now inserts 'localhost' ahead of the `tcp` string:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/3/362a47a00137bdc2176f3076f0cee05298659fc7.png)

---

<div class="post-metadata">

**Author:** ![roland](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@roland](https://support.prodi.gy/u/roland)\
**Post date:** [March 10, 2020, 2:34pm UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644/4 "2020-03-10T14:34:52Z")

</div>

@ines, @honnibal - you have any idea what's going on here?

---

<div class="post-metadata">

**Author:** ![roland](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@roland](https://support.prodi.gy/u/roland)\
**Post date:** [March 10, 2020, 3:05pm UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644/5 "2020-03-10T15:05:52Z")

</div>

One step forward towards a solution:

```python
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftWebConsole
  creationTimestamp: '2020-03-10T11:51:31Z'
  generation: 12
  labels:
    app: prodigy-container
  name: prodigy-container
  namespace: themachine
  resourceVersion: '54275345'
  selfLink: >-
    /apis/apps.openshift.io/v1/namespaces/themachine/deploymentconfigs/prodigy-container
  uid: 7be9e271-62c5-11ea-9822-fa163efb6a9e
spec:
  replicas: 1
  selector:
    app: prodigy-container
    deploymentconfig: prodigy-container
  strategy:
    activeDeadlineSeconds: 21600
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      annotations:
        openshift.io/generated-by: OpenShiftWebConsole
      creationTimestamp: null
      labels:
        app: prodigy-container
        deploymentconfig: prodigy-container
    spec:
      containers:
        - env:
            - name: PRODIGY_PORT
              value: '8080'
          imagePullPolicy: Always
          name: prodigy-container
          ports:
            - containerPort: 8080
              name: prodigyport
              protocol: TCP

```

added the `PRODIGY_PORT` as env-var to the Deploymentconfig.

---

<div class="post-metadata">

**Author:** ![roland](https://avatars.discourse-cdn.com/v4/letter/r/3ab097/32.png) [@roland](https://support.prodi.gy/u/roland)\
**Post date:** [March 10, 2020, 3:11pm UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644/6 "2020-03-10T15:11:09Z")

</div>

Together with the initial `prodigy.json` the above code is the solution. It feels like a workaround, as I still don't understand how k8s/openshift is passing the port, but it works. 🙂

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [March 11, 2020, 8:58am UTC](https://support.prodi.gy/t/port-setup-problems-using-openshift-k8s/2644/7 "2020-03-11T08:58:39Z")

</div>

Glad you got it working!

Just caught up on the thread. Also not sure I fully understand what happens here exactly on the container side of things – Prodigy will read the port from the `prodigy.json` or the `PRODIGY_PORT` env var. There should be very little magic otherwise 🤔
