Hey there, I came here from <#C012RJ2MQ1H|>, I'm a...
# ory-selfhosting
c
Hey there, I came here from #C012RJ2MQ1H, I'm already using Ory Oathkeeper, Kratos and Keto componentes in a production environment, but I have this issue with Kratos were Deployment Works fine but StatefulSet does not It just keeps kratos container looping restart
p
Hi @clever-caravan-61378 Could you provide some logs or a description of when the container starts to loop restart? Does it crash at some point, or is it always crashing on startup?
c
Hey @proud-plumber-24205 @worried-kitchen-94392 this is the output
Copy code
{
  "insertId": "poqmt188k0taigtk",
  "jsonPayload": {
    "service_version": "v0.8.0-alpha.3",
    "msg": "Unable to ping database, retrying.",
    "audience": "application",
    "service_name": "Ory Kratos",
    "error": {
      "message": "failed to connect to `host=pg-sqlproxy-gcloud-sqlproxy user=ory database=kratos`: dial error (dial tcp 10.28.9.169:5432: connect: connection refused)",
      "trace": "\<http://ngithub.com/ory/kratos/persistence/sql.(*Persister).Ping\n\t/home/ory/persistence/sql/persister.go:133\ngithub.com/ory/kratos/driver.(*RegistryDefault).Init.func1\n\t/home/ory/driver/registry_default.go:544\ngithub.com/cenkalti/backoff.RetryNotify\n\t/go/pkg/mod/github.com/cenkalti/backoff@v2.2.1+incompatible/retry.go:37\ngithub.com/cenkalti/backoff.Retry\n\t/go/pkg/mod/github.com/cenkalti/backoff@v2.2.1+incompatible/retry.go:24\ngithub.com/ory/kratos/driver.(*RegistryDefault).Init\n\t/home/ory/driver/registry_default.go:504\ngithub.com/ory/kratos/driver.New\n\t/home/ory/driver/factory.go:15\ngithub.com/ory/kratos/cmd/courier.NewWatchCmd.func1\n\t/home/ory/cmd/courier/watch.go:22\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902\ngithub.com/ory/kratos/cmd.Execute\n\t/home/ory/cmd/root.go:48\nmain.main\n\t/home/ory/main.go:35\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581|ngithub.com/ory/kratos/persistence/sql.(*Persister).Ping\n\t/home/ory/persistence/sql/persister.go:133\ngithub.com/ory/kratos/driver.(*RegistryDefault).Init.func1\n\t/home/ory/driver/registry_default.go:544\ngithub.com/cenkalti/backoff.RetryNotify\n\t/go/pkg/mod/github.com/cenkalti/backoff@v2.2.1+incompatible/retry.go:37\ngithub.com/cenkalti/backoff.Retry\n\t/go/pkg/mod/github.com/cenkalti/backoff@v2.2.1+incompatible/retry.go:24\ngithub.com/ory/kratos/driver.(*RegistryDefault).Init\n\t/home/ory/driver/registry_default.go:504\ngithub.com/ory/kratos/driver.New\n\t/home/ory/driver/factory.go:15\ngithub.com/ory/kratos/cmd/courier.NewWatchCmd.func1\n\t/home/ory/cmd/courier/watch.go:22\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902\ngithub.com/ory/kratos/cmd.Execute\n\t/home/ory/cmd/root.go:48\nmain.main\n\t/home/ory/main.go:35\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581>"
    },
    "level": "warning",
    "func": "<http://github.com/ory/kratos/driver.(*RegistryDefault).Init.func1|github.com/ory/kratos/driver.(*RegistryDefault).Init.func1>",
    "file": "/home/ory/driver/registry_default.go:545"
  },
  "resource": {
    "type": "k8s_container",
    "labels": {
      "project_id": "",
      "container_name": "gateway-identity-kratos-courier",
      "cluster_name": "",
      "location": "us-central1-a",
      "namespace_name": "rem-gateway",
      "pod_name": "gateway-identity-kratos-courier-0"
    }
  },
  "timestamp": "2021-12-24T20:39:59Z",
  "severity": "WARNING",
  "labels": {
    "k8s-pod/controller-revision-hash": "gateway-identity-kratos-courier-6fdf967869",
    "k8s-pod/statefulset_kubernetes_io/pod-name": "gateway-identity-kratos-courier-0",
    "k8s-pod/app_kubernetes_io/instance": "gateway-identity",
    "k8s-pod/app_kubernetes_io/name": "gateway-identity-kratos-courier",
    "<http://compute.googleapis.com/resource_name|compute.googleapis.com/resource_name>": ""
  },
  "logName": "projects//logs/stderr",
  "receiveTimestamp": "2021-12-24T20:40:03.051346300Z"
}
But its weird, because the deployment works fine, only the statefulset cannot connect to the database
w
Hi there, this could happen if kratos and courier would use different secrets but connect to the same db. Can you check if they use the same secrets?