How to connect a pods from external network

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.11
Cloud being used: (put bare-metal if not on a public cloud)
Installation method:
Host OS: CentOS Linux release 7.6.1810 (Core)
CNI and version: 0.2.0
CRI and version:

Hi Guy,

I am very new in kubernetes, I have a question that how to access the LDAP server which running in pods from external network?
The LDAP server have 6636 and 6389, I have a application server from external need to access this port, I try to create route in OKD / Applications / Routes, but the Routes seems only support “https” traffic.

Does it have any easy way to let the application server from external able to access the LDAP server in pods?

Regards
Thanks…KEN

Hi,

You can for example create a Service of type NodePort exposing your Pod, so LDAP will be available on ports > 30000 of the nodes of your cluster.
https://kubernetes.io/docs/concepts/services-networking/service/

Hi feloy,
Thanks for suggestion.
I try to create the NodePort service, it seems ok to map the ldaps port 6636 to compute node server eth0:30636, the yaml file as below.

[root@mgnt11 ~]# kubectl create -f test1.yaml
service/ldap-nodeport created
[root@mgnt11 ~]# cat test1.yaml
apiVersion: v1
kind: Service
metadata:
name: ldap-nodeport
labels:
app: ldap
name: ldap

spec:
externalTrafficPolicy: Cluster
type: NodePort
ports:

  • port: 6636
    nodePort: 30636
    port: 6636
    protocol: TCP
    name: ldaps-np
    targetPort: 6636

selector:
app: ldap

But it have 3 compute node host servers, all 3 compute node servers have listening port 30636, but it random access ok on around this 3 host servers, that is telent host1:30636 ok, but next time re-test, it fail, and it auto go to random host server, is it related session persistent thing in kubernetes?

Regards
Thanks…KEN

Hi feloy,

I just found one of ldap contain ldap port 6636 have problem, I restart the container, then above problem fixed.

Regards
Thanks…KEN

1 Like