docker-android icon indicating copy to clipboard operation
docker-android copied to clipboard

Documentation about running docker-android using k8s

Open maauso opened this issue 5 years ago • 7 comments

Operating System: Kubernetes on to of Amazon Linux 2

Docker Image: butomo1989/docker-android-x86-7.1.1

Docker Version:
17.06

Docker-compose version (Only if you use it):
we are not using

K8S Yaml to start docker-android:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: android
  namespace: selenium
  labels:
    app: selenium
    environment: stg
    role: qa
    service: selenium
spec:
  replicas: 1
  selector:
    matchLabels:
      app: android
  template:
    metadata:
      labels:
        app: android
    spec:
      containers:
      - name: android
        image: butomo1989/docker-android-x86-7.1.1
        resources:
          limits:
            memory: "2048Mi"
            cpu: "500m"
        securityContext:
          privileged: true
        ports:
        - containerPort: 6080
          name: port1
        - containerPort: 4723
          name: port2
        - containerPort: 5554
          name: port3
        - containerPort: 5555
          name: port4
        - containerPort: 5037
          name: port5
        env:
        - name: DEVICE
          value: "Nexus 5"
        - name: APPIUM
          value: "true"
        - name: CONNECT_TO_GRID
          value: "  true"
        - name: APPIUM_HOST
          value: "android.selenium"
        - name: APPIUM_PORT
          value: "4723"
        - name: SELENIUM_HOST
          value: "selenium-selenium-hub.selenium"
        - name: SELENIUM_PORT
          value: "4444"        

Expected Behavior

Run docker-android on top of EKS

Actual Behavior

The container can connect to the selenium hub, but when we want to launch the test we found the error

emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: KVM requires a CPU that supports vmx or svm
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: KVM requires a CPU that supports vmx or svm
root@android-766c9c5f58-2wknl:~#

full log attached docker-android.stdout.log

Also, When we launch the test then we encountered an error in the appium.log

Could not find a connected Android device

We are running this docker on top of EKS it shouldn't be a problem, but do you have some documentation or workaround to do it?

maauso avatar May 24 '19 12:05 maauso

I've not tested the docker container inside with k8s on EKS, but what I tried was running it inside a virtualbox container. There I had the problem, that virtualbox doesn't support hardware virtualization like KVM. In the error message you got it says, that Hardware virtualization is disabled and therefore KVM can not come to work. If you try to run this image on a linux machine you own, you can enable Hardware Virtualization inside the BIOS, if your CPU supports it, and KVM can work.

To find out if your CPU supports Hardware Virtualization, you can type in this command to check this:

egrep -c "(svm|vmx)" /proc/cpuinfo

if the output is 0 then your CPU doesn't supoort it.

However you could try to run an arm image instead of a x86 image of the emulator. Like asked here: #88 . If you manage it to run the arm image, then you'll probably need like 10 minutes to start the container, which is in the most cases not what you want.

I don't want to disappoint you, but the only thing in mind, how to solve this issue, is to try the EKS does a KVM for you, maybe there is an option somewhere? VMWare does it too, which is in fact no cloud service. I don't even know if this is possible, just a thought.
Hopefully there is someone out there who can give you a more precise answer on your problem.

HasBert avatar May 25 '19 01:05 HasBert

You need to make sure that the machine support virtualization. I will close the ticket and please feel free to reopen it.

budtmo avatar May 29 '19 12:05 budtmo

Thanks for all guys

maauso avatar May 29 '19 12:05 maauso

It would be great if you can send a PR about your deployment template (e.g. terraform or any other tool), so other can benefit from it and we share the information. @maauso

budtmo avatar May 29 '19 12:05 budtmo

Sure, but at the moment we are looking for the best approach to have a cheaper metal server on aws

maauso avatar May 29 '19 12:05 maauso

awesome, Thanks a lot @maauso , I will open the issue and change the title than so we dont forget about it.

budtmo avatar May 29 '19 12:05 budtmo

So how does Genymotion run the emulator on non-metal instances? If they can, everyone should be able to. Or did they write custom virtualization?

v0n0 avatar Jul 22 '20 05:07 v0n0