个人名片:
对人间的热爱与歌颂,可抵岁月冗长🌞
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

创建外网访问 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

Step 2: 创建

创建以上的yaml文件

kubectl apply -f gitlab.yaml
kubectl apply -f gitlab-nodeport.yaml

或者用官方kubebiz的yaml源:

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

Step 3: 验证

查看pod状态

kubectl get pods -n my-space


NAME                                  READY   STATUS    RESTARTS      AGE
gitlab-0                              1/1     Running   0             3m

等待所有pod的状态为Running

查看服务:

kubectl get svc -n my-space
NAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                          AGE
gitlab-svc       NodePort    10.109.184.151   <none>        80:31467/TCP                     9s

通过创建的nodePort访问,通过 <nodepot-ip>:31467在游览器访问:

gitlab

Step 4: 获取账密

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

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

返回:

# 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.

密码

XEsdaYT8dpyg10FsYq5BbQuqHsS2yoGeeNuqwwIzCM4=

完成。

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

原文地址:http://www.cnblogs.com/nianshu/p/16905101.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性