apache / pekko-samples

Apache Pekko Sample Projects
https://pekko.apache.org/
Apache License 2.0
42 stars 21 forks source link

Include http settings in application.conf for Kubernetes health checks in pekko-sample-cluster-kubernetes-scala #103

Closed hanishi closed 6 months ago

hanishi commented 6 months ago

Description

The current application.conf configuration in the pekko-sample-cluster-kubernetes-scala project lacks the essential http settings under pekko.management. This omission prevents the application from binding to the required port (8558), which is necessary for Kubernetes health checks. Without this configuration, Kubernetes cannot perform health checks, leading to immediate termination of the pods as they are marked unhealthy.

Required Changes

To resolve this critical issue and stabilize pod deployment, the following http settings need to be explicitly defined in the application.conf file:

#management-config
pekko.management {
  cluster.bootstrap {
    contact-point-discovery {
      # pick the discovery method you'd like to use:
      discovery-method = kubernetes-api

      required-contact-point-nr = ${REQUIRED_CONTACT_POINT_NR}
    }
  }
 # Add these so the pods won't get killed.
  http {
    port = 8558
    bind-hostname = "0.0.0.0"
  }
}

By including these settings, Kubernetes can access the management HTTP server on port 8558 for health checks, ensuring the pods are correctly recognized as healthy and operational.

Roiocam commented 6 months ago

did you notice that pekko has a different port by default? It may help you.

https://github.com/apache/pekko-management/blob/1b7a52ba277daec3130baee4bf29a2f0f55a51bb/management/src/main/resources/reference.conf#L19

hanishi commented 6 months ago

The port setting must match the Kubernetes configuration settings depicted here: link for this example to work as expected. If that's what it defaults to, then the yml file must be fixed. Thanks for pointing it out, though

pjfanning commented 6 months ago

@hanishi https://github.com/apache/pekko-samples/pull/106 is merged. If you could retest with this change that would be much appreciated. Please reopen this issue if there are problems.