Skip to content

[Bug]: Error: controller with name instance-cluster already exists #5994

@wolviecb

Description

@wolviecb

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

  • I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

  • I have read the troubleshooting guide and I think this is a new bug.

Contact Details

wolvie@gmail.com

Version

1.24.0

What version of Kubernetes are you using?

1.31

What is your Kubernetes environment?

Self-managed: k3s

How did you install the operator?

Helm

What happened?

During cluster maintenance, one of my nodes got resource starvation and started to evict pods, my db cluster was affected by the eviction, but the new pods couldn't start with an error

Error: controller with name instance-cluster already exists. Controller names must be unique to avoid multiple controllers reporting to the same metric

You can find the full error log here

Cluster resource

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: gitea-db
  namespace: gitea
spec:
  instances: 1
  bootstrap:
    initdb:
      database: gitea
      encoding: UTF8
      localeCType: en_US.UTF-8
      localeCollate: en_US.UTF-8
  storage:
    size: 20Gi
    storageClass: longhorn
  walStorage:
    size: 2Gi
    storageClass: longhorn
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
              - key: node-role.kubernetes.io/worker
                operator: In
                values:
                  - worker
  monitoring:
    enablePodMonitor: false

Relevant log output

{
  "level": "error",
  "ts": "2024-10-31T08:09:51.842501799Z",
  "msg": "unable to create controller",
  "logger": "instance-manager",
  "logging_pod": "gitea-db-1",
  "error": "controller with name instance-cluster already exists. Controller names must be unique to avoid multiple controllers reporting to the same metric",
  "stacktrace": "github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\tpkg/mod/github.com/cloudnative-pg/machinery@v0.0.0-20241014090714-c27747f9974b/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/instance/run.runSubCommand\n\tinternal/cmd/manager/instance/run/cmd.go:201\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/instance/run.NewCmd.func2.1\n\tinternal/cmd/manager/instance/run/cmd.go:104\nk8s.io/client-go/util/retry.OnError.func1\n\tpkg/mod/k8s.io/client-go@v0.31.1/util/retry/util.go:51\nk8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtection\n\tpkg/mod/k8s.io/apimachinery@v0.31.1/pkg/util/wait/wait.go:145\nk8s.io/apimachinery/pkg/util/wait.ExponentialBackoff\n\tpkg/mod/k8s.io/apimachinery@v0.31.1/pkg/util/wait/backoff.go:461\nk8s.io/client-go/util/retry.OnError\n\tpkg/mod/k8s.io/client-go@v0.31.1/util/retry/util.go:50\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cmd/manager/instance/run.NewCmd.func2\n\tinternal/cmd/manager/instance/run/cmd.go:103\ngithub.com/spf13/cobra.(*Command).execute\n\tpkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tpkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tpkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041\nmain.main\n\tcmd/manager/main.go:68\nruntime.main\n\t/opt/hostedtoolcache/go/1.23.2/x64/src/runtime/proc.go:272"
}

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Stalebackport-requested ◀️This pull request should be backported to all supported releases

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions