首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GKE -使用谷歌管理证书(mcrt)连接到可扩展服务代理(ESP)的SSL连接

GKE -使用谷歌管理证书(mcrt)连接到可扩展服务代理(ESP)的SSL连接
EN

Stack Overflow用户
提问于 2020-08-07 15:43:30
回答 1查看 412关注 0票数 0

我目前正在尝试在GKE集群中运行API服务来设置多个云端点。我正在使用一个侵入公开ESP到互联网,我已经颁发了一个托管证书,以访问代理使用HTTPS。这是我的入口的结构:

代码语言:javascript
复制
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: mw-ingress
  annotations:
    networking.gke.io/managed-certificates: mw-cert
    kubernetes.io/ingress.global-static-ip-name: mw-static-ip
spec:
  backend:
    serviceName: frontend-service
    servicePort: 80
  rules:
    - http:
        paths:
          - path: /auth/api/*
            backend:
              serviceName: auth-service
              servicePort: 8083

虽然这是部署:

代码语言:javascript
复制
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: auth
  name: auth
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: auth
    spec:
      volumes:
        - name: cloud-endpoints-credentials-volume
          secret:
            secretName: cloud-endpoints-secret
      containers:
        - name: auth-service
          image: eu.gcr.io/my-project/auth-service
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8083
              protocol: TCP
        - name: esp
          image: gcr.io/endpoints-release/endpoints-runtime:1
          args: [
            "--backend=127.0.0.1:8083",
            "--http_port=8084",
            "--service=auth-service.endpoints.my-project.cloud.goog",
            "--rollout_strategy=managed",
            "--service_account_key=/etc/nginx/creds/cloudendpoint.json",
            "-z", "healthz"
          ]
          ports:
            - containerPort: 8084
          volumeMounts:
            - name: cloud-endpoints-credentials-volume
              mountPath: /etc/nginx/creds
              readOnly: true

到目前为止,一切都很顺利。

但是,我似乎无法找到在ESP上启用SSL的方法。正式文件说要从证书文件中创建一个秘密。然而,由于谷歌提供的证书,我不知道如何从它创建一个秘密。我可以在其他来源上找到的所有提示和注释都在使用自签名证书和/或证书管理器,如:https://github.com/GoogleCloudPlatform/endpoints-samples/issues/52#issuecomment-454387373

他们在部署过程中安装了一个包含这个秘密的卷。当我尝试将标志"-ssl_port=443“添加到ESP上的参数列表中时,显然在部署过程中会出现以下错误,因为证书不在那里:nginx: [emerg] BIO_new_file("/etc/nginx/ssl/nginx.crt") failed (SSL: error:02000002:system library:OPENSSL_internal:No such file or directory:fopen('/etc/nginx/ssl/nginx.crt','r') error:1100006e:BIO routines:OPENSSL_internal:NO_SUCH_FILE)

以前是否有人将托管证书与ESP结合使用,并对如何安装证书或创建秘密有想法?

EN

回答 1

Stack Overflow用户

发布于 2020-08-10 20:02:35

我遇到了同样的问题。解决方案是将我的证书作为机密上传到它所期望的位置的esp容器中。根据文档,在esp容器中使用特定的文件路径和特定的命名约定查找证书是硬编码的。

https://cloud.google.com/endpoints/docs/openapi/specify-proxy-startup-options?hl=tr

代码语言:javascript
复制
  - name: esp
    image: gcr.io/endpoints-release/endpoints-runtime:1
    volumeMounts:
      - mountPath: /etc/nginx/ssl
        name: test-ssl
        readOnly: true
  .
  .
  .
  volumes:
    - name: test-ssl
      projected:
        sources:
        - secret:
            name: test-ssl
            items:
            - key: dev.crt
              path: nginx.crt
            - key: dev.key
              path: nginx.key
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63305087

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档