question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It does not work with NodePort configuration (localhost:3000 is hardcoded)

See original GitHub issue

Because of network and firewall and other reasons, I can’t just do kubectl port-forward deployment/spekt8 3000:3000

Instead I had to install it using NodePort.

Now spekt8 shows me a blank screen for it tries to access localhost:3000 instead of THE_IP_ADDRESS:THE_PORT (i.e. this localhost:3000 is harcoded)

below are the YAML settings I used to install it:



---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: spekt8
spec:
  selector:
    matchLabels:
      k8s-app: spekt8
  replicas: 1
  template:
    metadata:
      labels:
        k8s-app: spekt8
    spec:
      containers:
        - name: spekt8
          image: elliotxkim/spekt8
          ports:
            - containerPort: 3000

---
kind: Service
apiVersion: v1
metadata:
  name: spekt8
  labels:
    k8s-app: spekt8
spec:
  ports:
  - protocol: TCP
    port: 3000
  type: NodePort
  selector:
    k8s-app: spekt8

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

1reaction
cvernooy23commented, Feb 27, 2020

You can use ssh tunneling as a workaround.

My example k8s environment is 3 nodes built with vagrant. I create ssh tunnel using command:

ssh -i ~/vagrant/k8s/.vagrant/machines/node1-master/virtualbox/private_key -L 127.0.0.1:3000:192.168.33.11:30002 vagrant@192.168.33.11

Then spekt8 page can be accessed from local host with http://localhost:3000

this worked for me but just shouldn’t be necessary. Please allow remote access instead of hardcoding localhost:3000

1reaction
mari6274commented, Jun 16, 2019

You can use ssh tunneling as a workaround.

My example k8s environment is 3 nodes built with vagrant. I create ssh tunnel using command:

ssh -i ~/vagrant/k8s/.vagrant/machines/node1-master/virtualbox/private_key -L 127.0.0.1:3000:192.168.33.11:30002 vagrant@192.168.33.11

Then spekt8 page can be accessed from local host with http://localhost:3000

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js Port 3000 already in use but it actually isn't?
I have been working with a node. js project for a few weeks and it has been working great. Usually, I use npm...
Read more >
Using a NodePort - Getting Traffic into a Cluster
A node port exposes the service on a static port on the node IP address. NodePorts are in the 30000-32767 range by default,...
Read more >
Kubernetes Series - 8: Deploy a Full Stack Application in ...
Please observe, I have hardcoded the name of the backend service ( flask-service). Basically, it will proxy any request from “localhost:3000” to ...
Read more >
Developer Guide OpenShift Container Platform 3.11
These topics help developers set up and configure a workstation to develop and deploy applications in an OpenShift Container Platform cloud environment with ......
Read more >
A Primer: Accessing services in Kubernetes - Alex Ellis' Blog
You can actually change security settings so that you can bind NodePorts to port 80 and 443. Do not do this. You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found