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

posted @ 2022-02-13 21:27  福大大架构师每日一题  阅读(8)  评论(0编辑  收藏  举报  来源