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
相关推荐
人间凡尔赛11 分钟前
Kubernetes十周年:从Cloud Native到AI Native的架构范式跃迁
后端·云原生·架构
Chasing__Dreams37 分钟前
Go 语言学习笔记
云原生·容器·kubernetes
宵时待雨1 小时前
linux笔记归纳14:Socket编程TCP
linux·服务器·网络·笔记·tcp/ip
逐米时代2 小时前
工厂数字化规划:BIM与仿真让方案可验证
大数据·网络·人工智能
聚搜云——JuSouClouD2 小时前
深圳阿里云代理商:K8s Pod OOM智能排查修复指南
阿里云·kubernetes·云计算
caimouse2 小时前
Winsock 用户态库 (ws2_32.dll) 详细分析
网络
明王明王2 小时前
从零搭建一个单节点 K8S 可观测实验室(六):安装 Tempo + OpenTelemetry,构建链路追踪链路
云原生·容器·kubernetes
wsad05322 小时前
Docker 网络故障排查记:当 bridge 模式失效时,host 模式如何救场
运维·docker·容器
云边云科技_云网融合2 小时前
工业制造多厂区、供应链远程数据传输网络如何优化?
运维·服务器·网络
张毅2004-10-102 小时前
docker详解:安装docker,docker架构,docker镜像、容器、网络、存储,容器监控,容器日志,综合实验
linux·运维·docker·云原生·云计算