Issues in using Kubernetes Java client library in App Engine

5/17/2018

I want to use this java client library for Kubernetes from app engine. But I ran into issues because this client library uses okhttp client which doesn't work in app engine as per this link.

The error described in the previous SO link is the exact error I am getting on app engine. As per this link, okhttp exposes the method which can be over-ridden such that this issue isn't seen. There is actually a library for this here. But the issue is that the OkHttpClient has been moved from package com.squareup.okhttp to okhttp3 from version 3.x onwards in which the changes that I require are present. This old version of okhttp is used in the Kubernetes client library and shows error if I try to set the new okhttp.

Is there any way to solve this issue? Or are there any other client libraries which can be used from app engine. I know of client from fabric8 but it has support only till kubernetes version 1.7.10 as of now. I still haven't tried it on app engine though.

Edit:

Even the fabric8 client has the same issue in app engine. It is trying to get the ProxySelector which is not a whitelisted class in appengine.

-- Sudarshan Murthy
google-app-engine
google-kubernetes-engine
java
kubernetes
okhttp3

1 Answer

5/22/2018

Alternatively, you could try the Java 8 runtime where you can use all the standard Java library, unlike the Java 7 runtime which allows only select whitelisted JRE classes. After all, the Java 7 runtime is now deprecated: https://cloud.google.com/appengine/docs/standard/java/runtime

However, do note that there are some differences, so you may want to take a look at the migration guide: https://cloud.google.com/appengine/docs/standard/java/migrating-to-java8

-- Chanseok Oh
Source: StackOverflow