YyudongK零S
robin2023 哦哦,那 podman registries.conf 配置可以参考 https://blog.csdn.net/kiritow/article/details/113854996 ;
robin2023 哦哦,那 podman registries.conf 配置可以参考 https://blog.csdn.net/kiritow/article/details/113854996 ;
yudong 请问,在kubesphere的流水线中创建的容器,比如:“nodejs”(image: “kubesphere/builder-nodejs:v3.2.0-podman”),怎么修改这个容器的registries.conf 配置以增加镜像加速的url?
robin2023 麻烦试下在 ks 集群各个 worker 节点上配置下 podman 镜像加速,具体的配置方式可以参考下网络上的其他资料,例如:https://juejin.cn/post/7151042056935669768 ;
yudong 你好,我遇到了与上面类似的问题,就是在使用KubeSphere流水线进行镜像构建时,需要依赖基础镜像 FROM openjdk:8-jdk ,实际运行时,会有一定概率 20%~30% 基础镜像拉取失败,查看日志发现是由于从docker官方镜像仓库拉取镜像超时导致的。因此我想是否可以修改podman的配置,使用国内的镜像加速服务。但是我发现podman是运行在Jenkins的agent / maven 的容器内的,而这个maven容器是动态创建的容器组中的实例,也就是说我进入maven的容器内修改了podman的配置,可以暂时使得修改后的配置生效,但是一旦容器销毁重建,修改后的配置就失效了,后续的构建还是会从docker官方仓库拉取镜像。不知道我的理解是否正确呢?
如果我的理解正确,那么是否可以有什么办法在KubeSphere平台中通过修改devops-system或者devops-worker中的某个配置的方式,比如类似于修改 kubesphere-devops-worker的ConfigMap:ks-devops-agent 来修改maven的配置,添加国内的mirror的方式。 是否可以通过类似的方式永久的修改podman的配置呢?比如将podman的配置挂载到某个configmap,比如 configmap/ks-devops-agent 中呢?
我这边自己修改了一下,
1 在项目 kubesphere-devops-worker 中修改 configmap/ks-devops-agent 添加数据
键:PodmanSetting
值:pomand配置文件,例如:
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "xxx.mirror.aliyuncs.com"
insecure = true
注意:xxx.mirror.aliyuncs.com
要替换成自己的阿里云镜像加速地址
2 在项目 kubesphere-devops-system 中修改 configmap/jenkins-casc-config,在要使用的agent的容器配置中修改数据挂载:
containers:
- name: "maven"
resources:
requests:
ephemeral-storage: "1Gi"
limits:
ephemeral-storage: "10Gi"
volumeMounts:
- name: config-volume
mountPath: /opt/apache-maven-3.5.3/conf/settings.xml
subPath: settings.xml
volumes:
- name: config-volume
configMap:
name: ks-devops-agent
items:
- key: MavenSetting
path: settings.xml
securityContext:
fsGroup: 1000
修改为:
containers:
- name: "maven"
resources:
requests:
ephemeral-storage: "1Gi"
limits:
ephemeral-storage: "10Gi"
volumeMounts:
- name: config-volume
mountPath: /opt/apache-maven-3.5.3/conf/settings.xml
subPath: settings.xml
- name: podman-config-volume
mountPath: /etc/containers/registries.conf
subPath: registries.conf
volumes:
- name: config-volume
configMap:
name: ks-devops-agent
items:
- key: MavenSetting
path: settings.xml
- name: podman-config-volume
configMap:
name: ks-devops-agent
items:
- key: PodmanSetting
path: registries.conf
securityContext:
fsGroup: 1000
也就是增加了
volumeMounts:
- name: podman-config-volume
mountPath: /etc/containers/registries.conf
subPath: registries.conf
和
volumes:
- name: podman-config-volume
configMap:
name: ks-devops-agent
items:
- key: PodmanSetting
path: registries.conf
jenkins-casc-config内有2个配置文件,我都进行了同样的修改,只改了maven,其他的agent根据需要可以做类似的改动,实测有效,挂载到configmap中的podman的配置确实生效了。
kubesphere-devops-worker 这个文件在什么地方?