0

我已经将 JFrog Container Registry 部署到我的 Kubernetes 集群中,一切正常,但是当我尝试通过浏览器访问它时,它重定向到 /ui 并返回 404,但日志中似乎没有显示任何内容。

我没有使用 Helm 图表,因为我不需要 nginx 或 Postgres 等来尝试一下。

我的部署是这样的:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: jcr
  namespace: <REDACTED>
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: jcr
    spec:
      containers:
        - name: jcr
          image: docker.bintray.io/jfrog/artifactory-jcr:latest
          ports:
            - containerPort: 8081
          volumeMounts:
            - name: jcr-data
              mountPath: /jcr-data
      volumes:
        - name: jcr-data
          persistentVolumeClaim:
            claimName: jcr-data
      securityContext:
        fsGroup: 2000
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jcr-data
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
  name: jcr
  namespace: <REDACTED>
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/path:   /
      prometheus.io/port:   '8081'
spec:
  selector: 
    app: jcr
  ports:
    - port: 80
      targetPort: 8081
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: contour.heptio.com/v1beta1
kind: IngressRoute
metadata: 
  labels:
    app: jcr
  name: jcr
  namespace: <REDACTED>
spec: 
  virtualhost:
    fqdn: <REDACTED>
    tls:
      secretName: jcr-live
  routes: 
    - match: /
      services: 
        - name: jcr
          port: 80
4

1 回答 1

1

看起来您的端口配置缺少一些更改。

  1. 您需要8082jcr容器中公开端口,该端口现在是主要的 UI 端口

  2. 一旦端口公开,您应该将此端口添加到您的服务中。

因此,您修改后的 yaml 应该类似于(部署和服务):

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: jcr
  namespace: <REDACTED>
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: jcr
    spec:
      containers:
        - name: jcr
          image: docker.bintray.io/jfrog/artifactory-jcr:latest
          ports:
            - containerPort: 8081
            - containerPort: 8082
          volumeMounts:
            - name: jcr-data
              mountPath: /jcr-data
      volumes:
        - name: jcr-data
          persistentVolumeClaim:
            claimName: jcr-data
      securityContext:
        fsGroup: 2000
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jcr-data
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
  name: jcr
  namespace: <REDACTED>
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/path:   /
      prometheus.io/port:   '8081'
spec:
  selector: 
    app: jcr
  ports:
    - port: 80
      targetPort: 8082
    - port: 8081
      targetPort: 8081
  sessionAffinity: None
  type: ClusterIP

请注意,我将 8081 保持打开状态,这样可以在需要时直接访问 Artifactory 以获得更好的性能(Artifactory 现在在路由器服务后面运行)。

注意 - 我推荐使用官方JFrog Container Registry Helm 图表,它极大地简化了配置和管理 JCR 部署生命周期的过程。

于 2020-03-10T12:26:49.143 回答