結論
oc login
に--insecure-skip-tls-verify
を付けよう。
流れ
OpenShift にログインしようとしたら、証明書の期限を過ぎているエラーが出ました。
> oc login error: tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2025-03-06T09:32:11+09:00 is after 2024-12-10T06:57:42Z
とりあえず、証明書を検証しないように --insecure-skip-tls-verify
を付けてログインします。
oc login --insecure-skip-tls-verify WARNING: Using insecure TLS client config. Setting this option is not supported! You must obtain an API token by visiting https://oauth-openshift.apps.<your-domain>/oauth/token/request Alternatively, use "oc login --web" to login via your browser. See "oc login --help" for more information.
Tokenを取れと言われるので、ブラウザで https://oauth-openshift.apps.<your-domain>/oauth/token/request
にアクセスして、再度ログインします。
oc login --token=sha256~YP4ypSQVwq6r3o6WIUupXqMEXCZq5zihYvll3PeK59U --server=https://api.<your-domain>:6443 --insecure-ski p-tls-verify WARNING: Using insecure TLS client config. Setting this option is not supported! Logged into "https://api.<your-domain>:6443" as "kube:admin" using the token provided. You have access to 83 projects, the list has been suppressed. You can list all projects with 'oc projects' Using project "home".
これでログイン出来ました。