Jxadro
Jxadro

Reputation: 1637

Expose TCP Ports outside the cluster

How can be a service that does not use HTTP/s be exposed in Openshift 3.11 or 4.x?

I think routes only support HTTP/s traffic.

I have read about using ExternalIP configuration for services but that makes the operation of the cluster complicated and static compared to routes/ingress.

For example Nginx-ingress-controller allows it with special configurations: https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/

What are the options in Openshift 3.11 or 4.x?

Thank you.

Upvotes: 2

Views: 5199

Answers (2)

Nick
Nick

Reputation: 2034

There is a section in the official OpenShift documentation for this called Getting Traffic Into the Cluster.

The recommendation, in order or preference, is:
 - If you have HTTP/HTTPS, use a router.
 - If you have a TLS-encrypted protocol other than HTTPS (for example, TLS with the SNI header), use a router.
 - Otherwise, use a Load Balancer, an External IP, or a NodePort.

Upvotes: 2

Daein Park
Daein Park

Reputation: 4683

NodePort exposes the Service on each Node’s IP at a static port (30000~32767)[0]. You’ll be able to contact the NodePort Service, from outside the cluster, by requesting : format.

apiVersion: v1
kind: Service
metadata:
  name: nodeport
spec:
  type: NodePort
  ports:
    - name: "8080"
      protocol: "TCP"
      port: 8080
      targetPort: 80
      nodePort: 30000
  selector:
    labelName: targetname

Upvotes: 2

Related Questions