个人名片:
对人间的热爱与歌颂,可抵岁月冗长🌞
Github👨🏻💻:念舒_C.ying
CSDN主页✏️:念舒_C.ying
个人博客🌏 :念舒_C.ying
创建 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
创建以上的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
查看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 80:31467/TCP 9s
通过创建的nodePort访问,通过
:31467在游览器访问:
然后通过 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 ,期待你的关注~💪💪💪