GCE/GKE Kubectl: the server doesn't have a resource type “services”


I have two kubernetes clusters on google container engine but on seperate google accounts (one using my company's email and another using my personal email). I attempted to switch from one cluster to another. I did this by:


Logging in with my other email address

$ gcloud init

</li> <li>

Getting new kubectl credentials

gcloud container cluster get-credentials

</li> <li>

Test to see if connected to new cluster

$ kubectl get po

</li> </ol>

However, I was still not able to get the kubernetes resources in the cluster. The error I received was:

the server doesn't have a resource type "pods"


This occurs because although I logged in with the new credentials... kubectl isn't using the new credentials. In order to change the login/access credentials that kubectl will use to access your cluster you need to run the following command:

gcloud auth application-default login

You will then get the following response:

Your browser has been opened to visit: https://accounts.google.com/o/oauth2/auth redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&respons e_type=code&client_id=...& scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email +https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&access_type=offline Credentials saved to file: [/Users/.../.config/gcloud/application_default_credentials.json] These credentials will be used by any library that requests Application Default Credentials.

Then get cluster credentials

gcloud container clusters get-credentials [cluster name/id]

You should now be able to access the cluster using kubectl.


  • -fobjc-weak is not supported on the current deployment target
  • How to configure a non-default serviceAccount on a deployment
  • Cannot import Firebase sdk in Swift app
  • Realm, query for objects in realm using swift
  • sqlite3_wal_checkpoint_v2 always returns SQL_BUSY
  • How to read files recursively in Java 7?
  • getting image type of remote image in php
  • iPhone - UIWebView multiple locks
  • substitute period from abbreviation (single letter + period) unless followed by a capital letter
  • Why does this empty dict break shared references?
  • How to protect an asp:textbox from user input?
  • c++ using primitive types as a base class
  • Cannot invoke my method on the array type int[]
  • runtime error when linking ffmpeg libraries in qt creator
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Problem with Django using Apache2 (mod_wsgi), Occassionally is “unable to import from module” for no
  • In Java, how can I construct a File from a resource?
  • Bash if statement with multiple conditions
  • Button text different than value submitted in query string
  • JBoss External Properties Files in Classpath
  • Odoo 10 - Overriding unlink method
  • Does it make sense to call System.gc() and Thread.sleep() when working on Bitmaps?
  • MongoDb aggregation
  • Is there a way to do normal logging with EureakLog?
  • Avoid links criss cross / overlap in d3.js using force layout
  • Recording logins for password protected directories
  • Launch Runnable Jar from Web Start
  • Resize panoramic image to fixed size
  • Volusion's generic SQL folder, functionality
  • Updating server-side rendering client-side
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Proper way to use connect-multiparty with express.js?
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • How do I configure my settings file to work with unit tests?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Binding checkboxes to object values in AngularJs