Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.
This repository was archived by the owner on Dec 31, 2025. It is now read-only.

Unable to publish events to the service #41

Description

@BuddhiWathsala

I installed the nats-streaming-operator to my minikube cluster. It installed without any issue. Since nats service created by nats-operator is a ClusterIP one I unable to send data into that service externally. So I tried two approaches to send data.

Approach 1

Create a service like below of type LoadBalancer and try to send data.

apiVersion: v1
kind: Service
metadata:
  name: nats-streaming
  namespace: default
  labels:
    app: nats-streaming
    stan_cluster: siddhi-stan
spec:
  externalTrafficPolicy: Cluster
  ports:
  - name: natsservice
    port: 4222
    protocol: TCP
    targetPort: 4222
  - name: natsservice-proxy
    port: 8222
    protocol: TCP
    targetPort: 8222
  selector:
    app: nats-streaming
    stan_cluster: siddhi-stan
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}

Approach 2

Create a different kubernetes deployment of https://github.com/nats-io/go-nats-streaming/tree/master/examples and use that deployment to send data.

I used the following command to send requests.

go run $GOPATH/src/github.com/nats-io/go-nats-streaming/examples/stan-pub/main.go --server nats://nats-streaming.default.svc.cluster.local:4222 <SUBJECT> "{\"name\":\"data\"}"

But from both approaches, I got an error as

Can't connect: stan: connect request timeout.
Make sure a NATS Streaming Server is running at: nats://nats-streaming:4222
exit status 1

So I want to know that how can I external send data to nats-streaming-server in the kubernetes cluster?

Specifications

  • minikube version: v0.33.1
  • kubernetes version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-10T23:28:14Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions