個人名片:
對人間的熱愛與歌頌,可抵歲月冗長??
Github???????:念舒_C.ying
CSDN主頁??:念舒_C.ying
個人博客?? :念舒_C.ying
Kubernetes安裝GitLab
- Step 1: 準備yaml檔案
- Step 2: 創建
- Step 3: 驗證
- Step 4: 獲取賬密
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在游覽器訪問:
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 ,期待你的關注~??????
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/536129.html
標籤:其他
