ついさっきまで動いていたクラスターを再起動しようとしたらなぜか起動しない
という怪奇現象におそわれた
microk8s.start
microk8s.status
microk8s is not running. Use microk8s.inspect for a deeper inspection.
詳しくみてみると
microk8s kubectl get job
E0303 18:23:45.450410 14519 memcache.go:238] couldn't get current server API group list: Get "https://xxx.xxx.xxx.xxx:16443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2025-03-03T18:23:45+09:00 is after 2025-02-20T06:31:52Z
E0303 18:23:45.458548 14519 memcache.go:238] couldn't get current server API group list: Get "https://xxx.xxx.xxx.xxx:16443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2025-03-03T18:23:45+09:00 is after 2025-02-20T06:31:52Z
E0303 18:23:45.465572 14519 memcache.go:238] couldn't get current server API group list: Get "https://xxx.xxx.xxx.xxx:16443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2025-03-03T18:23:45+09:00 is after 2025-02-20T06:31:52Z
E0303 18:23:45.473846 14519 memcache.go:238] couldn't get current server API group list: Get "https://xxx.xxx.xxx.xxx:16443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2025-03-03T18:23:45+09:00 is after 2025-02-20T06:31:52Z
E0303 18:23:45.481143 14519 memcache.go:238] couldn't get current server API group list: Get "https://xxx.xxx.xxx.xxx:16443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2025-03-03T18:23:45+09:00 is after 2025-02-20T06:31:52Z
Unable to connect to the server: x509: certificate has expired or is not yet valid: current time 2025-03-03T18:23:45+09:00 is after 2025-02-20T06:31:52Z
となっていた
どうもこれは証明書の有効期限らしいがデフォルトで2yと微妙に気づきにくい時間に設定されていたので対処に時間がかかってしまった
以下のように更新したら治った
sudo microk8s refresh-certs -c
sudo microk8s refresh-certs -e ca.crt
sudo microk8s refresh-certs -e front-proxy-client.crt
microk8s kubectl get po -n kube-system