k8s-gitlab 配置清单

Gitlab服务构成
    Nginx:静态web服务器。
    gitlab-shell:用于处理Git命令和修改authorized keys列表。
    gitlab-workhorse: 轻量级的反向代理服务器。
    logrotate:日志文件管理工具。
    postgresql:数据库。
    redis:缓存数据库。
    sidekiq:用于在后台执行队列任务(异步执行)。
    unicorn:An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的。

1.安装nfs服务器,基于PV作为后端存储
[root@localhost7B ]# cat /etc/exports
/data/k8sdata *(rw,no_root_squash)


#创建项目目录
[root@localhost7B ~]# mkdir /data/k8sdata/magedu/gitlab-datadir/data

[root@localhost7B ~]# mkdir /data/k8sdata/magedu/gitlab-datadir/logs

[root@localhost7B ~]# mkdir /data/k8sdata/magedu/gitlab-datadir/config

[root@localhost7B ]# systemctl restart nfs-server.service




配置清单yaml文件。本镜像包括了gitlab的服务成员。

[root@localhost7C k8s]# cat gitlab/gitlab.yaml apiVersion: v1 kind: Service metadata: name: gitlab spec: type: NodePort ports: # Port上的映射端口 - port: 443 targetPort: 443 name: gitlab443 - port: 80 targetPort: 80 name: gitlab80 nodePort: 30005 - port: 22 targetPort: 22 name: gitlab22 selector: app: gitlab --- apiVersion: apps/v1 kind: Deployment metadata: name: gitlab spec: selector: matchLabels: app: gitlab revisionHistoryLimit: 2 template: metadata: labels: app: gitlab spec: containers: # 应用的镜像- image: gitlab/gitlab-ce name: gitlab imagePullPolicy: IfNotPresent # 应用的内部端口 ports: - containerPort: 443 name: gitlab443 - containerPort: 80 name: gitlab80 - containerPort: 22 name: gitlab22 volumeMounts: # gitlab持久化 - name: gitlab-config mountPath: /etc/gitlab - name: gitlab-logs mountPath: /var/log/gitlab - name: gitlab-data mountPath: /var/opt/gitlab imagePullSecrets: - name: devops-repo volumes: # 使用nfs互联网存储 - name: gitlab-config nfs: server: 192.168.80.110 path: /data/k8sdata/magedu/gitlab-datadir/config - name: gitlab-logs nfs: server: 192.168.80.110 path: /data/k8sdata/magedu/gitlab-datadir/logs - name: gitlab-data nfs: server: 192.168.80.110 path: /data/k8sdata/magedu/gitlab-datadir/data

 

posted @ 2023-04-14 10:16  yuanbangchen  阅读(54)  评论(0编辑  收藏  举报