1.27.4 k8s 下,coredns flannel 均报错401,kube-apiserver 刷 "Unable to authenticate the request" err="[invalid bearer token, service account token is not valid yet]
由来
今天同事说他的 pod 无法操作 k8s 集群资源了,查看了下,发现 flannel coredns 均报错 401
1
[ERROR] plugin/kubernetes: pkg/mod/k8s.io/client-go@v0.26.1/tools/cache/reflector.go:169: Failed to watch *v1.Service: failed to list *v1.Service: Unauthorized
kube-apiserver 刷日志:
1
authentication.go:70] "Unable to authenticate the request" err="[invalid bearer token, service account token is not valid yet]"
// https://github.com/kubernetes/kubernetes/blob/v1.27.4/pkg/kubelet/stats/cri_stats_provider.go#L715-L760 func(p *criStatsProvider) getAndUpdateContainerUsageNanoCores(stats *runtimeapi.ContainerStats) *uint64 { if stats == nil || stats.Attributes == nil || stats.Cpu == nil { returnnil } // Bypass the cache if the CRI implementation specified the UsageNanoCores. if stats.Cpu.UsageNanoCores != nil { return &stats.Cpu.UsageNanoCores.Value } // If there is no UsageNanoCores, nor UsageCoreNanoSeconds, there is no information to use if stats.Cpu.UsageCoreNanoSeconds == nil { returnnil } id := stats.Attributes.Id usage, err := func() (*uint64, error) { p.mutex.Lock() defer p.mutex.Unlock()
cached, ok := p.cpuUsageCache[id] if !ok || cached.stats.UsageCoreNanoSeconds == nil || stats.Cpu.UsageCoreNanoSeconds.Value < cached.stats.UsageCoreNanoSeconds.Value { // Cannot compute the usage now, but update the cached stats anyway p.cpuUsageCache[id] = &cpuUsageRecord{stats: stats.Cpu, usageNanoCores: nil} returnnil, nil }
Apr 1 00:02:21 redhat79 etcd: {"level":"warn","ts":"2024-04-01T00:02:21.54608+0800","caller":"rafthttp/probing_status.go:82","msg":"prober found high clock drift","round-tripper-name":"ROUND_TRIPPER_RAFT_MESSAGE","remote-peer-id":"1354c3808ef4eeb9","clock-drift":"38.480218393s","rtt":"6.133426ms"} Apr 1 00:02:25 redhat79 kubelet: I0401 00:02:25.365462 3553 kubelet_pods.go:894] "Unable to retrieve pull secret, the image pull may not succeed." pod="default123/xxxx-browsersvc-100-55dc46dd54-2vlbf" secret="" err="secret \"regcred\" not found" Apr 1 00:02:26 redhat79 kube-apiserver: E0401 00:02:26.604914 1390 controller.go:193] "Failed to update lease" err="Operation cannot be fulfilled on leases.coordination.k8s.io \"apiserver-s7gqnvvc7gfrpthq3uyibizgba\": the object has been modified; please apply your changes to the latest version and try again" Feb 4 23:44:00 redhat79 systemd: Time has been changed Feb 4 23:44:00 redhat79 chronyd[917]: Backward time jump detected!