Skip to content

[BUG] 安装kruise时kruise-controller-manager会重启 #2380

@gjj45

Description

@gjj45

What happened:
安装kruise-controller-manager时,容器启动失败,容器重启几次后正常启动。
启动失败的日志如下:

I0227 17:53:22.807918       1 feature_gate.go:387] feature gates: {map[DeletionProtectionForCRDCascadingGate:false]}
I0227 17:53:22.808377       1 main.go:173] "msg"="new clientset registry" "logger"="setup"
I0227 17:53:22.821492       1 main.go:229] "msg"="register field index" "logger"="setup"
I0227 17:53:22.827711       1 request.go:1632] body was not decodable (unable to check for Status): couldn't get version/kind; json parse error: json: cannot unmarshal string into Go value of type struct { APIVersion string "json:\"apiVersion,omitempty\""; Kind string "json:\"kind,omitempty\"" }
E0227 17:53:22.828241       1 main.go:231] "msg"="failed to register field index" "error"="no matches for kind \"ImagePullJob\" in version \"apps.kruise.io/v1alpha1\"" "logger"="setup"

启动安装时注册imagepulljob v1alpha1版本,找不到该资源导致启动失败。
再看imagepulljobs.apps.kruise.io这个crd

status:
  acceptedNames:
    kind: ImagePullJob
    listKind: ImagePullJobList
    plural: imagepulljobs
    singular: imagepulljob
  conditions:
  - lastTransitionTime: "2026-02-27T09:53:21Z"
    message: no conflicts found
    reason: NoConflicts
    status: "True"
    type: NamesAccepted
  - lastTransitionTime: "2026-02-27T09:53:26Z"
    message: the initial names have been accepted
    reason: InitialNamesAccepted
    status: "True"
    type: Established
  storedVersions:
  - v1beta1

可以看到kruise-controller-manager去注册的时间是53分22秒,imagepulljobs.apps.kruise.io这个crd就绪时间为53分26秒,所以在crd就绪前kruise-controller-manager去注册导致容器启动失败。

该问题非必现,如果crd就绪早于kruise-controller-manager去注册,则不会失败重启。

What you expected to happen:
kruise-controller-manager不出现启动失败的情况

How to reproduce it (as minimally and precisely as possible):
crd就绪时间晚于kruise-controller-manager安装时首次注册该资源的时间,会触发该bug

Anything else we need to know?:
已验证在crd就绪早于kruise-controller-manager安装时首次注册该资源的时间的环境中,不会出现该问题。

Environment:

  • Kruise version: 1.8.2+ commitID: 3e86101
  • Kubernetes version (use kubectl version): 1.34
  • Install details (e.g. helm install args): helm
  • Others:

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions