Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use DaemonSet instead of StatefulSet when deploying in Kubernetes #252

Open
frenchyjef opened this issue Feb 10, 2021 · 0 comments
Open

Comments

@frenchyjef
Copy link

frenchyjef commented Feb 10, 2021

HI,

Has anyone been able to host an Akka actor inside a DaemonSet? What was your YAML configuration? Any example would be much appreciated!

We were successful at deploying multiple Akka services in their own StatefulSet pods but we have not been able to find the correct configuration to switch one of our service to a DaemonSet instead.

The pod that is now deployed in a DaemonSet is no longer reachable by the LightHouse pods. See error below

[WARNING][02/09/2021 22:04:17][Thread 0014][akka.tcp://[email protected]:9600/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fedgraphjobs%jobprocessor-svc-v1-s9899.jobprocessor-svc%3A9600-9690/endpointWriter] AssociationError [akka.tcp://[email protected]:9600] -> akka.tcp://[email protected]:9600: Error [Association failed with akka.tcp://[email protected]:9600] []
[WARNING][02/09/2021 22:04:17][Thread 0014][remoting (akka://edgraphjobs)] Tried to associate with unreachable remote address [akka.tcp://[email protected]:9600]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: [Association failed with akka.tcp://[email protected]:9600] Caused by: [System.AggregateException: One or more errors occurred. (Name or service not known)
 ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
   at System.Net.Dns.InternalGetHostByName(String hostName)
   at System.Net.Dns.ResolveCallback(Object context)

Here is the YAML configuration for the JobProcessor service (which was previously working as a StatefulSet)

apiVersion: v1
kind: Service
metadata:
  name: jobprocessor-svc
  namespace: edgraph
  labels:
    app: jobprocessor-svc
    service: jobprocessor-svc
spec:
  clusterIP: None
  ports:
  - port: 9600
    name: akka-tcp
  selector:
    app: jobprocessor-svc
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: edgraph-jobprocessor-svc
  namespace: edgraph
  labels:
    account: jobprocessor-svc
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: jobprocessor-svc-v1
  namespace: edgraph
  labels:
    app: jobprocessor-svc
    version: v1
spec:
  selector:
    matchLabels:
      app: jobprocessor-svc
      version: v1
  template:
    metadata:
      labels:
        app: jobprocessor-svc
        version: v1
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: agentpool
                operator: In
                values:
                - jobsnodepool
      serviceAccountName: edgraph-jobprocessor-svc
      terminationGracePeriodSeconds: 35
      containers:
      - name: jobprocessor-svc
        image: jobprocessor-svc:1.0.0
        imagePullPolicy: IfNotPresent
        lifecycle:
          preStop:
            exec:
              command: ["/bin/sh", "-c", "pbm 127.0.0.1:9110 cluster leave"]
        ports:
        - containerPort: 9600
          protocol: TCP
        env:
          - name: Environment__Name
            value: "Development"
          - name: ASPNETCORE_ENVIRONMENT
            value: "Development"
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: CLUSTER_IP
            value: "$(POD_NAME).datasync-jobprocessor-svc"
          - name: CLUSTER_PORT
            value: "9600"
          - name: CLUSTER_SEEDS
            value: "akka.tcp://[email protected]:9100,akka.tcp://[email protected]:9100,akka.tcp://[email protected]:9100"
        livenessProbe:
          tcpSocket:
            port: 9600
      nodeSelector:
        kubernetes.io/os: linux
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant