diff --git a/README.md b/README.md index 31ea3d8..df8471b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # kubernetes-gitlab -Manifests to deploy GitLab on Kubernetes +Manifests to deploy GitLab on Kubernetes Installation process described in [blog](http://blog.lwolf.org/post/how-to-easily-deploy-gitlab-on-kubernetes/) @@ -16,7 +16,7 @@ Installation process described in [blog](http://blog.lwolf.org/post/how-to-easil * SSH is now available through 1022 service post. * NGINX settings is now configurable with configmap nginx-settings-configmap.yml. - Which currently sets body-size to 0 and increases timeouts to avoid timeouts. + Which currently sets body-size to 0 and increases timeouts to avoid timeouts. # TL;DR @@ -26,17 +26,24 @@ Installation process described in [blog](http://blog.lwolf.org/post/how-to-easil # create gitlab namespace > $ kubectl create -f gitlab-ns.yml +# create storage +> $ kubectl create -f gitlab/storage.yml + # deploy redis > $ kubectl create -f gitlab/redis-svc.yml +> $ kubectl create -f gitlab/redis-storage.yml > $ kubectl create -f gitlab/redis-deployment.yml # deploy postgres > $ kubectl create -f gitlab/postgresql-svc.yml +> $ kubectl create -f gitlab/postgresql-storage.yml > $ kubectl create -f gitlab/postgresql-deployment.yml # deploy gitlab itself > $ kubectl create -f gitlab/gitlab-svc.yml > $ kubectl create -f gitlab/gitlab-svc-nodeport.yml +> $ kubectl create -f gitlab/gitlab-storage.yml +> $ kubectl create -f gitlab/gitlab-config-storage.yml > $ kubectl create -f gitlab/gitlab-deployment.yml # deploy ingress controller diff --git a/gitlab/gitlab-config-storage.yml b/gitlab/gitlab-config-storage.yml new file mode 100644 index 0000000..7b53580 --- /dev/null +++ b/gitlab/gitlab-config-storage.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: gitlab-config-storage + namespace: gitlab + annotations: + volume.beta.kubernetes.io/storage-class: fast +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Gi diff --git a/gitlab/gitlab-deployment.yml b/gitlab/gitlab-deployment.yml index e4c4e0f..d373bde 100644 --- a/gitlab/gitlab-deployment.yml +++ b/gitlab/gitlab-deployment.yml @@ -13,116 +13,52 @@ spec: spec: containers: - name: gitlab - image: sameersbn/gitlab:8.12.7 + image: gitlab/gitlab-ce:8.15.4-ce.1 imagePullPolicy: Always env: - - name: TZ - value: Europe/Stockholm - - name: GITLAB_TIMEZONE - value: Stockholm - - name: DEBUG - value: "false" - - - name: GITLAB_SECRETS_DB_KEY_BASE - value: P26qS5+Csz50Dkd0DLM2oN9owVBFg0PB - - name: GITLAB_SECRETS_SECRET_KEY_BASE - value: KVaMTKLAIElEp0s4L02c1O9JCP0Rfapb - - name: GITLAB_SECRETS_OTP_KEY_BASE - value: nXJJ358Qnci0yF9qpAsLrF2vImaoFR03 - - - name: GITLAB_ROOT_PASSWORD - value: root - - name: GITLAB_ROOT_EMAIL - value: root@example.com - - - name: GITLAB_HOST - value: git.example.com - - name: GITLAB_PORT - value: "80" - - name: GITLAB_SSH_HOST - value: "ssh-git.example.com" - - name: GITLAB_SSH_PORT - value: "1022" - - - name: GITLAB_NOTIFY_ON_BROKEN_BUILDS - value: "true" - - name: GITLAB_NOTIFY_PUSHER - value: "false" - - - name: GITLAB_BACKUP_SCHEDULE - value: daily - - name: GITLAB_BACKUP_TIME - value: 01:00 - - - name: DB_TYPE - value: postgres - - name: DB_HOST - value: gitlab-postgresql - - name: DB_PORT - value: "5432" - - name: DB_USER - value: gitlab - - name: DB_PASS - value: +BP52QIxpT/flVCMpL3KXA== - - name: DB_NAME - value: gitlab_production - - - name: REDIS_HOST - value: gitlab-redis - - name: REDIS_PORT - value: "6379" - - - name: SMTP_ENABLED - value: "false" - - name: SMTP_DOMAIN - value: "" - - name: SMTP_HOST - value: "" - - name: SMTP_PORT - value: "" - - name: SMTP_USER - value: "" - - name: SMTP_PASS - value: "" - - name: SMTP_STARTTLS - value: "true" - - name: SMTP_AUTHENTICATION - value: login - - - name: IMAP_ENABLED - value: "false" - - name: IMAP_HOST - value: imap.gmail.com - - name: IMAP_PORT - value: "993" - - name: IMAP_USER - value: mailer@example.com - - name: IMAP_PASS - value: password - - name: IMAP_SSL - value: "true" - - name: IMAP_STARTTLS - value: "false" + - name: GITLAB_OMNIBUS_CONFIG + value: | + external_url "http://gitlab.example.com" + postgresql['enable']=false + gitlab_rails['db_host'] = 'gitlab-postgresql' + gitlab_rails['db_password']='+BP52QIxpT/flVCMpL3KXA==' + gitlab_rails['db_username']='gitlab' + gitlab_rails['db_database']='gitlab_production' + redis['enable'] = false + gitlab_rails['redis_host']='gitlab-redis' + manage_accounts['enable'] = true + manage_storage_directories['manage_etc'] = false + gitlab_shell['auth_file'] = '/gitlab-data/ssh/authorized_keys' + git_data_dir '/gitlab-data/git-data' + gitlab_rails['shared_path'] = '/gitlab-data/shared' + gitlab_rails['uploads_directory'] = '/gitlab-data/uploads' + gitlab_ci['builds_directory'] = '/gitlab-data/builds' ports: - name: http containerPort: 80 - name: ssh containerPort: 22 volumeMounts: - - mountPath: /home/git/data - name: data + - name: config + mountPath: /etc/gitlab + - name: data + mountPath: /gitlab-data livenessProbe: httpGet: - path: /users/sign_in + path: /help port: 80 initialDelaySeconds: 180 timeoutSeconds: 15 readinessProbe: httpGet: - path: /users/sign_in + path: /help port: 80 initialDelaySeconds: 15 timeoutSeconds: 1 volumes: - name: data - emptyDir: {} + persistentVolumeClaim: + claimName: gitlab-rails-storage + - name: config + persistentVolumeClaim: + claimName: gitlab-config-storage diff --git a/gitlab/gitlab-storage.yml b/gitlab/gitlab-storage.yml new file mode 100644 index 0000000..c4c1263 --- /dev/null +++ b/gitlab/gitlab-storage.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: gitlab-rails-storage + namespace: gitlab + annotations: + volume.beta.kubernetes.io/storage-class: fast +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 30Gi diff --git a/gitlab/postgresql-deployment.yml b/gitlab/postgresql-deployment.yml index e2ccffa..4bf378e 100644 --- a/gitlab/postgresql-deployment.yml +++ b/gitlab/postgresql-deployment.yml @@ -12,14 +12,14 @@ spec: spec: containers: - name: postgresql - image: sameersbn/postgresql:9.5-3 + image: postgres:9.5.3 imagePullPolicy: Always env: - - name: DB_USER + - name: POSTGRES_USER value: gitlab - - name: DB_PASS + - name: POSTGRES_PASSWORD value: +BP52QIxpT/flVCMpL3KXA== - - name: DB_NAME + - name: POSTGRES_DB value: gitlab_production - name: DB_EXTENSION value: pg_trgm @@ -51,4 +51,5 @@ spec: timeoutSeconds: 1 volumes: - name: data - emptyDir: {} + persistentVolumeClaim: + claimName: gitlab-postgresql-storage diff --git a/gitlab/postgresql-storage.yml b/gitlab/postgresql-storage.yml new file mode 100644 index 0000000..7bf71c2 --- /dev/null +++ b/gitlab/postgresql-storage.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: gitlab-postgresql-storage + namespace: gitlab + annotations: + volume.beta.kubernetes.io/storage-class: fast +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 30Gi diff --git a/gitlab/redis-deployment.yml b/gitlab/redis-deployment.yml index 185788f..f8aa9a6 100644 --- a/gitlab/redis-deployment.yml +++ b/gitlab/redis-deployment.yml @@ -35,4 +35,5 @@ spec: timeoutSeconds: 1 volumes: - name: data - emptyDir: {} + persistentVolumeClaim: + claimName: gitlab-redis-storage diff --git a/gitlab/redis-storage.yml b/gitlab/redis-storage.yml new file mode 100644 index 0000000..5cd4b54 --- /dev/null +++ b/gitlab/redis-storage.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: gitlab-redis-storage + namespace: gitlab + annotations: + volume.beta.kubernetes.io/storage-class: fast +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi diff --git a/gitlab/storage.yml b/gitlab/storage.yml new file mode 100644 index 0000000..0d5724c --- /dev/null +++ b/gitlab/storage.yml @@ -0,0 +1,8 @@ +apiVersion: storage.k8s.io/v1beta1 +kind: StorageClass +metadata: + name: fast + namespace: gitlab +provisioner: kubernetes.io/gce-pd +parameters: + type: pd-ssd diff --git a/ingress/default-backend-deployment.yaml b/ingress/default-backend-deployment.yml similarity index 100% rename from ingress/default-backend-deployment.yaml rename to ingress/default-backend-deployment.yml diff --git a/ingress/default-backend-svc.yaml b/ingress/default-backend-svc.yml similarity index 100% rename from ingress/default-backend-svc.yaml rename to ingress/default-backend-svc.yml