인증


builds for Red Hat OpenShift 1.1

런타임 시 인증 이해

Red Hat OpenShift Documentation Team

초록

이 문서에서는 런타임 시 인증에 대한 정보를 제공합니다.

1장. 런타임 시 인증 이해

이미지를 빌드할 때 다음 시나리오에서 인증을 정의해야 할 수 있습니다.

  • 컨테이너 레지스트리에 인증
  • Git에서 소스 코드 가져오기

인증은 필요한 중요한 데이터가 저장되는 보안 정의를 통해 수행됩니다.

1.1. 빌드 보안 주석

빌드 보안에 build.shipwright.io/referenced.secret: "true" 주석을 추가할 수 있습니다. 이 주석을 기반으로 빌드 컨트롤러는 빌드 보안에 대한 이벤트 생성, 업데이트 또는 삭제와 같은 이벤트 시 조정 작업을 수행합니다. 다음 예제에서는 보안과 함께 주석을 사용하는 방법을 보여줍니다.

apiVersion: v1
data:
  .dockerconfigjson: <pull_secret> 
1

kind: Secret
metadata:
  annotations:
    build.shipwright.io/referenced.secret: "true" 
2

  name: secret-docker
type: kubernetes.io/dockerconfigjson
Copy to Clipboard Toggle word wrap
1
base64로 인코딩된 풀 시크릿입니다.
2
build.shipwright.io/referenced.secret 주석의 값은 true 로 설정됩니다.

이 주석은 빌드 인스턴스에서 참조하지 않는 보안을 필터링합니다. 예를 들어 시크릿에 이 주석이 없는 경우 보안에 대해 이벤트가 트리거된 경우에도 빌드 컨트롤러에서 조정하지 않습니다. 이벤트 트리거를 조정하면 빌드 컨트롤러에서 빌드 구성에 대한 검증을 다시 트리거하여 종속성이 누락되었는지 파악할 수 있습니다.

1.2. Git 리포지토리에 대한 인증

Git 리포지토리에 대해 다음과 같은 인증 유형을 정의할 수 있습니다.

  • 기본 인증
  • SSH(Secure Shell) 인증

Build CR에서 두 가지 유형의 인증을 사용하여 Git 보안을 구성할 수도 있습니다.

1.2.1. 기본 인증

기본 인증을 사용하여 Git 리포지토리의 사용자 이름과 암호를 구성해야 합니다. 다음 예제에서는 Git에 대한 기본 인증을 사용하는 방법을 보여줍니다.

apiVersion: v1
kind: Secret
metadata:
  name: secret-git-basic-auth
  annotations:
    build.shipwright.io/referenced.secret: "true"
type: kubernetes.io/basic-auth 
1

stringData: 
2

  username: <cleartext_username>
  password: <cleartext_password>
Copy to Clipboard Toggle word wrap
1
Kubernetes 시크릿의 유형입니다.
2
사용자 이름과 암호를 일반 텍스트로 저장할 필드입니다.

1.2.2. SSH 인증

SSH 인증을 사용하면 사용할 Git 리포지토리 공급자의 호스트 이름을 지정하도록 Tekton 주석을 구성해야 합니다. 예를 들어 GitHub의 경우 github.com 또는 GitLab 의 경우 github.com 입니다.

다음 예제에서는 Git에 대한 SSH 인증을 사용하는 방법을 보여줍니다.

apiVersion: v1
kind: Secret
metadata:
  name: secret-git-ssh-auth
  annotations:
    build.shipwright.io/referenced.secret: "true"
type: kubernetes.io/ssh-auth 
1

data:
  ssh-privatekey: |   
2

    # Insert ssh private key, base64 encoded
Copy to Clipboard Toggle word wrap
1
Kubernetes 시크릿의 유형입니다.
2
Git에 인증하는 데 사용되는 SSH 키의 Base64 인코딩입니다. base64 ~/.ssh/id_rsa.pub 명령을 사용하여 이 키를 생성할 수 있습니다. 여기서 ~/.ssh/id_rsa.pub 는 일반적으로 Git을 인증하는 데 사용되는 키의 기본 위치를 나타냅니다.

1.2.3. Git 시크릿 사용

관련 네임스페이스에 보안을 생성한 후 Build 사용자 정의 리소스(CR)에서 참조할 수 있습니다. 두 가지 유형의 인증을 모두 사용하여 Git 시크릿을 구성할 수 있습니다.

다음 예제에서는 SSH 인증 유형을 사용하여 Git 시크릿을 사용하는 방법을 보여줍니다.

apiVersion: shipwright.io/v1beta1
kind: Build
metadata:
  name: buildah-golang-build
spec:
  source:
    git:
      url: git@gitlab.com:userjohn/newtaxi.git
      cloneSecret: secret-git-ssh-auth
Copy to Clipboard Toggle word wrap

다음 예제에서는 기본 인증 유형을 사용하여 Git 보안을 사용하는 방법을 보여줍니다.

apiVersion: shipwright.io/v1beta1
kind: Build
metadata:
  name: buildah-golang-build
spec:
  source:
    git:
      url: https://gitlab.com/userjohn/newtaxi.git
      cloneSecret: secret-git-basic-auth
Copy to Clipboard Toggle word wrap

1.3. 컨테이너 레지스트리에 대한 인증

이미지를 프라이빗 컨테이너 레지스트리로 내보내려면 해당 네임스페이스에 보안을 정의한 다음 Build 사용자 정의 리소스(CR)에서 참조해야 합니다.

프로세스

  1. 다음 명령을 실행하여 보안을 생성합니다.

    $ oc --namespace <namespace> create secret docker-registry <container_registry_secret_name> \
      --docker-server=<registry_host> \ 
    1
    
      --docker-username=<username> \ 
    2
    
      --docker-password=<password> \ 
    3
    
      --docker-email=<email_address>
    Copy to Clipboard Toggle word wrap
    1
    < registry_host > 값은 이 형식의 https://<registry_server>/<registry_host > 형식의 URL을 나타냅니다.
    2
    & lt;username& gt; 값은 사용자 ID입니다.
    3
    & lt;password > 값은 컨테이너 레지스트리 암호 또는 액세스 토큰일 수 있습니다.
  2. 다음 명령을 실행하여 보안에 주석을 답니다.

    $ oc --namespace <namespace> annotate secrets <container_registry_secret_name> build.shipwright.io/referenced.secret='true'
    Copy to Clipboard Toggle word wrap
  3. spec.output.pushSecret 필드의 값을 Build CR의 보안 이름으로 설정합니다.

    apiVersion: shipwright.io/v1beta1
    kind: Build
    metadata:
      name: buildah-golang-build
      # ...
      output:
        image: <path_to_image>
        pushSecret: <container_registry_secret_name>
    Copy to Clipboard Toggle word wrap

1.4. 역할 기반 액세스 제어

릴리스 배포 YAML 파일에는 Builds 오브젝트를 사용하기 위한 두 가지 클러스터 전체 역할이 포함되어 있습니다. 기본적으로 다음 역할이 설치됩니다.

  • shpwright-build-aggregate-view:Build Strategy ,Cluster BuildStrategy, BuildRun 과 같은 Builds 리소스에 대한 읽기 액세스 권한을 부여합니다. 이 역할은 Kubernetes 역할에 집계됩니다.
  • shipwright-build-aggregate-edit: 네임스페이스 수준에서 구성된 Builds 리소스에 대한 액세스 권한을 작성합니다. 빌드 리소스에는 BuildStrategy,Build, BuildRun 이 포함됩니다. 모든 ClusterBuildStrategy 리소스에 읽기 액세스 권한이 부여됩니다. 이 역할은 Kubernetes editadmin 역할에 집계됩니다.

클러스터 관리자만 ClusterBuildStrategy 리소스에 대한 쓰기 액세스 권한이 있습니다. 이러한 권한으로 별도의 Kubernetes ClusterRole 역할을 생성하고 해당 역할을 적절한 사용자에게 바인딩하여 이 설정을 변경할 수 있습니다.

Legal Notice

Copyright © 2025 Red Hat

OpenShift documentation is licensed under the Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0).

Modified versions must remove all Red Hat trademarks.

Portions adapted from https://github.com/kubernetes-incubator/service-catalog/ with modifications by Red Hat.

Red Hat, Red Hat Enterprise Linux, the Red Hat logo, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.

Linux® is the registered trademark of Linus Torvalds in the United States and other countries.

Java® is a registered trademark of Oracle and/or its affiliates.

XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.

MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.

Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.

The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation’s permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.

All other trademarks are the property of their respective owners.

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

Theme

© 2025 Red Hat