K8s - 如何使用导入的 CA 证书运行 http 请求?

问题描述 投票:0回答:0

我已经使用 yaml 将证书添加到 pod 的 etc/ssl/certs 文件夹中。但是,在设置 verify=true 之后,从 pod 发出的 http 请求会导致“certificate verify failed: self signed certificate”。我的 yaml 看起来像......如这里所述

apiVersion: v1 
kind: Pod
metadata:
  name: sampleyaml
spec:
      containers:
      - name: sampleyaml
        image: python-slim:v1
        volumeMounts:
        - name: ca-imported
          mountPath: /etc/ssl/certs/my-cert.crt
          subPath: my-cert1.crt
        - name: ca-imported
          mountPath: /etc/ssl/certs/my-cert.crt
          subPath: my-cert2.crt
      volumes:
      - name: ca-imported
        configMap:
          name: ca-imported

使用这些证书,请求在 Pod 之外成功运行。所以我不知道为什么它会抛出一个自签名错误。我可以通过导航确认证书存在于 etc/ssl/certs 中:

 my-cert1.crt
 other.pem
 other.pem
 ca-certificates.crt
 other.pem
 my-cert2.crt
kubernetes ssl yaml ssl-certificate httprequest
© www.soinside.com 2019 - 2024. All rights reserved.