6.6.2. 볼륨 팝업기 생성


볼륨 팝업기를 생성하고 사용하려면 다음을 수행합니다.

  1. 볼륨 팝업을 위한 CRD(사용자 정의 리소스 정의)를 생성합니다.
  2. 볼륨 팝업기를 사용하여 미리 채워진 볼륨을 만듭니다.

6.6.2.1. 볼륨 팝업기를 위한 CRD 생성

다음 절차에서는 볼륨 팝업기에 대한 예제 "hello, world" CRD(사용자 정의 리소스 정의)를 생성하는 방법을 설명합니다.

그런 다음 사용자는 이 CRD의 인스턴스를 생성하여 PVC(영구 볼륨 클레임)를 채울 수 있습니다.

사전 요구 사항

  • OpenShift Container Platform 웹 콘솔에 액세스합니다.
  • cluster-admin 권한으로 클러스터에 액세스합니다.

프로세스

  1. 다음 예제 YAML 파일을 사용하여 팝업기 및 관련 리소스의 논리 그룹화 및 작업에 대한 네임스페이스를 생성합니다.

    네임스페이스 YAML 파일의 예

    apiVersion: v1
    kind: Namespace
    metadata:
      name: hello

  2. 다음 예제 YAML 파일을 사용하여 데이터 소스에 대한 CRD를 생성합니다.

    CRD YAML 파일의 예

    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      name: hellos.hello.example.com
    spec:
      group: hello.example.com
      names:
        kind: Hello
        listKind: HelloList
        plural: hellos
        singular: hello
      scope: Namespaced
      versions:
      - name: v1alpha1
        schema:
          openAPIV3Schema:
            description: Hello is a specification for a Hello resource
            properties:
              apiVersion:
                description: 'APIVersion defines the versioned schema of this representation
                  of an object. Servers should convert recognized schemas to the latest
                  internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
                type: string
              kind:
                description: 'Kind is a string value representing the REST resource this
                  object represents. Servers may infer this from the endpoint the client
                  submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
                type: string
              spec:
                description: HelloSpec is the spec for a Hello resource
                properties:
                  fileContents:
                    type: string
                  fileName:
                    type: string
                required:
                - fileContents
                - fileName
                type: object
            required:
            - spec
            type: object
        served: true
        storage: true

  3. ServiceAccount, ClusterRole ,ClusterRole Bindering, Deployment 를 생성하여 컨트롤러를 배포하여 채우기를 구현하는 논리를 실행합니다.

    1. 다음 예제 YAML 파일을 사용하여 팝업기에 대한 서비스 계정을 생성합니다.

      서비스 계정 YAML 파일의 예

      apiVersion: v1
      kind: ServiceAccount
      metadata:
        name: hello-account
        namespace: hello 
      1

      1
      이전에 생성한 네임스페이스를 참조합니다.
    2. 다음 예제 YAML 파일을 사용하여 팝업기에 대한 클러스터 역할을 생성합니다.

      클러스터 역할 YAML 파일의 예

      kind: ClusterRole
      apiVersion: rbac.authorization.k8s.io/v1
      metadata:
        name: hello-role
      rules:
        - apiGroups: [hello.example.com]
          resources: [hellos]
          verbs: [get, list, watch]

    3. 다음 예제 YAML 파일을 사용하여 클러스터 역할 바인딩을 생성합니다.

      클러스터 역할 바인딩 YAML 파일의 예

      kind: ClusterRoleBinding
      apiVersion: rbac.authorization.k8s.io/v1
      metadata:
        name: hello-binding 
      1
      
      subjects:
        - kind: ServiceAccount
          name: hello-account 
      2
      
          namespace: hello 
      3
      
      roleRef:
        kind: ClusterRole
        name: hello-role 
      4
      
        apiGroup: rbac.authorization.k8s.io

      1
      역할 바인딩 이름입니다.
      2
      이전에 생성한 서비스 계정의 이름을 참조합니다.
      3
      이전에 생성한 서비스 계정의 네임스페이스 이름을 참조합니다.
      4
      이전에 생성한 클러스터 역할을 참조합니다.
    4. 다음 예제 YAML 파일을 사용하여 팝업기에 대한 배포를 생성합니다.

      배포 YAML 파일의 예

      kind: Deployment
      apiVersion: apps/v1
      metadata:
        name: hello-populator
        namespace: hello 
      1
      
      spec:
        selector:
          matchLabels:
            app: hello
        template:
          metadata:
            labels:
              app: hello
          spec:
            serviceAccount: hello-account 
      2
      
            containers:
              - name: hello
                image: registry.k8s.io/sig-storage/hello-populator:v1.0.1
                imagePullPolicy: IfNotPresent
                args:
                  - --mode=controller
                  - --image-name=registry.k8s.io/sig-storage/hello-populator:v1.0.1
                  - --http-endpoint=:8080
                ports:
                  - containerPort: 8080
                    name: http-endpoint
                    protocol: TCP

      1
      이전에 생성한 네임스페이스를 참조합니다.
      2
      이전에 생성한 서비스 계정을 참조합니다.
  4. 다음 예제 YAML 파일을 사용하여 kind:Hello 리소스를 볼륨의 유효한 데이터 소스로 등록할 볼륨 채우기를 생성합니다.

    볼륨 채우기기 YAML 파일의 예

    kind: VolumePopulator
    apiVersion: populator.storage.k8s.io/v1beta1
    metadata:
      name: hello-populator 
    1
    
    sourceKind:
      group: hello.example.com
      kind: Hello

    1
    볼륨 팝업 이름.

    등록되지 않은 팝업을 사용하는 PVC는 "이 PVC의 데이터 소스가 알 수 없음(등록되지 않은) 팝업기를 사용하므로 PVC가 프로비저닝되지 않을 수 있음을 나타내는 등록된 VolumePopulator와 일치하지 않습니다.

다음 단계

  • 이제 이 CRD의 CR 인스턴스를 생성하여 PVC를 채울 수 있습니다.

볼륨 채우기기를 사용하여 볼륨을 미리 채우는 방법에 대한 자세한 내용은 볼륨 채우기가 포함된 사전 예약된 볼륨 생성을 참조하십시오.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

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

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

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

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동