首页 > 解决方案 > Nexus Helm Chart 的配置:HTTPS Serving HTTP Resources

问题描述

我运行了以下命令:

kubectl create secret tls nexus-tls --cert cert.crt --key privateKey.pem

其中cert.crt包含我的证书并privateKey.pem包含我的私钥(使用 CloudFlare 提供)。

stable/sonatype-nexus然后我使用以下配置安装了Helm 图表:

nexusProxy:
  env:
    nexusDockerHost: containers.<<NEXUS_HOST>>
    nexusHttpHost: nexus.<<NEXUS_HOST>>

nexusBackup:
  enabled: true
  nexusAdminPassword: <<PASSWORD>>
  env:
    targetBucket: gs://<<BACKUP_BUCKET_NAME>>
  persistence:
    storageClass: standard

ingress:
  enabled: true
  path: /*
  annotations:
    kubernetes.io/ingress.allow-http: true
    kubernetes.io/tls-acme: true
    kubernetes.io/ingress.class: gce
    kubernetes.io/ingress.global-static-ip-name: <<STATIC_IP_ADDRESS_NAME>>
  tls:
    enabled: true
    secretName: nexus-tls

persistence:
  storageClass: standard
  storageSize: 1024Gi

resources:
  requests:
    cpu: 250m
    memory: 4800Mi

通过运行命令:

helm install -f values.yaml stable/sonatype-nexus

此处记录了此图表的可能配置值。

当我访问 时http://nexus.<<NEXUS_HOST>>,我可以访问 Nexus 存储库。但是,当我访问 时https://nexus.<<NEXUS_HOST>>,我会收到混合内容警告,因为正在提供 HTTP 资源。

如果我将nexusProxy.env.enforceHttps环境变量设置为 true,当我访问时https://nexus.<<NEXUS_HOST>>,我会得到如下响应:

HTTP access is disabled. Click here to browse Nexus securely: https://nexus.<<NEXUS_HOST>>.

如何确保安全地提供 Nexus?我是否犯了配置错误,还是问题出在其他地方?

标签: kubernetesnexuskubernetes-helm

解决方案


如果您的 ELB 服务于纯 http 流量,请将其添加到您的 LoadBalancer 服务注释中。

service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http

推荐阅读