i can’t see the docker image in openshift services

A Service is separate from a Pod. So you will need to create the Service separately. Typically, with OpenShift, people use the oc new-app command line tool (see the documentation). This will automatically create the Service for you.

If you want to create a new Service, you can either do that by using the oc create service command line so:

oc create service clusterip backend

Or you can create it by specifying the Service in a YAML and apply it using oc apply -f <filename>:

apiVersion: v1
kind: Service
metadata:
  name: backend-service
spec:
  selector:
    app: backend
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80

Note that you may need to change the selector, port or targetPort above. As the next step, often you want to expose the Service to the outside world, this is then typically done with a Route in Openshift (oc expose service <service-name> will create the Route for you).

What I have to add to the container to make it visible in openshift services?

As outlined above, a Service is different from a Pod and thus the container definition has nothing to do with the Service. I would recommend that you re-create your Pod using oc new-app, that will automatically create the Service for you.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top