githubEdit

Why can't I use kubectl top pod commands?

Context You may encounter a "Forbidden" error when trying to use kubectl top pod commands, even though basic kubectl get pods commands work correctly. This happens because your service account doesn't have permission to access pod metrics from the metrics.k8s.io API group. Answer This issue occurs when your current kubeconfig doesn't have the necessary permissions to access pod metrics. The solution is to download a fresh kubeconfig file from the DuploCloud portal. Follow these steps to resolve the issue: Navigate to your DuploCloud portal Go to the Infrastructure section for your cluster Click on the GKE tab Click the "Download Kube Config" button Replace your existing kubeconfig file with the newly downloaded one. This updated configuration will include the proper permissions needed to access pod metrics. After updating your kubeconfig, the kubectl top pod commands should work correctly without any permission errors.

Last updated

Was this helpful?