registry.yaml 1.97 KB
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: registry-crt
spec:
  secretName: registry-crt
  dnsNames:
  - registry.local
  issuerRef:
    name: ca-issuer
    # We can reference ClusterIssuers by changing the kind here.
    # The default value is Issuer (i.e. a locally namespaced Issuer)
    kind: ClusterIssuer
    group: cert-manager.io
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: registry
spec:
  hosts:
  - "registry.local"
  gateways:
  - default/cluster-local-gateway
  http:
  - route:
    - destination:
        port:
          number: 5000
        host: registry
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: registry-originate-tls
spec:
  host: registry
  trafficPolicy:
    portLevelSettings:
      - port:
          number: 5000
        tls:
          mode: SIMPLE
---
apiVersion: v1
kind: Service
metadata:
  name: registry
spec:
  type: ClusterIP
  selector:
    app: registry
  ports:
    - name: https-registry
      protocol: TCP
      port: 5000
      targetPort: 5000
      nodePort: 5000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: registry
  labels:
    app: registry
spec:
  selector:
    matchLabels:
      app: registry
  template:
    metadata:
      labels:
        app: registry
    spec:
      restartPolicy: Always
      securityContext:
        runAsUser: 0
        runAsGroup: 0

      volumes:
        - name: registry-data
          persistentVolumeClaim:
            claimName: registry-data
        - name: certificate
          secret:
            secretName: registry-crt

      containers:
        - name: registry
          image: registry:2
          envFrom:
            - configMapRef:
                name: registry-config
            - secretRef:
                name: registry-secret
          volumeMounts:
            - name: registry-data
              mountPath: /var/lib/registry
            - name: certificate
              mountPath: /certs