Kubernetes v1.21.2:“selfLink 为空,无法引用”

Posted

技术标签:

【中文标题】Kubernetes v1.21.2:“selfLink 为空,无法引用”【英文标题】:Kubernetes v1.21.2: 'selfLink was empty, can't make reference' 【发布时间】:2021-10-13 15:55:03 【问题描述】:

对于如下所示的 pod,我收到此日志错误,但我已将 kubernetes 编排器、集群和节点更新到 kubernetes v1.21.2。在更新之前,它们是 v1.20.7。我发现从 v1.21 开始,selfLink 已完全删除。为什么我会收到此错误?我该如何解决这个问题?

kubectl 日志的错误日志(podname)

...
2021-08-10T03:07:19.535Z        INFO    setup   starting manager
2021-08-10T03:07:19.536Z        INFO    controller-runtime.manager      starting metrics server "path": "/metrics"
E0810 03:07:19.550636       1 event.go:247] Could not construct reference to: '&v1.ConfigMapTypeMeta:v1.TypeMetaKind:"", APIVersion:"", ObjectMeta:v1.ObjectMetaName:"controller-leader-election-helper", GenerateName:"", Namespace:"kubestone-system", SelfLink:"", UID:"b01651ed-7d54-4815-a047-57b16d26cfdf", ResourceVersion:"65956", Generation:0, CreationTimestamp:v1.TimeTime:time.Timewall:0x0, ext:63764161639, loc:(*time.Location)(0x21639e0), DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string"control-plane.alpha.kubernetes.io/leader":"\"holderIdentity\":\"kubestone-controller-manager-f467b7c47-cv7ws_1305bc36-f988-11eb-81fc-a20dfb9758a2\",\"leaseDurationSeconds\":15,\"acquireTime\":\"2021-08-10T03:07:19Z\",\"renewTime\":\"2021-08-10T03:07:19Z\",\"leaderTransitions\":0", OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:"", ManagedFields:[]v1.ManagedFieldsEntryv1.ManagedFieldsEntryManager:"manager", Operation:"Update", APIVersion:"v1", Time:(*v1.Time)(0xc0000956a0), Fields:(*v1.Fields)(nil), Data:map[string]string(nil), BinaryData:map[string][]uint8(nil)' due to: 'selfLink was empty, can't make reference'. Will not report event: 'Normal' 'LeaderElection' 'kubestone-controller-manager-f467b7c47-cv7ws_1305bc36-f988-11eb-81fc-a20dfb9758a2 became leader'
2021-08-10T03:07:21.636Z        INFO    controller-runtime.controller   Starting Controller     "controller": "kafkabench"
...

kubectl get nodes to show kubernetes version:pod调度的节点是aks-default-41152893-vmss000000

PS C:\Users\t-yunlee> kubectl get nodes -A
NAME                              STATUS   ROLES   AGE     VERSION
aks-default-41152893-vmss000000   Ready    agent   5h32m   v1.21.2
aks-default-41152893-vmss000001   Ready    agent   5h29m   v1.21.2
aksnpwi000000                     Ready    agent   5h32m   v1.21.2
aksnpwi000001                     Ready    agent   5h26m   v1.21.2
aksnpwi000002                     Ready    agent   5h19m   v1.21.2

kubectl 描述 pod(pod 名称:kubestone-controller-manager-f467b7c47-cv7ws)

PS C:\Users\t-yunlee> kubectl describe pods kubestone-controller-manager-f467b7c47-cv7ws -n kubestone-system
Name:         kubestone-controller-manager-f467b7c47-cv7ws
Namespace:    kubestone-system
Priority:     0
Node:         aks-default-41152893-vmss000000/10.240.0.4
Start Time:   Mon, 09 Aug 2021 23:07:16 -0400
Labels:       control-plane=controller-manager
              pod-template-hash=f467b7c47
Annotations:  <none>
Status:       Running
IP:           10.240.0.21
IPs:
  IP:           10.240.0.21
Controlled By:  ReplicaSet/kubestone-controller-manager-f467b7c47
Containers:
  manager:
    Container ID:  containerd://01594df678a2c1d7163c913eff33881edf02e39633b1a4b51dcf5fb769d0bc1e
    Image:         bwatada/kubestonewindows:latest
    Image ID:      docker.io/bwatada/kubestonewindows@sha256:aa049f135931192630ceda014d7a24306442582dbeeaa36ede48e6599b6135e1
    Port:          <none>
    Host Port:     <none>
    Command:
      /manager
    Args:
      --enable-leader-election
    State:          Running
      Started:      Mon, 09 Aug 2021 23:07:18 -0400
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     100m
      memory:  30Mi
    Requests:
      cpu:        100m
      memory:     20Mi
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-jvjjh (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  kube-api-access-jvjjh:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              kubernetes.io/os=linux
Tolerations:                 node.kubernetes.io/memory-pressure:NoSchedule op=Exists
                             node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  23m   default-scheduler  Successfully assigned kubestone-system/kubestone-controller-manager-f467b7c47-cv7ws to aks-default-41152893-vmss000000
  Normal  Pulling    23m   kubelet            Pulling image "bwatada/kubestonewindows:latest"
  Normal  Pulled     23m   kubelet            Successfully pulled image "bwatada/kubestonewindows:latest" in 354.899039ms
  Normal  Created    23m   kubelet            Created container manager
  Normal  Started    23m   kubelet            Started container manager

【问题讨论】:

【参考方案1】:

Kubestone 自 2019 年以来没有任何版本,它需要升级其 Kubernetes Go 客户端副本。也就是说,这似乎只会影响事件记录器系统,因此可能不是什么大问题。

【讨论】:

以上是关于Kubernetes v1.21.2:“selfLink 为空,无法引用”的主要内容,如果未能解决你的问题,请参考以下文章

K8S插件NGINX Ingress安装

导航栏没有显示在TableView上

Kubernetes——Kubernetes基础+部署Kubernetes集群

Kubernetes——Kubernetes基础+部署Kubernetes集群

Kubernetes - Kubernetes部署Kubernetes Dashbaord

kubernetes学习01—kubernetes介绍