Skip to content

Instantly share code, notes, and snippets.

@takezoe
Last active September 11, 2018 13:53
Show Gist options
  • Save takezoe/48823772ff9b9d68ea121c147ccb0832 to your computer and use it in GitHub Desktop.
Save takezoe/48823772ff9b9d68ea121c147ccb0832 to your computer and use it in GitHub Desktop.
Run GitBucket + PostgreSQL on Kubernetes
apiVersion: v1
kind: Pod
metadata:
name: gitbucket
labels:
app: gitbucket
spec:
containers:
- name: postgresql
image: postgres:9.5-alpine
volumeMounts:
- name: gitbucket-postgresql-data
mountPath: /var/lib/postgresql/data
env:
- name: POSTGRES_DB
value: gitbucket
- name: POSTGRES_USER
value: gitbucket
- name: POSTGRES_PASSWORD
value: gitbucket
ports:
- containerPort: 5432
- name: gitbucket
image: takezoe/gitbucket
volumeMounts:
- name: gitbucket-data
mountPath: /gitbucket
env:
- name: GITBUCKET_DB_URL
value: jdbc:postgresql://localhost/gitbucket
- name: GITBUCKET_DB_USER
value: gitbucket
- name: GITBUCKET_DB_PASSWORD
value: gitbucket
ports:
- containerPort: 8080
volumes:
- name: gitbucket-data
emptyDir: {}
- name: gitbucket-postgresql-data
emptyDir: {}
@takezoe
Copy link
Author

takezoe commented Sep 11, 2018

$ kubectl apply -f gitbucket-pod.yaml
$ kubectl expose pod gitbucket --type=NodePort --port=8080
$ kubectl get service gitbucket
NAME        TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
gitbucket   NodePort   10.105.159.36   <none>        8080:30010/TCP   2m

In this case, GitBucket is running at port 30010 on the deployed node. If you are doing this tutorial with minikube on MacOS, you can open GitBucket in your browser by following command:

$ open "http://$(minikube ip):30010"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment