-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from m3-learning/kube-deploy
Kube deploy
- Loading branch information
Showing
92 changed files
with
17,256 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,7 @@ jobs: | |
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: pages/pages/_build/html | ||
publish_dir: pages/pages/_build/html | ||
|
||
- name: pre-commit | ||
uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,4 +166,4 @@ cython_debug/ | |
.DS_STORE | ||
|
||
# Ignore all Builds | ||
_build | ||
_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
# K8_senior_design | ||
# K8_senior_design | ||
|
||
## Pre Commit | ||
This project utilizes pre-commit which ensures proper formatting convention. | ||
|
||
Initialize pre-commit: | ||
``` | ||
pip install pre-commit | ||
``` | ||
|
||
Install and run pre-commit on all files | ||
``` | ||
pre-commit install | ||
pre-commit run --all-files | ||
``` | ||
|
||
Stage and Apply pre-commit changes | ||
``` | ||
git add . | ||
git commit -m "Lint files with pre-commit" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Gitlab install guide | ||
The purpose of this project is to spinup a gitlab service for kubernetes utilizing local storage provisioners | ||
|
||
## Disclaimer | ||
The installation procedure gives you a sample-working production environment for GitLab. For best practices, please ensure that proper methods are used to secure each service. For any values specified in the configurations, they can be modified to the operator's specs. | ||
|
||
## Dependencies | ||
* GitLab Helm chart dependency | ||
* Postgresql Helm chart dependency | ||
* Redis Helm chart dependency | ||
* Paths specified in volume should be satisfied across hosts | ||
|
||
## Order of install operation | ||
Production environments specified on GitLab | ||
|
||
## Install Prerequiste | ||
You must satisfy the `storage-class` requirements that may not be created already. To do this, supply the following command: | ||
``` | ||
kubectl apply -f storage.yml | ||
``` | ||
|
||
Then you must allocate volumes required for postgresql: | ||
``` | ||
kubectl apply -f postgresql-volume.yml | ||
``` | ||
|
||
Force patch the claim to the volume: | ||
``` | ||
kubectl patch pvc data-my-postgresql-0 -p '{"spec":{"volumeName":"example-pv"}}' | ||
``` | ||
|
||
This creates the storageclass necessary for the GitLab cluster and dependency services to use. Then, proceed to create the postgresql PVC. This is required since automated bounding does not happen for non-dynamic provisioners: | ||
``` | ||
kubectl apply -f patch-postgresql-pvc-claim.yml | ||
``` | ||
|
||
Now, postgresql can be deployed with the values.yml file supplied. First, the configurations are set such that it does not allow any dynamic provisioners to be set by default. This is shown for entries that consist of `"-"`. Then, postgresql is forced to use the `local-storage` storage class that was previously deployed in `storage.yml`. The most important variable set is that `persistance.existingClaim` is set to the volume claim set earlier. This can be applied by: | ||
``` | ||
helm install postgresql bitnami/postgresql -f postgresql-values.yml | ||
``` | ||
|
||
The next dependency required is redis, which similar to the previous deployment of postgresql, can be done. Note, the claim must be created for redis, and the `persistance.existingClaim` must also be set alongside disabling any dynamic provisioners. This is already supplied within the `patch-redis-pvc-claim.yml`. The following can be used to spin up a redis service: | ||
``` | ||
kubectl apply -f redis-storage.yml | ||
kubectl apply -f redis-volume.yml | ||
kubectl apply -f redis-pvc-claim.yml | ||
kubectl patch pvc data-my-redis-0 -p '{"spec":{"volumeName":"example-pv-redis"}}' | ||
helm install redis bitnami/redis -f redis-values.yml | ||
``` | ||
|
||
Now, we have setup the required dependencies for a bare minimum for a production-ready environment for GitLab. | ||
|
||
## Prerequisite installs for GitLab | ||
Patch the core storage class for GitLab | ||
``` | ||
kubectl patch storageclass CUSTOM_STORAGE_CLASS_NAME -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | ||
``` | ||
|
||
Create persistence storageclass, volumes, and claims for Gitaly, MinIO, and Redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-my-gitaly-0 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: local-storage-gitaly # Add your storage class if not specified | ||
resources: | ||
requests: | ||
storage: 100Gi # Adjust the storage capacity as needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: local-storage-gitaly | ||
provisioner: kubernetes.io/no-provisioner | ||
volumeBindingMode: WaitForFirstConsumer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: example-pv-gitaly | ||
spec: | ||
capacity: | ||
storage: 100Gi | ||
volumeMode: Filesystem | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
storageClassName: local-storage-gitaly | ||
local: | ||
path: /mnt/disks/ssd3 | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- node1 | ||
- node2 | ||
- node3 |
11 changes: 11 additions & 0 deletions
11
cloudlab/gitlab/gitlab-toolbox/gitlab-toolbox-pvc-claim.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-my-gitlab-toolbox-0 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: local-storage-gitlab-toolbox # Add your storage class if not specified | ||
resources: | ||
requests: | ||
storage: 100Gi # Adjust the storage capacity as needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: local-storage-gitlab-toolbox | ||
provisioner: kubernetes.io/no-provisioner | ||
volumeBindingMode: WaitForFirstConsumer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: example-pv-gitlab-toolbox | ||
spec: | ||
capacity: | ||
storage: 100Gi | ||
volumeMode: Filesystem | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
storageClassName: local-storage-gitlab-toolbox | ||
local: | ||
path: /mnt/disks/ssd6 | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- node1 | ||
- node2 | ||
- node3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-my-gitlab-0 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: local-storage-gitlab # Add your storage class if not specified | ||
resources: | ||
requests: | ||
storage: 100Gi # Adjust the storage capacity as needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: local-storage-gitlab | ||
provisioner: kubernetes.io/no-provisioner | ||
volumeBindingMode: WaitForFirstConsumer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
global: | ||
edition: ee | ||
gitlab: | ||
psql: | ||
host: | ||
password: | ||
key: | ||
secret: | ||
redis: | ||
host: | ||
auth: | ||
secret: | ||
key: | ||
hosts: | ||
domain: example.com | ||
externalIP: | ||
|
||
redis: | ||
install: false | ||
|
||
postgresql: | ||
install: false | ||
|
||
certmanager-issuer: | ||
email: [email protected] | ||
|
||
minio: | ||
persistence: | ||
storageClass: | ||
volumeName: | ||
|
||
gitlab: | ||
toolbox: | ||
persistence: | ||
storageClass: | ||
volumeName: | ||
backups: | ||
cron: | ||
enabled: true | ||
gitaly: | ||
persistence: | ||
storageClass: | ||
volumeName: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: example-pv-gitlab | ||
spec: | ||
capacity: | ||
storage: 100Gi | ||
volumeMode: Filesystem | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
storageClassName: local-storage-gitlab | ||
local: | ||
path: /mnt/disks/ssd6 | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- node1 | ||
- node2 | ||
- node3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-my-minio-0 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: local-storage-minio # Add your storage class if not specified | ||
resources: | ||
requests: | ||
storage: 100Gi # Adjust the storage capacity as needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: local-storage-minio | ||
provisioner: kubernetes.io/no-provisioner | ||
volumeBindingMode: WaitForFirstConsumer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: example-pv-minio | ||
spec: | ||
capacity: | ||
storage: 100Gi | ||
volumeMode: Filesystem | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
storageClassName: local-storage-minio | ||
local: | ||
path: /mnt/disks/ssd4 | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- node1 | ||
- node2 | ||
- node3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-my-postgresql-0 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: local-storage # Add your storage class if not specified | ||
resources: | ||
requests: | ||
storage: 100Gi # Adjust the storage capacity as needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: local-storage | ||
provisioner: kubernetes.io/no-provisioner | ||
volumeBindingMode: WaitForFirstConsumer |
Oops, something went wrong.