How to run an Ark Survival Evolved Private Server on Google Kubernetes Engine (GKE)

We have been running an Ark Survival Evolved dedicated server for a while, and it has been a blast. We had up to 12 people playing on it, most of them friends (and some parents) of our kids.

We originally hosted the server on an Amazon Web Services instance, but recently moved it to Google’s managed Kubernetes service GKE. It works great and the deployment was very easy. If you want to do the same, below is how it works.

Before you start, you can estimate the cost using the GCP Pricing Calculator. Ark won’t run on nodes that have less than 16 GB and 32 GB is definitely safer.

1. Sign up for GKE

Just follow the instructions for the GKE Quickstart up to (but not including) the “Creating the Deployment” part. You essentially need a Google Account (e.g. GMail), set up billing and create a cluster. If you only want to run Ark, pick a single Node with at least 16 GB of ram and 50 GB of disk storage.  The result should look like this.

You can use Google’s Cloud Shell or install the Google Cloud SDK as well as kubectl (the Kubernetes command line tool) locally on your laptop. The instructions below are using a local install which on a Mac is quick and painless.

To test if everything worked, try to get the nodes from your shell:

appenz> kubectl get nodes
NAME                                 STATUS    ROLES     AGE       VERSION
gke-appenz-c1-pool-1-56974a8d-dqsl   Ready     <none>    3d        v1.10.6-gke.2

2. Create the Persistent Volume

Use your favorite editor to create the following file and save it as ark-pv.yaml.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: arkgame-pv-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 32Gi

Now run the following command in your shell to create the persistent volume.

appenz> kubectl apply -f ark-pv.yaml
appenz> kubectl get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM                               STORAGECLASS   REASON    AGE
pvc-ecdc2527-b3a4-11e8-ac2b-42010a8a007e   32Gi       RWO            Retain           Bound     guido-wp/arkgame-pv-claim           standard                 3d

GKE will automatically create the persistent volume that backs up the persistent volume claim. We now have the storage for the Ark map and game state.

3. Run the Server

Use your favorite editor to create the following file and save it as ark-gameserver.yaml.

apiVersion: v1
kind: Service
metadata:
  name: arkgame
  labels:
    app: arkgame
spec:
  type: LoadBalancer
  ports:
  - port: 27015
    targetPort: 27015
    protocol: UDP
    name: ark-steam
  - port: 7777
    targetPort: 7777
    protocol: UDP
    name: ark-gameclient
  - port: 7778
    targetPort: 7778
    protocol: UDP
    name: ark-gamerawudpport
  selector:
    app: arkgame
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: arkgame
  labels:
    app: arkgame
spec:
  replicas: 1
  selector:
    matchLabels:
      app: arkgame
  template:
    metadata:
      labels:
        app: arkgame
    spec:
      containers:
      - image: boerngenschmidt/ark-docker
        name: arkgame
        env:
          # Server Parameters
        - name: SESSIONNAME
          value: MyAwesomeArkServer.MyDomain.org
        - name: SERVERMAP
          value: Ragnarok
        - name: SERVERPASSWORD
          value: secretserverpassword
        - name: ADMINPASSWORD
          value: secretadminpassword
        ports:
          - containerPort: 27015
            protocol: UDP
            name: ark-steams
          - containerPort: 7777
            protocol: UDP
            name: ark-gameclient
          - containerPort: 7778
            protocol: UDP
            name: ark-gamerawudp
        volumeMounts:
        - name: arkgame-persistent-storage
          mountPath: /ark
      volumes:
      - name: arkgame-persistent-storage
        persistentVolumeClaim:
          claimName: arkgame-pv-claim

Make sure you replace in the file the following values:

  1. Pick your ark server container image of choice. The docker image in the file above ( boerngenschmidt/ark-docker ) worked well for me.
  2. Set the name of the ark server, e.g. the server’s domain name.
  3. Set the server password that is required to join the server.
  4. Set the admin password.

Now run from the shell:

appenz> kubectl create -f ark-gameserver.yaml

This creates the running container and the ingress LoadBalancer on Google Cloud. It may take a minute for everything to be up and running. One everything is up, you can check for the IP address of the server:

appenz> kubectl get ingress
NAME          HOSTS     ADDRESS          PORTS     AGE
web-ingress   *         130.211.34.126   80        2d

Now you should be able to go to Steam join the server (for instructions how, check out this post). In my experience it can take a while (hours or even days) until the server shows up in the official Ark server list, but that doesn’t really matter.

Once the server is up and running, you can connect to the container with kubectl exec and edit the server parameters. You can also use the “arkadmin” command to install mods, set the MOTD or update the server. It’s easy enough that our 10 year old son does it by himself.

Please send comments or questions via twitter to @appenz and happy gaming.