在Kubernetes部署GitLab

在Kubernetes部署GitLab 前置条件
已安装Helm工具
已部署NFS自动创建PVC
使用HELM安装

[root@k8s-master01 ~]# helm repo add gitlab https://charts.gitlab.io/ "gitlab" has been added to your repositories[root@k8s-master01 ~]# helm repo update Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "gitlab" chart repository ...Successfully got an update from the "cilium" chart repository Update Complete. ?Happy Helming!?[root@k8s-master01 ~]# helm upgrade --install gitlab gitlab/gitlab \ --timeout 600s \ --set global.hosts.domain=git.oiox.cn \ --set global.hosts.externalIP=192.168.1.61 \ --set certmanager-issuer.email=cby@chenby.cn NAME: gitlab LAST DEPLOYED: Mon Sep 12 19:49:30 2022 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: === NOTICE The minimum required version of PostgreSQL is now 12. See https://gitlab.com/gitlab-org/charts/gitlab/-/blob/master/doc/installation/upgrade.md for more 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=15-3=== NOTICE The in-chart NGINX Ingress Controller has the following requirements: - Kubernetes version must be 1.19 or newer. - Ingress objects must be in group/version `networking.k8s.io/v1`. [root@k8s-master01 ~]#

查看POD情况
[root@k8s-master01 ~]# kubectl get pod -A NAMESPACENAMEREADYSTATUSRESTARTSAGE cilium-monitoringgrafana-59957b9549-6zzqh1/1Running1 (6m28s ago)8h cilium-monitoringprometheus-7c8c9684bb-4v9cl1/1Running1 (4m49s ago)8h defaultchenby-75b5d7fbfb-7zjsr1/1Running1 (6m15s ago)35h defaultchenby-75b5d7fbfb-hbvr81/1Running1 (5m27s ago)35h defaultchenby-75b5d7fbfb-ppbzg1/1Running1 (5m57s ago)35h defaultcm-acme-http-solver-8b6lg1/1Running1 (4m49s ago)11m defaultcm-acme-http-solver-9sd7r1/1Running1 (4m49s ago)11m defaultcm-acme-http-solver-tx5x21/1Running1 (5m27s ago)11m defaultcm-acme-http-solver-w74zd1/1Running1 (4m49s ago)11m defaultecho-a-6799dff547-pnx6w1/1Running1 (6m28s ago)8h defaultecho-b-fc47b659c-4bdg91/1Running1 (4m49s ago)8h defaultecho-b-host-67fcfd59b7-28r9s1/1Running1 (4m49s ago)8h defaultgitlab-certmanager-7cb7797848-fgdff1/1Running1 (5m27s ago)12m defaultgitlab-certmanager-cainjector-5968cb88f9-qw4d71/1Running2 (5m57s ago)12m defaultgitlab-certmanager-webhook-797bcff548-t266p1/1Running1 (6m15s ago)12m defaultgitlab-gitaly-01/1Running1 (6m28s ago)12m defaultgitlab-gitlab-exporter-58fc5779d7-lbl4s1/1Running1 (5m27s ago)12m defaultgitlab-gitlab-runner-5484688b78-d5gmt0/1Running3 (2m8s ago)12m defaultgitlab-gitlab-shell-7578c56d55-p5fvp1/1Running1 (5m27s ago)12m defaultgitlab-gitlab-shell-7578c56d55-vzbrb1/1Running1 (4m49s ago)12m defaultgitlab-issuer-1-sw7nm0/1Completed012m defaultgitlab-kas-85f677867b-sjxqv1/1Running1 (4m49s ago)12m defaultgitlab-kas-85f677867b-wwlsl1/1Running1 (6m28s ago)12m defaultgitlab-migrations-1-hpsc80/1Completed212m defaultgitlab-minio-74467697bb-76xcb1/1Running1 (4m49s ago)12m defaultgitlab-minio-create-buckets-1-nwzh20/1Completed012m defaultgitlab-nginx-ingress-controller-77589fdd6f-7rk5f1/1Running1 (5m27s ago)12m defaultgitlab-nginx-ingress-controller-77589fdd6f-lk96x1/1Running1 (4m49s ago)12m defaultgitlab-postgresql-02/2Running2 (5m27s ago)12m defaultgitlab-prometheus-server-6bf4fffc55-ww59q2/2Running2 (6m14s ago)12m defaultgitlab-redis-master-02/2Running2 (4m49s ago)12m defaultgitlab-registry-54899b8c96-gkmm21/1Running1 (5m27s ago)12m defaultgitlab-registry-54899b8c96-pzxcd1/1Running1 (5m57s ago)12m defaultgitlab-sidekiq-all-in-1-v2-64cbbc8cd8-4pmm91/1Running1 (5m57s ago)12m defaultgitlab-sidekiq-all-in-1-v2-64cbbc8cd8-fr2wn1/1Running081s defaultgitlab-sidekiq-all-in-1-v2-64cbbc8cd8-sx8b61/1Running081s defaultgitlab-toolbox-746c98d8f6-cxwl91/1Running1 (5m27s ago)12m defaultgitlab-webservice-default-6998494449-9hrtc2/2Running1 (6m28s ago)12m defaultgitlab-webservice-default-6998494449-kdbbq2/2Running2 (6m14s ago)12m defaulthost-to-b-multi-node-clusterip-69c57975d6-z4j2z1/1Running3 (4m6s ago)8h defaulthost-to-b-multi-node-headless-865899f7bb-frrmc1/1Running2 (4m16s ago)8h defaultnfs-client-provisioner-665598d599-4xwmf1/1Running3 (5m57s ago)52m defaultpod-to-a-allowed-cnp-5f9d7d4b9d-hcd8x1/1Running4 (3m54s ago)8h defaultpod-to-a-denied-cnp-65cc5ff97b-2rzb81/1Running1 (6m28s ago)8h defaultpod-to-a-dfc64f564-p7xcn1/1Running3 (4m6s ago)8h defaultpod-to-b-intra-node-nodeport-677868746b-trk2l1/1Running1 (4m49s ago)8h defaultpod-to-b-multi-node-clusterip-76bbbc677b-knfq21/1Running2 (4m2s ago)8h defaultpod-to-b-multi-node-headless-698c6579fd-mmvd71/1Running2 (4m48s ago)8h defaultpod-to-b-multi-node-nodeport-5dc4b8cfd6-8dxmz1/1Running2 (4m48s ago)8h defaultpod-to-external-1111-8459965778-pjt9b1/1Running13 (5m57s ago)8h defaultpod-to-external-fqdn-allow-google-cnp-64df9fb89b-l9l4q1/1Running15 (4m39s ago)8h kube-systemcilium-7rfj61/1Running1 (5m27s ago)8h kube-systemcilium-d4cch1/1Running1 (6m28s ago)8h kube-systemcilium-h5x8r1/1Running1 (5m57s ago)8h kube-systemcilium-operator-5dbddb6dbf-flpl51/1Running1 (6m28s ago)8h kube-systemcilium-operator-5dbddb6dbf-gcznc1/1Running2 (4m49s ago)8h kube-systemcilium-t2xlz1/1Running1 (4m49s ago)8h kube-systemcilium-z65z71/1Running1 (6m15s ago)8h kube-systemcoredns-665475b9f8-jkqn81/1Running2 (4m49s ago)44h kube-systemhubble-relay-59d8575-9pl9z1/1Running1 (6m28s ago)8h kube-systemhubble-ui-64d4995d57-nsv9j2/2Running2 (6m28s ago)8h kube-systemmetrics-server-776f58c94b-c6zgs1/1Running2 (6m14s ago)45h [root@k8s-master01 ~]#

查看INGRESS情况
[root@k8s-master01 ~]# kubectlget svc -A | grep ingress defaultgitlab-nginx-ingress-controllerLoadBalancer10.111.0.14880:32002/TCP,443:31390/TCP,22:30887/TCP26m defaultgitlab-nginx-ingress-controller-metricsClusterIP10.104.165.19210254/TCP26m# 修改为NodePort [root@k8s-master01 ~]# kubectledit svc gitlab-nginx-ingress-controller service/gitlab-nginx-ingress-controller edited [root@k8s-master01 ~]# [root@k8s-master01 ~]# kubectlget svc -A | grep ingress defaultgitlab-nginx-ingress-controllerNodePort10.111.0.14880:32002/TCP,443:31390/TCP,22:30887/TCP26m defaultgitlab-nginx-ingress-controller-metricsClusterIP10.104.165.19210254/TCP26m [root@k8s-master01 ~]# [root@k8s-master01 ~]# # 查看有哪些域名 [root@k8s-master01 ~]# kubectlget ingress NAMECLASSHOSTSADDRESSPORTSAGE cm-acme-http-solver-84tqlgitlab-nginxminio.git.oiox.cn10.111.0.1488025m cm-acme-http-solver-c4n6sgitlab-nginxkas.git.oiox.cn10.111.0.1488025m cm-acme-http-solver-vwn4sgitlab-nginxgitlab.git.oiox.cn10.111.0.1488025m cm-acme-http-solver-zccvmgitlab-nginxregistry.git.oiox.cn10.111.0.1488025m gitlab-kasgitlab-nginxkas.git.oiox.cn10.111.0.14880, 44327m gitlab-miniogitlab-nginxminio.git.oiox.cn10.111.0.14880, 44327m gitlab-registrygitlab-nginxregistry.git.oiox.cn10.111.0.14880, 44327m gitlab-webservice-defaultgitlab-nginxgitlab.git.oiox.cn10.111.0.14880, 44327m [root@k8s-master01 ~]#

本地写入域名
[root@k8s-master01 ~]# cat /etc/hosts 127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1localhost localhost.localdomain localhost6 localhost6.localdomain6# 没有IPv6选择不配置即可 2409:8a10:9e10:8700::10 k8s-master01 2409:8a10:9e10:8700::20 k8s-master02 2409:8a10:9e10:8700::30 k8s-master03 2409:8a10:9e10:8700::40 k8s-node01 2409:8a10:9e10:8700::50 k8s-node02192.168.1.61 k8s-master01 192.168.1.62 k8s-master02 192.168.1.63 k8s-master03 192.168.1.64 k8s-node01 192.168.1.65 k8s-node02 192.168.1.66 lb-vip192.168.1.61 kas.git.oiox.cn 192.168.1.61 minio.git.oiox.cn 192.168.1.61 registry.git.oiox.cn 192.168.1.61 gitlab.git.oiox.cn [root@k8s-master01 ~]#

测试访问
# 查看密码 [root@k8s-master01 ~]# kubectl get secret gitlab-gitlab-initial-root-password -ojsonpath='{.data.password}' | base64 --decode ; echo Hh7EjzH01T7DJw7TutWG6ynAU8yoGYcxNcV0cADCIpRCPeuFA5DBTC1I5V4T4gz4 [root@k8s-master01 ~]# # 访问 https://gitlab.git.oiox.cn:31390/

123
关于
https://www.oiox.cn/
https://www.oiox.cn/index.php...
CSDN、GitHub、知乎、开源中国、思否、掘金、简书、华为云、阿里云、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客
全网可搜《小陈运维》
【在Kubernetes部署GitLab】文章主要发布于微信公众号

    推荐阅读