我一直因为以下几点而头脑发热:
我有一组构建信任,在"openshift“命名空间中构建图像并为其创建图像。例如,这给我提供了netclient-userspace imagestream。
krist@MacBook-Pro netmaker % oc get is netclient-userspace
NAME IMAGE REPOSITORY TAGS UPDATED
netclient-userspace image-registry.openshift-image-registry.svc:5000/openshift/netclient-userspace latest About an hour ago然而,我无法搞清楚的是,如何在不同名称空间的部署中使用此imagestream。
举个例子:
kind: Pod
apiVersion: v1
metadata:
name: netclient-test
namespace: "kvb-netclient-test"
spec:
containers:
- name: netclient
image: netclient-userspace:latest当我部署它时我会发现错误..。
Failed to pull image "netclient-userspace:latest": rpc error: code =
Unknown desc = reading manifest latest in
docker.io/library/netclient-userspace: errors: denied: requested
access to the resource is denied unauthorized: authentication required所以openshift去找码头枢纽上的图像。不应该。我如何告诉openshift在这里使用imagestream?
发布于 2022-11-28 02:33:38
当使用ImageStreamTag作为部署映像源时,需要使用注解。它指示OpenShift将部署中的image:属性替换为ImageStreamTag的值(并在将来ImageStreamTag发生变化时重新部署)。
重要的是,请注意yaml字符串中带有显式空格的注释和image: ' '。
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"content-netclient-userspace:latest","namespace":"openshift"},"fieldPath":"spec.template.spec.containers[?(@.name==\"netclient\")].image"}]'
name: netclient-test
namespace: "kvb-netclient-test"
spec:
...
template:
...
spec:
containers:
- command:
- ...
image: ' '
name: netclient
...我还要提到,为了从不同的名称空间提取图像,可能需要授权部署的服务帐户:OpenShift文档。
https://stackoverflow.com/questions/74348672
复制相似问题