metadata.finalizers[0]: 无效值: "foregroundDeletion": 名称既不是标准终结器名称也不是完全限定的

metadata.finalizers[0]: Invalid value: "foregroundDeletion": name is neither a standard finalizer name nor is it fully qualified

我们有一个完整的集群 运行 在生产中,它突然停止工作并出现以下错误:

The Deployment "authapi" is invalid: metadata.finalizers[0]: Invalid value: "foregroundDeletion": name is neither a standard

finalizer name nor is it fully qualified

我当前的集群版本是:

Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"2c2fe6e8278a5db2d15a013987b53968c743f2a1", GitTreeState:"clean", BuildDate:"2017-08-03T07:00:21Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:21:54Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}

另一方面,我们也无法部署。 kubectl 尝试部署时出现以下消息:

   W1127 15:28:32.999978 42625 factory_object_mapping.go:423] Failed to download OpenAPI (the server could not find the requested

resource), falling back to swagger The Deployment "authapi" is invalid: metadata.finalizers[0]: Invalid value: "foregroundDeletion": name is neither a standard finalizer name nor is it fully qualified /home/builduser/myagent/_work/_temp/kubectlTask/1511796511792/kubectl failed with return code: 1

YAML定义如下:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: authapi
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1  
  template:
    metadata:
      labels:
        app: authapi
    spec:
      containers:
      - name: authapi
        image: edgecontainerregistry.azurecr.io/portal.authapi:latest
        imagePullPolicy: Always
        resources:
          requests:
            cpu: 100m        
        ports:
        - containerPort: 5006   
        env:
          - name: ASPNETCORE_ENVIRONMENT
            valueFrom:
              configMapKeyRef:
                name: aspnetcore-config
                key: aspnetcore.env           
      imagePullSecrets:
        - name: edgesecret        
---
kind: Service
apiVersion: v1
metadata:
  name: authapi
spec:
  ports:
    - protocol: TCP
      port: 5006
      targetPort: 5006
  selector:
    app: authapi
  type: ClusterIP
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: authapi
spec:
  scaleTargetRef:
    apiVersion: apps/v1beta1
    kind: Deployment
    name: authapi
  minReplicas: 1
  maxReplicas: 10
  targetCPUUtilizationPercentage: 50

对此有任何帮助吗?

我通过以下命令解决了问题 运行:

kubectl delete deployments/authapi --namespace=production --force

这是一个错误,已在 1.6.7+ 中修复

https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.6.md/#v167

Fix Invalid value: "foregroundDeletion" error when attempting to delete a resource. (#46500, @tnozicka)

在集群 运行 版本 1.6.0 上尝试升级集群中的服务 运行 时遇到此问题。我无法立即升级 kubernetes 集群(以修复错误)。

检查部署中的 pods 并注意到其中一个卡在 "Terminating" 状态。

我描述了 pod 以获取它 运行 上的 kubernetes 节点,进入该节点,在 kubelet 日志上出现此错误

kuberuntime_manager.go:858] getPodContainerStatuses for pod "_default(781d0645-23d3-11e8-bcca-00505690014f)" failed: rpc error: code = 2 desc = unable to inspect docker image

重新启动 Docker 和节点上的 kubelet,pod 现在已经消失并且可以毫无问题地更新服务。