Search code examples
dockerkubernetescontainerskubernetes-podeventstoredb

Eventstore doesn't work in Kubernetes (but works in Docker)


I want to run Eventstore in Kubernetes node. I start the node with minikube start, then I apply this yaml file:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: eventstore-deployment
spec:
  selector:
    matchLabels:
      app: eventstore
  replicas: 1
  template:
    metadata:
      labels:
        app: eventstore
    spec:
      containers:
      - name: eventstore
        image: eventstore/eventstore
        ports:
        - containerPort: 1113
          protocol: TCP
        - containerPort: 2113
          protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: eventstore
spec:
  selector:
    app: eventstore
  ports:
  - protocol: TCP
    port: 1113
    targetPort: 1113
---
apiVersion: v1
kind: Service
metadata:
  name: eventstore-dashboard
spec:
  selector:
    app: eventstore
  ports:
  - protocol: TCP
    port: 2113
    targetPort: 2113
    nodePort: 30113
  type: NodePort

the deployment, the replica set and the pod starts, but nothing happens: Eventstore doesn't print to the log, I can't open its dashboard. Also other services can't connect to eventstore:1113. No errors and the pods doesn't crash. The only I see in logs is "The selected container has not logged any messages yet".

enter image description here enter image description here

I've tried a clean vanilla minukube node with different vm drivers, and also a node with configured Ambassador + Linkerd. The results are the same.

But when I run Eventstore in Docker with this yaml file via docker-compose

eventstore:
    image: eventstore/eventstore
    ports:
      - '1113:1113'
      - '2113:2113'

Everything works fine: Eventstore outputs to logs, other services can connect to it and I can open its dashboard on 2113 port.

UPDATE: Eventstore started working after about 30-40 minutes after deployment. I've tried several times, and had to wait. Other pods start working almost immediately (30 secs - 1 min) after deployment.


Solution

  • As @ligowsky confirmed in comment section, issue was cause due to VM Performance. Posting this as Community Wiki for better visibility.

    Minikube as default is running with 2 CPUs and 2048 Memory. More details can be found here.

    You can change this if your VM has more resources.

    - During Minikube start

    $ sudo minikube start --cpus 2 --memory 8192 --vm-driver=<driverType>
    

    - When Minikube is running, however minikube need to be restarted

    $ minikube config set memory 4096
    ⚠️  These changes will take effect upon a minikube delete and then a minikube start
    

    More commands can be found in Minikube docs.

    In my case when Minikube resources was 4CPUs and 8192 memory I didn't have any issues with eventstore.

    OP's Solution

    OP used Kind to run eventstore deployment.

    Kind is a tool for running local Kubernetes clusters using Docker container "nodes". kind is primarily designed for testing Kubernetes 1.11+

    Kind documentation can be found here.