Running Dapr with a Kubernetes Job

    Kubernetes Job

    The Dapr sidecar is designed to be a long running process, in the context of a Kubernetes Job this behaviour can block your job completion. To address this issue the Dapr sidecar has an endpoint to the sidecar.

    When a job is finished without calling Shutdown, your job will be in a NotReady state with only the daprd container running endlessly.

    Be sure to use the POST HTTP verb when calling the shutdown HTTP API.

    1. import (
    2. "context"
    3. "log"
    4. dapr "github.com/dapr/go-sdk/client"
    5. )
    6. func main() {
    7. client, err := dapr.NewClient()
    8. log.Panic(err)
    9. }
    10. defer client.Close()
    11. defer client.Shutdown()
    12. // Job