13、gitlab

13、gitlab

4c8g、100g

docker安装gitlab(使用k8s的ingress暴露)

版本:https://gitlab.com/gitlab-org/gitlab-foss/-/tags?sort=version_desc

官方docker仓库:https://hub.docker.com/r/gitlab/gitlab-ce/tags

shell 复制代码
docker pull gitlab/gitlab-ce:16.8.0-ce.0

docker pull ccr.ccs.tencentyun.com/huanghuanhui/gitlab:16.8.0-ce.0
shell 复制代码
cd && mkdir gitlab && cd gitlab && export GITLAB_HOME=/root/gitlab
shell 复制代码
docker run -d \
--name gitlab \
--hostname 'gitlab.huanghuanhui.cloud' \
--restart always \
--privileged=true \
-p 9797:80 \
-v $GITLAB_HOME/config:/etc/gitlab \
-v $GITLAB_HOME/logs:/var/log/gitlab \
-v $GITLAB_HOME/data:/var/opt/gitlab \
-e TIME_ZONE='Asia/Shanghai' \
ccr.ccs.tencentyun.com/huanghuanhui/gitlab:16.8.0-ce.0

初始化默认密码:

shell 复制代码
docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password

使用k8s的ingress暴露

shell 复制代码
mkdir -p ~/gitlab-yml

kubectl create ns gitlab
shell 复制代码
cat > ~/gitlab-yml/gitlab-endpoints.yml << 'EOF'
apiVersion: v1
kind: Endpoints
metadata:
  name: gitlab-service
  namespace: gitlab
subsets:
  - addresses:
      - ip: 192.168.1.200
    ports:
      - port: 9797
EOF
shell 复制代码
kubectl apply -f ~/gitlab-yml/gitlab-endpoints.yml
shell 复制代码
cat > ~/gitlab-yml/gitlab-Service.yml << 'EOF'
apiVersion: v1
kind: Service
metadata:
  name: gitlab-service
  namespace: gitlab
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9797
EOF
shell 复制代码
kubectl apply -f ~/gitlab-yml/gitlab-Service.yml
shell 复制代码
cat > ~/gitlab-yml/gitlab-Ingress.yml << 'EOF'
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: gitlab-ingress
  namespace: gitlab
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: 'true'
    nginx.ingress.kubernetes.io/proxy-body-size: '4G'
spec:
  ingressClassName: nginx
  rules:
  - host: gitlab.huanghuanhui.cloud
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: gitlab-service
            port:
              number: 80

  tls:
  - hosts:
    - gitlab.huanghuanhui.cloud
    secretName: gitlab-ingress-tls
EOF
shell 复制代码
kubectl create secret -n gitlab \
tls gitlab-ingress-tls \
--key=/root/ssl/huanghuanhui.cloud.key \
--cert=/root/ssl/huanghuanhui.cloud.crt
shell 复制代码
kubectl apply -f ~/gitlab-yml/gitlab-Ingress.yml

访问地址:gitlab.huanghuanhui.cloud

https://gitlab.huanghuanhui.cloud/admin/users/root/edit

设置账号密码为:root、huanghuanhui@2024

计划任务备份
shell 复制代码
[root@gitlab ~]# crontab -l
0 0 * * * sync && echo 3 > /proc/sys/vm/drop_caches
0 0 * * * docker exec -t gitlab gitlab-backup create
相关推荐
OpsEye5 分钟前
监控 100 问(三):监控告警触发后如何快速定位与解决问题
运维·网络·it运维·it·监控·监控系统
L16247633 分钟前
Docker 安装部署全流程使用指南(Linux 通用版)
linux·docker·容器
cngm11039 分钟前
记录两个网卡同时访问两个网段的调试方法route print
服务器·网络·windows
Mr. Cao code44 分钟前
MySQL数据卷实战:持久化存储秘籍
数据库·mysql·docker·容器
Full Stack Developme1 小时前
达梦(DM8)基于 LBS(位置服务)教程
服务器·网络·数据库
捷米研发三部1 小时前
CC-LINK IE FB转CAN协议转换网关实现三菱PLC与仪表通讯在农业机械的应用案例
网络
桂花树下的猫1 小时前
ubuntu20.04上docker部署
运维·docker·容器
自不量力的A同学1 小时前
Docker 29.1.4
运维·docker·容器
Arwen3031 小时前
如何消除APP、软件的不安全下载提示?怎样快速申请代码签名证书?
网络·网络协议·tcp/ip·安全·php·ssl
科技块儿1 小时前
如何通过部署IP离线库,实现批量、高速、无网络依赖的IP查询能力?
网络·网络协议·tcp/ip