Hi, I have 2 container in one pod
- one container opens port 5222 (it's the Nats.io nats-streaming server)
- the other container is a busybox. From busybox I can telnet to that port 
5222, so it is definitely opened...

Additionally I’ve created a Service nats1 exposing 5222. But from another 
pod, connecting to that Service, I get a "connection refused” (doing 
something like "telnet nats1 5222").
Other ports, opened by nats-streaming server, f.e. 4222, are working fine.

So what can happen, that a port is opened, but cannot be exposed by a 
Service? (While other ports work fine...)

Regards Christopher




Some informations:

I did a workaround with a HAProxy, running in the nats pod, mapping port 
5333 to internal 5222. That works, but I hope thats not the best solution...

Used k8s 1.4.6, Nats,io nats-streaming server (coded in Go)

service endpoints are there:
$ kubectl get endpoints nats1
NAME      ENDPOINTS                                         AGE
nats1     10.244.8.3:5222,10.244.8.3:4222,10.244.8.3:8222   26m


the YAML:

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nats1-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: nats1-app
    spec:
      containers:
        - name: nats-streaming
          image: nats-streaming
          args:
          - --cluster 
          - nats://localhost:5222
          - --routes
          - nats://nats2:5222
          - -DV
          ports:
          - name:  clusterport
            containerPort:  5222
            protocol: TCP
        - name: busybox
          image: busybox
          command:
          - sleep
          - "3600"
---
kind: Service
apiVersion: v1
metadata:
  name: nats1
spec:
  ports:
  - name: client
    port: 4222
  - name: cluster
    port: 5222
    targetPort: clusterport
  selector:
    name: nats1-app

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to