apiVersion: apps/v1
kind: Deployment
metadata:
  name: registry
  labels:
    app: registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app: registry
  template:
    metadata:
      labels:
        app: registry
    spec:
      containers:
      - name: registry
        image: registry:2
        ports:
        - containerPort: 5000
        env:
        - name: REGISTRY_HTTP_TLS_CERTIFICATE
          value: "/certs/tls.crt"
        - name: REGISTRY_HTTP_TLS_KEY
          value: "/certs/tls.key"
        - name: REGISTRY_AUTH
          value: "htpasswd"
        - name: REGISTRY_AUTH_HTPASSWD_PATH
          value: "/auth/htpasswd"
        - name: REGISTRY_AUTH_HTPASSWD_REALM
          value: "Registry Realm"
        volumeMounts:
        - mountPath: /certs
          name: certs
        - mountPath: /auth
          name: auth
        - mountPath: /var/lib/registry
          name: registry
      volumes:
      - name: certs
        secret:
          secretName: tls-certs
      - name: auth
        secret:
          secretName: registry-auth
      - name: registry
        hostPath:
          type: DirectoryOrCreate
          path: /data/docker-registry
