Questo contenuto non è disponibile nella lingua selezionata.
Chapter 7. Using image streams with Kubernetes resources
Image streams, being OpenShift Container Platform native resources, work with all native resources available in OpenShift Container Platform, such as
Build
DeploymentConfigs
Job
ReplicationController
ReplicaSet
Deployment
7.1. Enabling image streams with Kubernetes resources Copia collegamentoCollegamento copiato negli appunti!
When using image streams with Kubernetes resources, you can only reference image streams that reside in the same project as the resource. The image stream reference must consist of a single segment value, for example
ruby:2.5
ruby
2.5
This feature can not be used in the
default
openshift-
kube-
There are two ways to enable image streams with Kubernetes resources:
- Enabling image stream resolution on a specific resource. This allows only this resource to use the image stream name in the image field.
- Enabling image stream resolution on an image stream. This allows all resources pointing to this image stream to use it in the image field.
Procedure
You can use
oc set image-lookup
To allow all resources to reference the image stream named
, enter the following command:mysql$ oc set image-lookup mysqlThis sets the
field to true.Imagestream.spec.lookupPolicy.localImagestream with image lookup enabled
apiVersion: image.openshift.io/v1 kind: ImageStream metadata: annotations: openshift.io/display-name: mysql name: mysql namespace: myproject spec: lookupPolicy: local: trueWhen enabled, the behavior is enabled for all tags within the image stream.
Then you can query the image streams and see if the option is set:
$ oc set image-lookup imagestream --list
You can enable image lookup on a specific resource.
To allow the Kubernetes deployment named
to use image streams, run the following command:mysql$ oc set image-lookup deploy/mysqlThis sets the
annotation on the deployment.alpha.image.policy.openshift.io/resolve-namesDeployment with image lookup enabled
apiVersion: apps/v1 kind: Deployment metadata: name: mysql namespace: myproject spec: replicas: 1 template: metadata: annotations: alpha.image.policy.openshift.io/resolve-names: '*' spec: containers: - image: mysql:latest imagePullPolicy: Always name: mysql
You can disable image lookup.
To disable image lookup, pass
:--enabled=false$ oc set image-lookup deploy/mysql --enabled=false