이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 7. Using imagestreams with Kubernetes resources


Imagestreams, being OpenShift Container Platform native resources, work out of the box with all the rest of native resources available in OpenShift Container Platform, such as builds or deployments. It is also possible to make them work with native Kubernetes resources, such as jobs, replication controllers, replica sets or Kubernetes deployments.

7.1. Enabling imagestreams with Kubernetes resources

When using imagestreams with Kubernetes resources, you can only reference imagestreams that reside in the same project as the resource. The imagestream reference must consist of a single segment value, for example ruby:2.5, where ruby is the name of an imagestream that has a tag named 2.5 and resides in the same project as the resource making the reference.

Note

This feature can not be used in the default namespace, nor in any openshift- or kube- namespace.

There are two ways to enable imagestreams with Kubernetes resources:

  • Enabling imagestream resolution on a specific resource. This allows only this resource to use the imagestream name in the image field.
  • Enabling imagestream resolution on an imagestream. This allows all resources pointing to this imagestream to use it in the image field.

Procedure

You can use oc set image-lookup to enable imagestream resolution on a specific resource or imagestream resolution on an imagestream.

  1. To allow all resources to reference the imagestream named mysql, enter the following command:

    $ oc set image-lookup mysql

    This sets the Imagestream.spec.lookupPolicy.local field to true.

    Imagestream with image lookup enabled

    apiVersion: v1
    kind: ImageStream
    metadata:
      annotations:
        openshift.io/display-name: mysql
      name: mysql
      namespace: myproject
    spec:
      lookupPolicy:
        local: true

    When enabled, the behavior is enabled for all tags within the imagestream.

  2. Then you can query the imagestreams 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 mysql to use imagestreams, run the following command:

    $ oc set image-lookup deploy/mysql

    This sets the alpha.image.policy.openshift.io/resolve-names annotation on the deployment.

    Deployment 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
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.