0

As gogs.io is offering a docker image, i thought it must be straight forward to install it on top of google container engine with kubernetes.

After fiddling around a few hours i got two configuration-files now, as i have seen them in an issue thread here:

The files in the issue thread are using a ReplicationController instead of a pod.. and the service is also not using a LoadBalancer as type - i couldn't get it work this way neither, so i changed it to a Pod and a Service including LoadBalancer like in the wordpress tutorial of google

gogs.yml:

apiVersion: v1
kind: Pod
metadata:
  name: gogs
  labels:
    name: gogs
spec:
  containers:
    - name: gogs
      image: gogs/gogs
      ports:
        - containerPort: 3000
        - containerPort: 22
      volumeMounts:
        - mountPath: /data
          name: data
    - name: postgres
      image: postgres
      ports:
        - containerPort: 5432
      volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: postgres
      env:
        - name: POSTGRES_USER
          value: "gogs"
        - name: POSTGRES_PASSWORD
          value: "gogs"
  volumes:
    - name: data
      gcePersistentDisk:
        # This disk must already exist.
        pdName: gogs-stage-data-disk
        fsType: ext4
    - name: postgres
      gcePersistentDisk:
        # This disk must already exist.
        pdName: gogs-stage-postgres-disk
        fsType: ext4

gogs-service.yml:

apiVersion: v1
kind: Service
metadata:
  labels:
    name: gogs-frontend
  name: gogs-frontend
spec:
  type: LoadBalancer
  ports:
    # The port that this service should serve on.
    - port: 80
      targetPort: 3000
      protocol: TCP
  selector:
    name: gogs

Then i followed basically the steps like in this tutorial to include external disks for the data and db directories.

  • Create a new project, set compute zone (gcloud config set..)

  • Create a new cluster gcloud container clusters create gogs-stage --num-nodes 1

  • Create new persistent disks

gcloud compute disks create --size 200GB gogs-stage-data-disk

gcloud compute disks create --size 200GB gogs-stage-postgres-disk

  • Create pod kubectl create -f gogs.yml

  • Create the service kubectl create -f gogs-service.yml

Now at the point of creating the pod, it never turns from "Pending" to "Ready" also when i wait for several minutes - i check with kubectl get pod gogs

What is wrong with my setup? And how could i check it? I can login with ssh.. when i look there into the /var/log/messages, i can see some docker errors in the end of the file saying:

aufs au_opts_verify:1570:docker[4711]: dir perm1 breaks the protection by the permission bits on the lower branch

But only with that, i couldn't find anything pointing me in the right direction so far. Any help very appreciated :)

jebbie
  • 161
  • 1
  • 7
  • Sry for the one's who starred this question.. there seems no solution around.. right? I tried this too with gitlab without any success - postgres and redis or mysql wordpress.. all easy.. but no other packages than used in tutorials seems to work for me – jebbie Apr 06 '16 at 14:28
  • FYI - gogs.io is easily installable on openshift, with this simple link: https://github.com/tkisme/gogs-openshift – jebbie Apr 06 '16 at 15:09

1 Answers1

1

You should also specify the default data directory location using PGDATA environmental variable.

Try this:

apiVersion: v1
kind: Pod
metadata:
  name: gogs
  labels:
    name: gogs
spec:
  containers:
    - name: gogs
      image: gogs/gogs
      ports:
        - containerPort: 3000
        - containerPort: 22
      volumeMounts:
        - mountPath: /data
          name: data
    - name: postgres
      image: postgres
      ports: 
        - containerPort: 5432
      env:
        - name : PGDATA
          value: /var/lib/postgresql/data/pgdata
        - name: POSTGRES_USER
          value: myuser
        - name: POSTGRES_PASSWORD
          value: mypassword
        - name: POSTGRES_DB
          value: mydb
      volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: postgres
  volumes:
    - name: data
      gcePersistentDisk:
        pdName: gogs-stage-data-disk
        fsType: ext4
    - name: postgres
      gcePersistentDisk:
        pdName: gogs-stage-postgres-disk
        fsType: ext4
Kamran
  • 1,415
  • 7
  • 16