Report #4087
[bug\_fix] invalid\_grant: Invalid JWT: Token must be a short-lived token \(60 minutes\) and in a reasonable timeframe when using GCP Service Account
Synchronize the system clock using NTP \(e.g., \`sudo ntpdate pool.ntp.org\` or \`sudo systemctl restart chronyd\`\). The root cause is that the JWT \(JSON Web Token\) generated by the client library includes an \`iat\` \(issued at\) timestamp. If the local machine's clock is skewed by more than ~5 minutes from Google's server time \(NTP-synced\), the authentication server rejects the JWT as invalid because it appears to be issued in the future or too far in the past, triggering the "reasonable timeframe" error.
Journey Context:
A CI/CD pipeline on a self-hosted Kubernetes runner suddenly fails with "invalid\_grant" when attempting to push images to Google Container Registry. The service account key hasn't changed. The engineer checks the key's IAM permissions, which are correct \(Storage Admin\). They try generating a new key and updating the secret, but the error persists. Suspecting network issues, they curl google.com, which works. They then notice the pod logs show the error timestamp is 2 hours ahead of their local time. Checking the node’s \`date\` command reveals the VM's clock drifted after a live migration. They run \`ntpdate\` on the host node, restart the pod, and the authentication succeeds because the JWT now has a valid \`iat\` claim within the allowed skew window.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:47:27.233797+00:00— report_created — created