• Kubernetes安装GitLab


    个人名片:
    对人间的热爱与歌颂,可抵岁月冗长🌞
    Github👨🏻‍💻:念舒_C.ying
    CSDN主页✏️:念舒_C.ying
    个人博客🌏 :念舒_C.ying

    Step 1: 准备yaml文件

    创建 gitlab.yaml

    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: gitlab
      namespace: my-space
    spec:
      serviceName: gitlab
      replicas: 1
      selector:
        matchLabels:
          app: gitlab
      template:
        metadata:
          labels:
            app: gitlab
        spec:
          containers:
            - name: gitlab
              image: 'gitlab/gitlab-ce:15.2.3-ce.0'
              ports:
                - containerPort: 80
                  name: web
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    创建外网访问 gitlab-nodeport.yaml

    apiVersion: v1
    kind: Service
    metadata:
      name: gitlab-svc
      namespace: my-space
    spec:
      type: NodePort
      selector:
        app: gitlab
      ports:
        - port: 80
          targetPort: 80
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    Step 2: 创建

    创建以上的yaml文件

    kubectl apply -f gitlab.yaml
    kubectl apply -f gitlab-nodeport.yaml
    
    • 1
    • 2

    或者用官方kubebiz的yaml源:

    kubectl apply -f https://www.kubebiz.com/raw/KubeBiz/GitLab/latest/all
    
    • 1

    Step 3: 验证

    查看pod状态

    kubectl get pods -n my-space
    
    
    NAME                                  READY   STATUS    RESTARTS      AGE
    gitlab-0                              1/1     Running   0             3m
    
    • 1
    • 2
    • 3
    • 4
    • 5

    等待所有pod的状态为Running

    查看服务:

    kubectl get svc -n my-space
    NAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                          AGE
    gitlab-svc       NodePort    10.109.184.151           80:31467/TCP                     9s
    
    • 1
    • 2
    • 3

    通过创建的nodePort访问,通过 :31467在游览器访问:

    gitlab

    Step 4: 获取账密

    然后通过 kubectl exec 获取 root 初始化密码

    kubectl exec gitlab-0 -n my-space -- cat /etc/gitlab/initial_root_password
    
    • 1

    返回:

    # WARNING: This value is valid only in the following conditions
    #          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
    #          2. Password hasn't been changed manually, either via UI or via command line.
    #
    #          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
    
    Password: XEsdaYT8dpyg10FsYq5BbQuqHsS2yoGeeNuqwwIzCM4=
    
    # NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    密码

    XEsdaYT8dpyg10FsYq5BbQuqHsS2yoGeeNuqwwIzCM4=
    
    • 1

    完成。

    期待下次的分享,别忘了三连支持博主呀~
    我是 念舒_C.ying ,期待你的关注~💪💪💪

  • 相关阅读:
    Redhat(5)-ansible-loop-handler-errors-tags
    SpringCloud -Ribbon
    什么是IO
    SSM+线上诊疗系统 毕业设计-附源码161711
    git配置 拉取github项目
    sulfo-CY3(Cyanine3) DBCO,磺酸基-花青素CY5二苯并环辛炔,1782950-79-1
    一个技术混子参加《 2022 谷歌开发者大会》的一日游记
    详解python淘宝秒杀抢购脚本程序实现
    2023,软件测试人的未来在哪里?
    【操作系统】文件系统
  • 原文地址:https://blog.csdn.net/qq_52716296/article/details/127753080