openshift - 使用 CA 证书为 S2I 构建拉取构建器映像
问题描述
我有一个BuildConfig
具有以下strategy
块的:
strategy:
sourceStrategy:
from:
kind: DockerImage
name: <insecure registry pullspec>
forcePull: true
incremental: true
type: Source
构建器映像来自使用自签名证书的注册表。我如何告诉构建配置 A)为注册表使用 CA 证书或 B)忽略证书错误?
我尝试将 CA 证书添加为不透明的秘密,然后使用pullSecret
,但这不起作用:
strategy:
sourceStrategy:
forcePull: true
from:
kind: DockerImage
name: <insecure registry pullspec>
incremental: true
pullSecret:
name: <name of opaque secret with ca cert>
type: Source
我在 OpenShift 3.11 集群中运行此构建。
解决方案
这实际上在文档中描述了如何将您自己的根 CA 添加为additionalTrustedCA
:
为构建设置其他受信任的证书颁发机构
以下是相关部分:
在 openshift-config 命名空间中创建一个 ConfigMap,其中包含使用自签名证书的注册表的可信证书。对于每个 CA 文件,确保 ConfigMap 中的键是主机名 [..port] 格式的注册表主机名:
$ oc create configmap registry-cas -n openshift-config \ --from-file=myregistry.corp.com..5000=/etc/docker/certs.d/myregistry.corp.com:5000/ca.crt \ --from-file=otherregistry.com=/etc/docker/certs.d/otherregistry.com/ca.crt
更新集群镜像配置:
$ oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-cas"}}}' --type=merge
推荐阅读
- css - 基于 Flexbox 百分比的跨度“过度使用”有间隙的可用空间
- python - SpyderKernelApp 警告 | 没有这样的通信:f13ea39fb8bd11ebba185ccd5b5a1f5d 尝试在 Python 中将 CSV 文件转换为 Parquet 文件时
- c++ - 关于变量的C++问题:在字符串中添加一个整数
- c# - DotNetCore 3.1 全局错误处理,未调用中间件
- mysql - 像 MySQL 和 PostgreSQL 这样的 RDB 是否为每个索引存储数据副本?还是只是带有指向真实对象的链接的 B 树?
- c# - WPF WebBrowser 无法正确呈现外部 html 内容
- oracle - 在同一个表上使用 listagg 语句更新 Oracle 表
- r - 如何在马赛克功能期间修复“光栅 IO 期间失败”?
- python - 我尝试制作一个随机引用命令,但它不起作用?
- nginx - 使用 Parallels RAS 或 NGINX 进行 kubernetes 负载平衡