我正在创建一个k8s定制控制器。基本上,当创建自定义资源时,将创建一些其他资源。这些包括配置映射,部署和服务。该项目是使用kubebuilder创建的。如果controller.go包含监视configmap的逻辑,则pod将终止为OOMKilled,错误代码137。监视其他类型的对象(如部署,服务和statefulset)可以正常工作。代码部分是
err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: <mv1beta1.Ltm{},
})
if err != nil {
log.Println(err)
return err
}
ltmv1beta1是CR。这几乎与kubebuilder创建的示例代码相同。还具有授予角色的正确访问权限
services [] [] [get list watch create update patch delete]
configmaps [] [] [get list watch create update patch delete]
secrets [] [] [get list watch create update patch delete]
mutatingwebhookconfigurations.admissionregistration.k8s.io [] [] [get list watch create update patch delete]
validatingwebhookconfigurations.admissionregistration.k8s.io [] [] [get list watch create update patch delete]
statefulsets.apps [] [] [get list watch create update patch delete]
ltms.ltm.k8s.io [] [] [get list watch create update patch delete]
deployments.apps/status [] [] [get update patch]
ltms.ltm.k8s.io/status [] [] [get update patch]
无法弄清楚为什么这仅发生在configmap中。谢谢。