rpm方式

源地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.9.0-ce.0.el7.x86_64.rpm

rpm -ivh gitlab-ce-12.9.0-ce.0.el7.x86_64.rpm

vim /etc/gitlab.rb   # 编辑站点地址
gitlab-ctl reconfigure # 配置 #服务控制
gitlab-ctl start
gitlab-ctl status
gitlab-ctl stop

Docker方式

mkdir -p ~/data/gitlab/config ~/data/gitlab/logs ~/data/gitlab/data
docker pull gitlab/gitlab-ce:12.9.0-ce.0 docker run -d -p 443:443 -p 80:80 -p 222:22 --name gitlab --restart always -v /Users/zeyang/data/gitlab/config:/etc/gitlab -v /Users/zeyang/data/gitlab/logs:/var/log/gitlab -v /Users/zeyang/data/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:12.9.0-ce.0 docker exec -it gitlab bash
vim /etc/gitlab.rb # 编辑站点地址
gitlab-ctl reconfigure # 配置 docker restart gitlab #服务控制
docker start gitlab
docker stop gitlab
docker rm gitlab

Kubernetes部署

文件地址: https://github.com/zeyangli/devops-on-k8s/blob/master/devops/gitlab.yaml

---
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
k8s-app: gitlab
name: gitlab
namespace: devops
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: gitlab
template:
metadata:
labels:
k8s-app: gitlab
namespace: devops
name: gitlab
spec:
containers:
- name: gitlab
image: gitlab/gitlab-ce:12.6.0-ce.0
imagePullPolicy: Always
ports:
- containerPort: 30088
name: web
protocol: TCP
- containerPort: 22
name: agent
protocol: TCP
resources:
limits:
cpu: 1000m
memory: 4Gi
requests:
cpu: 500m
memory: 512Mi
livenessProbe:
httpGet:
path: /users/sign_in
port: 30088
initialDelaySeconds: 60
timeoutSeconds: 5
failureThreshold: 12
readinessProbe:
httpGet:
path: /users/sign_in
port: 30088
initialDelaySeconds: 60
timeoutSeconds: 5
failureThreshold: 12
volumeMounts:
- name: gitlab-conf
mountPath: /etc/gitlab
- name: gitlab-log
mountPath: /var/log/gitlab
- name: gitlab-data
mountPath: /var/opt/gitlab
env:
- name: gitlab_HOME
value: /var/lib/gitlab
volumes:
- name: gitlab-conf
hostPath:
path: /data/devops/gitlab/config
type: Directory
- name: gitlab-log
hostPath:
path: /data/devops/gitlab/logs
type: Directory
- name: gitlab-data
hostPath:
path: /data/devops/gitlab/data
type: Directory
serviceAccountName: gitlab
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: gitlab
name: gitlab
namespace: devops
---
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: gitlab
name: gitlab
namespace: devops
spec:
type: NodePort
ports:
- name: web
port: 30088
targetPort: 30088
nodePort: 30088
- name: slave
port: 22
targetPort: 22
nodePort: 30022
selector:
k8s-app: gitlab
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: gitlab
namespace: devops
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create","delete","get","list","patch","update","watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get","list","watch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: gitlab
namespace: devops
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: gitlab
subjects:
- kind: ServiceAccount
name: gitlab
namespace: devops
kubectl create -f gitlab.yaml
kubectl delete -f gitlab.yaml

注意: 需要修改gitlab.rb配置文件中的站点地址。这里指定的端口是30088(不是必须的)也就是需要将gitlab.rb配置的地址改成30088和nodePort端口为30088。

为什么端口要改成一致的?如果不修改gitlab.rb中的站点地址则默认是80端口,这时候做nodePort的时候例如将80映射到30088,此时对外访问30088可以打开gitlab页面,但是下载代码的时候会发现地址为80端口,导致下载代码失败。所以这里强调一致哦。

external-url-for-gitlab
external_url 'http://192.168.1.200:30088'

最新文章

  1. 3d效果的图片轮播
  2. springMVC文件上传
  3. H5游戏开发之Stick Hero
  4. jQueryUI日期显示
  5. Objective-C语言继承性
  6. Bootstrap系列 -- 32. 按钮垂直分组
  7. 用SQL语句操作数据库
  8. 你可能不知道的Linux/GNU bash sort多列排序功能
  9. iOS开发:获取设备IP地址
  10. 【C++】大数的+-*/四则运算
  11. Git 的是使用入门
  12. tomcat环境配置 Linux 与 Windows
  13. 这是一个蒟蒻的计划……QAQ
  14. 微信小程序与AspNetCore SignalR聊天实例
  15. Python第二天: 变量详解及变量赋值
  16. IIS7发布asp.net mvc提示404.0
  17. python的random模块(生成验证码)
  18. 06.linux文件目录操作命令
  19. Python 一篇学会多线程
  20. SQL server权限管理和备份实例

热门文章

  1. 2020.7.19 区间 dp 阶段测试
  2. Netty-ProtobufVarint32
  3. 第二十一天python3 python的正则表达式re模块学习
  4. 使用Pure Pipes来替换HTML里面的纯函数
  5. YII服务定位器依赖注入
  6. 抖音 滑块验证方案 s_v_web_id 参数分析
  7. Spring 请求方法的调用原理(Controller)和请求参数的获取的原理
  8. beego下让swagger按照更新了controllers的接口信息自动更新commentsRouter_controllers.go
  9. Redis 05 集合
  10. 一文理解Hadoop分布式存储和计算框架入门基础