Skip to content

Instantly share code, notes, and snippets.

@pop
Created November 18, 2016 22:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pop/e2a82cbb05bdd0a741994de1963a507f to your computer and use it in GitHub Desktop.
Save pop/e2a82cbb05bdd0a741994de1963a507f to your computer and use it in GitHub Desktop.
Buildbot on K8s

I'm trying to deploy buildbot on kubernetes because:

  1. I couldn't find anybod else that had done it.
  2. I wanted to learn how to deploy something more complicated than Nginx
  3. It looked like good blogpost material.

I found https://docs.buildbot.net/current/tutorial/docker.html and specifically https://github.com/buildbot/buildbot-docker-example-config. It's a docker-compose config which I'm trying to map to a K8s setup.

On Minikube I got a few things working:

  1. kubectl create -f buildbot-postgres.yml creates a postgres container. Start that first.
  2. kubectl create -f buildbot-master.yml creates a master node. Start that second.
  3. kubectl port-forward <master pod> 8080:8080 (or something close) allows you to view the master node on localhost:8080, which is what Buildbot wants.
  4. kubectl create -f buildbot-worker.yml creates the worker pod, but kubectl logs <worker pod> show that it cannot connect to the master pod.

The problem I have is that kbuectl create -f buildbot-worker.yml does not work. I have no idea why.

When you run kubectl exec <worker pod> sh you can curl master:8080 and that works fine, but curl master:9989 (the port they communicate on) hangs.

I'm not sure how best to debug this further. Any ideas on how to get the master and worker pod communicating correctly?

kubectl describe -f buildbot-worker.yml should look similar to kubectl describe -f buildbot-postgres.yml I think but I coudl be wrong.

apiVersion: v1
kind: Service
metadata:
name: master
labels:
app: buildbot
spec:
ports:
-
port: 8080
selector:
app: buildbot
tier: master
type: NodePort
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: master
labels:
app: buildbot
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: buildbot
tier: master
spec:
containers:
-
name: master
image: buildbot/buildbot-master:master
ports:
-
containerPort: 8080
name: master
env:
-
name: BUILDBOT_CONFIG_DIR
value: config
-
name: BUILDBOT_CONFIG_URL
value: 'https://github.com/buildbot/buildbot-docker-example-config/archive/master.tar.gz'
-
name: BUILDBOT_WORKER_PORT
value: '9989'
-
name: BUILDBOT_WEB_URL
value: 'http://localhost:8080/'
-
name: BUILDBOT_WEB_PORT
value: '8080'
-
name: POSTGRES_PASSWORD
value: change_me
-
name: POSTGRES_USER
value: buildbot
-
name: POSTGRES_DB
value: buildbot
-
name: POSTGRES_DB_HOST
value: postgres
-
name: BUILDBOT_DB_URL
value: 'postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_DB_HOST}/{POSTGRES_DB}'
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app: buildbot
spec:
ports:
-
port: 5432
selector:
app: buildbot
tier: postgres
clusterIP: None
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: postgres
labels:
app: buildbot
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: buildbot
tier: postgres
spec:
containers:
-
image: postgres:9.4
name: postgres
ports:
-
containerPort: 5432
name: postgres
env:
-
name: POSTGRES_PASSWORD
value: change_me
-
name: POSTGRES_USER
value: buildbot
-
name: POSTGRES_DB
value: buildbot
-
name: POSTGRES_DB_HOST
value: postgres
-
name: BUILDBOT_DB_URL
value: 'postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_DB_HOST}/{POSTGRES_DB}'
apiVersion: v1
kind: Service
metadata:
name: worker
labels:
app: buildbot
spec:
ports:
-
port: 9989
selector:
app: buildbot
tier: worker
clusterIP: None
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: worker
labels:
app: buildbot
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: buildbot
tier: worker
spec:
containers:
-
image: buildbot/buildbot-worker:master
name: worker
ports:
-
containerPort: 9989
name: worker
env:
-
name: BUILDMASTER
value: master
-
name: BUILDMASTER_PORT
value: '9989'
-
name: WORKERNAME
value: example-worker
-
name: WORKERPASS
value: pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment