概要
kubernetesにトライアル構成のgitlabをインストールしてみました。事前にPVを作成しておかないとダメなことがわかりました。また、TKGmでtanzuのRepogitryからCert-Managerをインストールした場合でもインストールできるかを試してみました。
環境
| # | ソフトウェア | バージョン |
| 1 | Rocky Linux | 9.2(5.14.0-162.6.1.el9_1.x86_64) |
| 2 | kubernetes | 1.26.5 |
| 3 | containerd.io | 1.6.21-3.1 |
| 4 | gitlab | 16.0.1 |
前提
- kubenetesはMasterノード 1台、Workerノード1台構成となります。
- CNIはAntreaを使用しています。
- PVはNFSサーバに作成しています。インストール手順を省略します。
手順
OSS
NFSサーバのディレクトリ作成
PVで使う場合、NFSサーバのパーミッションを考慮する必要があります。今回は、777にしています。
cd /data/nfs/ mkdir git-minio mkdir git-postgre mkdir git-prometheus mkdir git-redis mkdir git-repo chmod 777 git-minio chmod 777 git-postgre chmod 777 git-prometheus chmod 777 git-redis chmod 777 git-repo
Persistent Volumeの作成
以下のyamlファイルを使って「kubectl apply -f」でPVを作成する。
apiVersion: v1
kind: PersistentVolume
metadata:
name: git-postgre
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
nfs:
server: 192.168.222.153
path: /data/nfs/git-postgre
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: git-minio
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
nfs:
server: 192.168.222.153
path: /data/nfs/git-minio
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: git-prometheus
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
nfs:
server: 192.168.222.153
path: /data/nfs/git-prometheus
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: git-redis
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
nfs:
server: 192.168.222.153
path: /data/nfs/git-redis
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: git-repo
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
nfs:
server: 192.168.222.153
path: /data/nfs/git-repo
gitlabのインストール
helm repo add gitlab https://charts.gitlab.io/ helm repo update helm upgrade --install gitlab gitlab/gitlab \ --timeout 600s \ --set global.hosts.domain=example.com \ --set global.hosts.externalIP=192.168.222.180 \ --set certmanager-issuer.email=me@example.com \ --set postgresql.image.tag=13.6.0
rootのパスワード確認
kubectl get secret gitlab-gitlab-initial-root-password -ojsonpath='{.data.password}' | base64 --decode ; echo
hostsの修正
gitlabへの接続はingressを使うため、接続には、名前解決が必要です。今回は「gitlab.example.com」を登録しています。
TKGm
gitlabのchartをダウンロード
helm pull gitlab/gitlab
chartファイルの展開
tar -zxvf gitlab-7.0.1.tgz
values.yamlの修正
vi ./gitlab/values.yaml
※以下記述のinstall:をfalseに変更する。
~省略~
## Installation & configuration of jetstack/cert-manager
## See requirements.yaml for current version
certmanager:
installCRDs: true
nameOverride: certmanager
# Install cert-manager chart. Set to false if you already have cert-manager
# installed or if you are not using cert-manager.
install: false
# Other cert-manager configurations from upstream
# See https://github.com/jetstack/cert-manager/blob/master/deploy/charts/cert-manager/README#configuration
rbac:
create: true
~省略~
gitlabのインストール
helm upgrade --install gitlab ./gitlab \ --timeout 600s \ --set global.hosts.domain=example.com \ --set global.hosts.externalIP=192.168.222.180 \ --set certmanager-issuer.email=me@example.com \ --set postgresql.image.tag=13.6.0

コメント