2022-02-13:k8s安装gitlab,yaml如何写?

Posted 福大大架构师每日一题

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2022-02-13:k8s安装gitlab,yaml如何写?相关的知识,希望对你有一定的参考价值。

2022-02-13:k8s安装gitlab,yaml如何写?

答案2022-02-13:

yaml如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: gitlab
  name: gitlab
  namespace: moonfdd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gitlab
  template:
    metadata:
      labels:
        app: gitlab
    spec:
      containers:
        - image: 'gitlab/gitlab-ce'
          imagePullPolicy: IfNotPresent
          name: gitlab
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /etc/gitlab
              name: volv1
            - mountPath: /var/log/gitlab
              name: volv2
            - mountPath: /var/opt/gitlab
              name: volv3
      volumes:
        - hostPath:
            path: /root/k8s/moonfdd/gitlab/etc/gitlab
            type: DirectoryOrCreate
          name: volv1
        - hostPath:
            path: /root/k8s/moonfdd/gitlab/var/log/gitlab
            type: DirectoryOrCreate
          name: volv2
        - hostPath:
            path: /root/k8s/moonfdd/gitlab/var/opt/gitlab
            type: DirectoryOrCreate
          name: volv3
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: gitlab
  name: gitlab
  namespace: moonfdd
spec:
  ports:
    - port: 80
      protocol: TCP
      targetPort: 80
  selector:
    app: gitlab
  type: NodePort

结果如下:


gitlab的yaml

以上是关于2022-02-13:k8s安装gitlab,yaml如何写?的主要内容,如果未能解决你的问题,请参考以下文章

云原生之kubernetes实战在k8s集群下搭建gitlab

kubernetes(k8s)集群安装calico

基于Jenkins+maven+gitlab+harbor+Rancher+k8s的CI/CD实现(尚未完成,还在更新中)

Gitlab CICD DAY 31 - K8S

Jenkins——Jenkins+harbor+gitlab(git) 部署maven项目

K8S。舵。 GitLab UI返回代码422