<p>I'm trying to run android emulator container, over GKE. For this, I'm using <a href="https://github.com/budtmo/docker-android" rel="nofollow noreferrer">budtmo/docker-android</a> open source.</p>

<p>First, I tried to run it locally over docker:</p>

<pre><code>$ sudo  docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 4723:4723 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1
</code></pre>

<p>Then I connected to the device, using:</p>

<pre><code>$ adb connect localhost:5555
</code></pre>

<p>And I saw the device:</p>

<pre><code>&gt;&gt; $ adb devices
List of devices attached
localhost:5555  device
</code></pre>

<p><strong>works great!</strong></p>

<p><strong>Now I'm trying to do same thing over GKE:</strong></p>

<p>This is the pod:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: android
  labels:
    app: android
spec:
  containers:
  - name: android
    image: budtmo/docker-android-x86-8.1
    securityContext:
      privileged: true   
    ports:
    - containerPort: 6080
    - containerPort: 5554
    - containerPort: 5555
    - containerPort: 4723
    env:
    - name: DEVICE
      value: "Samsung Galaxy S6"
</code></pre>

<p>This is the service:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: android-service
spec:
  ports:
  - port: 6080
    name: serving
    protocol: TCP
  - port: 5555
    name: srv
    protocol: TCP
  - port: 5554
    name: srv2
    protocol: TCP
  - port: 4723
    name: novnc
    protocol: TCP
  selector:
    app: android
  type: LoadBalancer
  loadBalancerIp: "35.X.X.X"
</code></pre>

<p>Then I'm trying to connect to the emulator (from my computer), but after it claims it connected, I don't see any devices attached :</p>

<pre><code>&gt;&gt; $ adb connect 35.X.X.X:5555
connected to 35.X.X.X:5555
&gt;&gt; $ adb devices
List of devices attached
*empty*
</code></pre>

<p>I also tried to connect locally from the GKE terminal:</p>

<pre><code>adb connect 35.X.X.X:5555
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 35.X.X.X:5555
</code></pre>

<p>Then again:</p>

<pre><code>&gt;&gt; $ adb devices
List of devices attached
*empty*     
</code></pre>

<p>Any idea what is the problem, and how can I fix it?</p>

<p>Reproduced your steps with the only difference: I havent specified <code>loadBalancerIp</code> under service:</p>

<pre><code>---
apiVersion: v1
kind: Pod
metadata:
  name: android
  labels:
    app: android
spec:
  containers:
  - name: android
    image: budtmo/docker-android-x86-8.1
    securityContext:
      privileged: true
    ports:
    - containerPort: 6080
    - containerPort: 5554
    - containerPort: 5555
    - containerPort: 4723
    env:
    - name: DEVICE
      value: "Samsung Galaxy S6"

---
apiVersion: v1
kind: Service
metadata:
  name: android-service
spec:
  ports:
  - port: 6080
    name: serving
    protocol: TCP
  - port: 5555
    name: srv
    protocol: TCP
  - port: 5554
    name: srv2
    protocol: TCP
  - port: 4723
    name: novnc
    protocol: TCP
  selector:
    app: android
  type: LoadBalancer
</code></pre>

<p>Result is everything works as expected with provided yaml:</p>

<pre><code>kubectl get po,svc
NAME          READY   STATUS    RESTARTS   AGE
pod/android   1/1     Running   0          14m

NAME                      TYPE           CLUSTER-IP   EXTERNAL-IP     PORT(S)                                                       AGE
service/android-service   LoadBalancer   10.0.1.238   *.*.*.54   6080:31952/TCP,5555:30822/TCP,5554:30806/TCP,4723:30248/TCP   14m
</code></pre>

<p>From local pc:</p>

<pre><code>adb connect *.*.*.54:5555
already connected to *.*.*.54:5555

adb devices
List of devices attached
*.*.*.54:5555   offline
emulator-5554   device
localhost:5555  device
</code></pre>
