kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    k8s-app: gitlab
  name: gitlab
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s-app: gitlab
  template:
    metadata:
      labels:
        k8s-app: gitlab
    spec:
      hostAliases:
      - ip: "127.0.0.1"
        hostnames:
        - "git.huoys.com"
      - ip: "172.13.0.51"
        hostnames:
        - "apiserver.k8s.com"
      containers:
      - name: gitlab-ce
        image: "twang2218/gitlab-ce-zh:11.1.4"
        resources:
          requests:
            memory: 4Gi
        ports:
        - containerPort: 22
          protocol: TCP
        - containerPort: 80
          protocol: TCP
        - containerPort: 443
          protocol: TCP
        env:
          - name: SERVICE_IGNORE
            value: "true"
        volumeMounts:
        - name: config
          mountPath: /etc/gitlab
        - name: logs
          mountPath: /var/log/gitlab
        - name: data
          mountPath: /var/opt/gitlab
          # Create on-disk volume to store exec logs
        - name: tmp-volume
          mountPath: /tmp
        - name: containerenv
          mountPath: /.dockerenv
        livenessProbe:
          httpGet:
            scheme: HTTPS
            path: /
            port: 443
          initialDelaySeconds: 300
          timeoutSeconds: 300
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: "gitlab-data"
      - name: config
        persistentVolumeClaim:
          claimName: "gitlab-config"
      - name: logs
        emptyDir: {}
      - name: tmp-volume
        emptyDir: {}
      - name: containerenv
        emptyDir: {}

---
apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: gitlab
  name: gitlab
spec:
  selector:
    k8s-app: gitlab
  externalIPs:
  - 172.13.0.51
  ports:
  - name: ssh
    port: 22
    protocol: TCP
    targetPort: 22
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  - name: https
    port: 443
    protocol: TCP
    targetPort: 443

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    k8s-app: gitlab
  name: gitlab-data
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  storageClassName: gitlab-data

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    k8s-app: gitlab
  name: gitlab-config
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  storageClassName: gitlab-config

---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-172.13.0.51
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 300Gi
  volumeMode: Filesystem
  storageClassName: gitlab-config
  nfs:
    path: /docker/volumes/gitlab/ce/config
    server: 172.13.0.51
  persistentVolumeReclaimPolicy: Retain

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-172.13.0.51
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 300Gi
  volumeMode: Filesystem
  storageClassName: gitlab-data
  nfs:
    path: /docker/volumes/gitlab/ce/data
    server: 172.13.0.51
  persistentVolumeReclaimPolicy: Retain

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐