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.

Can not access to container port via service on OCP

See original GitHub issue

Description

Can not access to container port via service on local OCP.

This feature is needed for running language servers in parallel containers.

Reproduction Steps

  1. Run OCP with the following script https://github.com/eclipse/che/blob/master/deploy/openshift/ocp.sh
  2. Create the following objects via OCP console:
  • Create a project;
  • Click Add to Project
  • Click Import YAML/JSON
  • Paste the following YAML and click Create
Objects to import
---
kind: List
items:
-
  apiVersion: v1
  kind: Pod
  metadata:
    name: tomcat-pod
    labels:
      app: tomcat
  spec:
    containers:
      -
        image: sleshchenko/webapp
        name: tomcat-container
        ports:
          -
            containerPort: 8080
            protocol: TCP
      -
        image: eclipse/ubuntu_jdk8
        name: requester
-
  apiVersion: v1
  kind: Service
  metadata:
    name: tomcat
  spec:
    ports:
      - name: tomcat
        port: 8080
        protocol: TCP
        targetPort: 8080
    selector:
      app: tomcat
  1. Open terminal in the newly created pod in requester container.
  2. Try to access tomcat via service. Execute curl tomcat:8080 Expected: Response HELLO Actual: Request hung up.

Note that it works fine on https://console.codenvy.openshift.com/ or http://console.starter-us-east-2.openshift.com/. Note that it works fine if containers are in separated pods.

Containers in separated pods
---
kind: List
items:
-
  apiVersion: v1
  kind: Pod
  metadata:
    name: tomcat-pod
    labels:
      app: tomcat
  spec:
    containers:
      -
        image: sleshchenko/webapp
        name: tomcat-container
        ports:
          -
            containerPort: 8080
            protocol: TCP
-
  apiVersion: v1
  kind: Pod
  metadata:
    name: requester
  spec:
    containers:
      -
        image: eclipse/ubuntu_jdk8
        name: requester
-
  apiVersion: v1
  kind: Service
  metadata:
    name: tomcat
  spec:
    ports:
      - name: tomcat
        port: 8080
        protocol: TCP
        targetPort: 8080
    selector:
      app: tomcat

OCP version:
3.7.0 and 3.9.0

Diagnostics:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Jul 25, 2018

Should we perhaps close the issue as it cannot be fixed on Che side. The issue has been opened for a while and the issue in Origin does not seem to get any attention either.

0reactions
garagatyicommented, Nov 1, 2018

Closing since we found a solution with userland proxy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using port forwarding to access applications in a container
OpenShift Container Platform supports port forwarding to pods. Understanding port forwarding. You can use the CLI to forward one or more local ports...
Read more >
Troubleshooting OpenShift Internal Networking
Service Port is Incorrect ... This port, port 443, reroutes to port 8443 on the target container. Make sure that your requests are...
Read more >
Troubleshooting Guide for OpenShift Container Platform
Open a terminal session to each master and examine /var/log/messages · If there are no clues there, edit /etc/sysconfig/atomic-openshift-master-api · change ...
Read more >
Accessing Red Hat OpenShift clusters - IBM Cloud Docs
Both service endpoint URLs: You can access your cluster either through the public or ... If you can't or don't want to open...
Read more >
Using a NodePort to Get Traffic into the Cluster - Fedora People
The first step in allowing access to a service is to define an external IP address range in the master configuration file: Log...
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