[admin@k8s-master-01 kubernetes]$ kubectl get all -n ingress-nginx
NAME READY STATUS RESTARTS AGE
pod/ingress-nginx-controller-9v9hf 1/1 Running 6(2d ago) 3d3h
pod/ingress-nginx-controller-f9m4v 1/1 Running 6(2d ago) 3d3h
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ingress-nginx-controller NodePort 10.109.140.92 <none>80:30080/TCP,443:30443/TCP 3d3h
service/ingress-nginx-controller-admission ClusterIP 10.99.115.202 <none>443/TCP 3d3h
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/ingress-nginx-controller 22222 kubernetes.io/os=linux 3d3h
[admin@k8s-master-01 kubernetes]$ kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
nfs-storage (default) nfs-provisioner Delete Immediate false 3d3h
[admin@k8s-master-01 gitlab]$ helm repo add gitlab http://charts.gitlab.io/
[admin@k8s-master-01 gitlab]$ helm search repo gitlab/gitlab --versions |head -n 11
NAME CHART VERSION APP VERSION DESCRIPTION
gitlab/gitlab 9.1.1 v18.1.1 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 9.1.0 v18.1.0 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 9.0.3 v18.0.3 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 9.0.2 v18.0.2 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 9.0.1 v18.0.1 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 9.0.0 v18.0.0 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 8.11.6 v17.11.5 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 8.11.5 v17.11.5 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 8.11.4 v17.11.4 GitLab is the most comprehensive AI-powered Dev...
gitlab/gitlab 8.11.3 v17.11.3 GitLab is the most comprehensive AI-powered Dev...
[admin@k8s-master-01 gitlab]$ helm pull gitlab/gitlab --version 9.1.1
[admin@k8s-master-01 gitlab]$ tar -xvf gitlab-9.1.1.tgz
2. 部署安装
# 部署安装(域名方式)[admin@k8s-master-01 gitlab]$ helm install gitlab ./gitlab -n gitlab --create-namespace \
--set certmanager.install=false \
--set global.image.registry=harbor.test.com/docker-hub-proxy \
--set global.hosts.domain=test.com \
--set global.ingress.configureCertmanager=false \
--set global.ingress.tls.enabled=true \
--set global.ingress.tls.secretName=gitlab-tls \
--set global.minio.enabled=true \
--set global.minio.credentials.secret=minio-gitlab-tls \
--set global.kas.enabled=true \
--set global.kas.tls.enabled=true \
--set global.kas.tls.secretName=kas-gitlab-tls \
--set global.registry.tls.enabled=true \
--set global.registry.tls.secretName=registry-gitlab-tls \
--set global.smtp.enabled=true \
--set global.smtp.address="smtp.qq.com"\
--set global.smtp.port=465\
--set global.smtp.user_name="66666666@qq.com"\
--set global.smtp.password.secret="smtp-password"\
--set global.smtp.password.key=password \
--set global.smtp.domain="qq.com"\
--set global.smtp.authentication="login"\
--set global.smtp.openssl_verify_mode="peer"\
--set global.smtp.pool=true \
--set global.email.from="66666666@qq.com"\
--set global.email.display_name=GitLab \
--set global.email.reply_to="66666666@qq.com"\
--set certmanager-issuer.email="66666666@qq.com"\
--set prometheus.install=false
I0702 09:45:23.243263 44038 warnings.go:110]"Warning: volume \"registry-secrets\" (Projected): overlapping paths: \"httpSecret\" (Secret \"gitlab-registry-httpsecret\") with \"httpSecret\" (Secret \"gitlab-registry-httpsecret\")"
NAME: gitlab
LAST DEPLOYED: Wed Jul 2 09:44:57 2025
NAMESPACE: gitlab
STATUS: deployed
REVISION: 1
NOTES:
=== CRITICAL
The following charts are included for evaluation purposes only. They will not be supported by GitLab Support
for production workloads. Use Cloud Native Hybrid deployments for production. For more information visit
https://docs.gitlab.com/charts/installation/index.html#use-the-reference-architectures.
- PostgreSQL
- Redis
- Gitaly
- MinIO
=== NOTICE
The minimum required version of PostgreSQL is now 14. See https://docs.gitlab.com/charts/installation/upgrade.html formore details.
=== NOTICE
You've installed GitLab Runner without the ability to use 'docker in docker'.
The GitLab Runner chart (gitlab/gitlab-runner) is deployed without the `privileged` flag by default for security purposes. This can be changed by setting `gitlab-runner.runners.privileged` to `true`. Before doing so, please read the GitLab Runner chart's documentation on why we
chose not to enable this by default. See https://docs.gitlab.com/runner/install/kubernetes.html#running-docker-in-docker-containers-with-gitlab-runners
Help us improve the installation experience, let us know how we did with a 1 minute survey:https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=helm&release=18-1
=== WARNING
certmanager:
The configuration key `certmanager.install` has been renamed to `installCertmanager`.
Please update your values. The old value will be removed in GitLab 18.3/chart 9.3
to update the bundled certmanager and to enable schema validation.
# 查看部署详情[admin@k8s-master-01 ~]$ kubectl get all -n gitlab
NAME READY STATUS RESTARTS AGE
pod/gitlab-gitaly-0 1/1 Running 0 118s
pod/gitlab-gitlab-exporter-f5cbbb4fb-xwff4 1/1 Running 0 118s
pod/gitlab-gitlab-runner-755648bb58-4l5zp 1/1 Running 0 118s
pod/gitlab-gitlab-shell-69bc59d659-5tspr 1/1 Running 0 118s
pod/gitlab-gitlab-shell-69bc59d659-8fqwr 1/1 Running 0 103s
pod/gitlab-kas-6446c797f5-nwrvk 1/1 Running 3(95s ago) 118s
pod/gitlab-kas-6446c797f5-tchsz 1/1 Running 2(97s ago) 103s
pod/gitlab-migrations-75b647f-n6wdr 0/1 Completed 1 118s
pod/gitlab-minio-6f68559cdf-k5h6f 1/1 Running 0 118s
pod/gitlab-minio-create-buckets-628cb63-7wxdk 0/1 Completed 0 118s
pod/gitlab-nginx-ingress-controller-558557775c-5rtj4 1/1 Running 0 118s
pod/gitlab-nginx-ingress-controller-558557775c-jcsl7 1/1 Running 0 118s
pod/gitlab-postgresql-0 2/2 Running 0 118s
pod/gitlab-redis-master-0 2/2 Running 0 118s
pod/gitlab-registry-5ff5bc884f-pjl5d 1/1 Running 0 103s
pod/gitlab-registry-5ff5bc884f-pz2pr 1/1 Running 0 118s
pod/gitlab-sidekiq-all-in-1-v2-56d66d94bd-2lh2q 1/1 Running 0 118s
pod/gitlab-toolbox-7bc96fd9d-wmh5k 1/1 Running 0 118s
pod/gitlab-webservice-default-5bddcbbb54-mdgd9 2/2 Running 0 103s
pod/gitlab-webservice-default-5bddcbbb54-p76cg 2/2 Running 0 118s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/gitlab-gitaly ClusterIP None <none>8075/TCP,9236/TCP 118s
service/gitlab-gitlab-exporter ClusterIP 10.96.166.15 <none>9168/TCP 118s
service/gitlab-gitlab-shell ClusterIP 10.100.46.60 <none>22/TCP 118s
service/gitlab-kas ClusterIP 10.109.28.18 <none>8150/TCP,8153/TCP,8154/TCP,8151/TCP 118s
service/gitlab-minio-svc ClusterIP 10.96.169.6 <none>9000/TCP 118s
service/gitlab-nginx-ingress-controller LoadBalancer 10.109.162.118 <pending>80:30381/TCP,443:32308/TCP,22:31564/TCP 118s
service/gitlab-nginx-ingress-controller-metrics ClusterIP 10.97.29.182 <none>10254/TCP 118s
service/gitlab-postgresql ClusterIP 10.104.140.219 <none>5432/TCP 118s
service/gitlab-postgresql-hl ClusterIP None <none>5432/TCP 118s
service/gitlab-postgresql-metrics ClusterIP 10.106.211.210 <none>9187/TCP 118s
service/gitlab-redis-headless ClusterIP None <none>6379/TCP 118s
service/gitlab-redis-master ClusterIP 10.98.184.70 <none>6379/TCP 118s
service/gitlab-redis-metrics ClusterIP 10.108.75.173 <none>9121/TCP 118s
service/gitlab-registry ClusterIP 10.106.17.160 <none>5000/TCP 118s
service/gitlab-webservice-default ClusterIP 10.108.250.92 <none>8080/TCP,8181/TCP,8083/TCP 118s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/gitlab-gitlab-exporter 1/1 11 118s
deployment.apps/gitlab-gitlab-runner 1/1 11 118s
deployment.apps/gitlab-gitlab-shell 2/2 22 118s
deployment.apps/gitlab-kas 2/2 22 118s
deployment.apps/gitlab-minio 1/1 11 118s
deployment.apps/gitlab-nginx-ingress-controller 2/2 22 118s
deployment.apps/gitlab-registry 2/2 22 118s
deployment.apps/gitlab-sidekiq-all-in-1-v2 1/1 11 118s
deployment.apps/gitlab-toolbox 1/1 11 118s
deployment.apps/gitlab-webservice-default 2/2 22 118s
NAME DESIRED CURRENT READY AGE
replicaset.apps/gitlab-gitlab-exporter-f5cbbb4fb 111 118s
replicaset.apps/gitlab-gitlab-runner-755648bb58 111 118s
replicaset.apps/gitlab-gitlab-shell-69bc59d659 222 118s
replicaset.apps/gitlab-kas-6446c797f5 222 118s
replicaset.apps/gitlab-minio-6f68559cdf 111 118s
replicaset.apps/gitlab-nginx-ingress-controller-558557775c 222 118s
replicaset.apps/gitlab-registry-5ff5bc884f 222 118s
replicaset.apps/gitlab-sidekiq-all-in-1-v2-56d66d94bd 111 118s
replicaset.apps/gitlab-toolbox-7bc96fd9d 111 118s
replicaset.apps/gitlab-webservice-default-5bddcbbb54 222 118s
NAME READY AGE
statefulset.apps/gitlab-gitaly 1/1 118s
statefulset.apps/gitlab-postgresql 1/1 118s
statefulset.apps/gitlab-redis-master 1/1 118s
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
horizontalpodautoscaler.autoscaling/gitlab-gitlab-shell Deployment/gitlab-gitlab-shell cpu: <unknown>/100m 2102 118s
horizontalpodautoscaler.autoscaling/gitlab-kas Deployment/gitlab-kas cpu: <unknown>/100m 2102 118s
horizontalpodautoscaler.autoscaling/gitlab-registry Deployment/gitlab-registry cpu: <unknown>/75% 2102 118s
horizontalpodautoscaler.autoscaling/gitlab-sidekiq-all-in-1-v2 Deployment/gitlab-sidekiq-all-in-1-v2 cpu: <unknown>/350m 1101 118s
horizontalpodautoscaler.autoscaling/gitlab-webservice-default Deployment/gitlab-webservice-default cpu: <unknown>/1 2102 118s
NAME STATUS COMPLETIONS DURATION AGE
job.batch/gitlab-migrations-75b647f Complete 1/1 92s 118s
job.batch/gitlab-minio-create-buckets-628cb63 Complete 1/1 10s 118s
[admin@k8s-master-01 ~]$ kubectl get ingress -n gitlab
NAME CLASS HOSTS ADDRESS PORTS AGE
gitlab-kas gitlab-nginx kas.test.com 10.109.140.92 80, 443 2m29s
gitlab-minio gitlab-nginx minio.test.com 10.109.140.92 80, 443 2m29s
gitlab-registry gitlab-nginx registry.test.com 10.109.140.92 80, 443 2m29s
gitlab-webservice-default gitlab-nginx gitlab.test.com 10.109.140.92 80, 443 2m29s
# 步骤1:客户机生成ssh秘钥
C:\Users\changmeidong>ssh-keygen -t rsa -C "window@test.com"
Generating public/private rsa key pair.
Enter fileinwhich to save the key (C:\Users\changmeidong/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\changmeidong/.ssh/id_rsa
Your public key has been saved in C:\Users\changmeidong/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:l2YvquVyQ+op49NNWJalb4LOBZjV6hK+bzc2h9Smcto window@test.com
The key's randomart image is:
+---[RSA 3072]----+
| . |
| . . . |
| + . + |
| + o = . |
| . o *So= |
| o + *+=. |
| * B.*. . |
| = O=%... |
| ..B*XE= |
+----[SHA256]-----+
# 步骤2:将生成的公钥(id_rsa.pub)粘贴到gitlab的ssh key中配置好
# 步骤3:连接测试
C:\Users\changmeidong>ssh -T git@gitlab.test.com -p 31564
The authenticity of host '[gitlab.test.com]:31564 ([192.168.1.202]:31564)' can't be established.
ED25519 key fingerprint is SHA256:hTp2MmGtTJ+4mSaYTezgvHBkEaszuKBfhXyPVqnJSvA.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[gitlab.test.com]:31564'(ED25519) to the list of known hosts.
Welcome to GitLab, @root!
5.3 集群内部与 gitlab 建立连接测试
[admin@k8s-master-01 gitlab]$ kubectl run netshoot --rm -it --image=nicolaka/netshoot -- bash
If you don't see a command prompt, try pressing enter.
netshoot:~# ssh-keygen -t rsa -C "netshoot@test.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase for "/root/.ssh/id_rsa" (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:CLUvbX1CvOmzClNgtTLTvrEfwOJdbmhUGuJ0w5VaLfs netshoot@test.com
The key's randomart image is:
+---[RSA 3072]----+
|.. .o ||.= ++ .||. X Bo+o ||=&.B.o ||= S *..||. B X oE || + * * || + o + ||..o |
+----[SHA256]-----+
# 步骤2:查看秘钥,并将生成的公钥(id_rsa.pub)粘贴到gitlab的ssh key中配置好
netshoot:~# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3Nz...省略....Pcq40uLctUHE= netshoot@test.com
# 步骤3:连接测试
netshoot:~# ssh -T git@gitlab.test.com
The authenticity of host'gitlab.test.com (192.168.100.2)' can't be established.
ED25519 key fingerprint is SHA256:hTp2MmGtTJ+4mSaYTezgvHBkEaszuKBfhXyPVqnJSvA.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.test.com' (ED25519) to the list of known hosts.
Welcome to GitLab, @root!
6. 出现的问题
6.1 无法通过 git@地址 进行 clone,一直提示输入密码,
# 问题1:通过页面提供的地址,无法clone,一直提示输入密码,这是因为clone默认走的是ssh,也就是22端口,无法直接访问到容器内[admin@k8s-master-01 .ssh]$ git clone git@gitlab.test.com:root/spring-boot-project.git
正克隆到 'spring-boot-project'...
The authenticity of host'gitlab.test.com (192.168.100.2)' can't be established.
ECDSA key fingerprint is SHA256:sU3lWjJTu6FBcbkBuGjPc7+EktOltcub9uFLDBMWOAU.
ECDSA key fingerprint is MD5:f8:2e:ab:76:53:46:02:d9:f3:3b:2a:3b:94:e9:30:92.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.test.com,192.168.100.2' (ECDSA) to the list of known hosts.
git@gitlab.test.com's password:
Permission denied, please try again.
git@gitlab.test.com's password:
Permission denied, please try again.
git@gitlab.test.com's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
# 问题1 解决方式-使用 SSH 配置文件指定ssh端口,当然,如果你按照我的配置暴露端口增加externalIPs,则不会出现这个问题[admin@k8s-master-01 .ssh]$ vim ~/.ssh/config
Host gitlab.test.com
HostName gitlab.test.com
Port 31564# 你的 NodePort
User git[admin@k8s-master-01 .ssh]$ chmod700 ~/.ssh/config
[admin@k8s-master-01 .ssh]$ git clone git@gitlab.test.com:root/spring-boot-project.git
正克隆到 'spring-boot-project'...
remote: Enumerating objects: 28, done.
remote: Total 28(delta 0), reused 0(delta 0), pack-reused 28(from 1)
接收对象中: 100% (28/28), 13.91 KiB |0 bytes/s, done.
处理 delta 中: 100% (5/5), done.