k8s部署gitlab最新版并初始化和登录
1. 准备工作
1.1 创建nfs共享目录
在nfs服务器创建共享目录,部署的gitlib使用共享目录来进行持久化,这样不管在哪个节点运行gitlib都没有关系。
# mkdir -p /home/k8s-nfs/gitlab/config
# mkdir -p /home/k8s-nfs/gitlab/logs
# mkdir -p /home/k8s-nfs/gitlab/data
1.2 添加到共享
vim /etc/exports
/home/k8s-nfs/gitlab/config 192.168.17.0/8(rw,no_root_squash)
/home/k8s-nfs/gitlab/logs 192.168.17.0/8(rw,no_root_squash)
/home/k8s-nfs/gitlab/data 192.168.17.0/8(rw,no_root_squash)
1.3 执行更新
# service nfs restart
或者
# exportfs -r
2. 部署gitlib
2.1 准备部署文件(gitlib-deploy.yaml)
apiVersion: v1
kind: Service
metadata:
name: gitlab
spec:
type: NodePort
ports:
# Port上的映射端口
- port: 443
targetPort: 443
name: gitlab443