I can't get the Application Default Credentials working in Google Container Engine. The docs say that they're intended for App Engine and Compute Engine, but I've been told that they should transparently pass through to a container running on Container Engine.
Here's the code that's failing:
credentials = GoogleCredentials.get_application_default()
service = discovery.build('storage', 'v1', credentials=credentials)
The error it's failing with: AssertionError: No api proxy found for service "memcache"
Is it correct to expect Application Default Credentials to work with Container Engine? If not, can anyone recommend the proper way to connect to cloud storage from a container running on Container Engine?
Thanks.
EDIT: After running gcloud beta auth application-default activate-service-account --key-file <my_key>.json
the credentials
object in the above Python example is populated with data. However I'm still getting the same error.
The easiest way to access cloud storage on Container Engine appears to be the gcloud library.
It won't work with zero configuration if the App Engine SDK is installed on the container (gcloud finds it and assumes it's running on App Engine). So I stopped using the official Google container.
On a python container just add gcloud to your requirements.txt (or run
pip install gcloud
). As long as the container lives on a Google Compute Engine instance you can access any bucket in the same project.Example:
The gcloud library also exists for Java, Node, and Ruby.