4장. NoCloud 데이터 소스를 사용하여 가상 머신 생성


NoCloud 데이터 소스를 사용하여 VM(가상 머신)을 배포하려면 인스턴스 세부 정보에 대한 메타 데이터 및 사용자 액세스 세부 정보를 위한 user-data 를 생성합니다. RHEL(Red Hat Enterprise Linux) ISO에 추가하고 KVM 게스트 VM에 연결합니다. 처음 부팅하는 동안 cloud-init 는 이러한 파일을 사용하여 VM을 구성합니다.

사전 요구 사항

  • Red Hat 계정을 생성했습니다.
  • cloud-init가 사전 설치되어 있고 VM에서 cloud-init 가 자동으로 실행되도록 설정된 KVM 게스트 이미지를 다운로드했습니다.
  • ~/.ssh/id_rsa.pub 파일에 SSH 공개 키가 있습니다.

프로세스

  1. cloudinitiso 디렉터리를 생성하고 이를 작업 디렉터리로 설정합니다.

    $ mkdir cloudinitiso
    $ cd cloudinitiso
  2. meta-data 파일을 편집합니다.

    $ vi meta-data
    instance-id: citest
    local-hostname: citest-1
  3. user-data 파일을 편집합니다.

    $ vi user-data
    #cloud-config
    password: cilogon
    chpasswd: {expire: False}
    ssh_pwauth: True
    ssh_authorized_keys:
      - <ssh-rsa AAAxxxhHQ== sample@example.com>
  4. user-datameta-data 를 포함하는 ISO 이미지를 생성합니다.

    # genisoimage -output ciiso.iso -volid cidata -joliet -rock user-data meta-data
    I: -input-charset not specified, using utf-8 (detected in locale settings)
    Total translation table size: 0
    Total rockridge attributes bytes: 331
    Total directory bytes: 0
    Path table size(bytes): 10
    Max brk space used 0
    183 extents written (0 MB)
  5. Red Hat 고객 포털에서 KVM 게스트 이미지를 /var/lib/libvirt/images 디렉터리에 다운로드합니다.
  6. virt-install 유틸리티를 사용하여 KVM 게스트 이미지에서 새 VM을 생성하고 다운로드한 이미지를 기존 이미지에 연결합니다.

    # virt-install \
    --memory 4096 \
    --vcpus 4 \
    --name mytestcivm \
    --disk /var/lib/libvirt/images/rhel-10-x86_64-kvm.qcow2,device=disk,bus=virtio,format=qcow2 \
    --disk /home/<example_username>/cloudinitiso/ciiso.iso,device=cdrom \
    --os-type Linux \
    --os-variant rhel10.0 \
    --virt-type kvm \
    --graphics none \
    --import
  7. 기본 사용자 이름 cloud-user 및 기본 암호 cilogon:을 사용하여 이미지에 로그인합니다.

    citest-1 login: cloud-user
    Password:
    [cloud-user@citest-1 ~]$

검증

  • cloud-init 서비스의 상태를 확인하여 유틸리티가 정의된 작업을 완료했는지 확인합니다.

    [cloud-user@citest-1 instance]$ cloud-init status
    status: done

    cloud-init 유틸리티가 실행되면 /var/lib/cloudcloud-init 디렉터리 레이아웃을 생성합니다. 또한 지정한 지시문에 따라 특정 디렉터리 콘텐츠를 업데이트하거나 변경합니다.

  • 데이터 소스 파일을 확인하여 데이터 소스가 NoCloud 인지 확인합니다.

    $ cd /var/lib/cloud/instance
    $ cat datasource
    DataSourceNoCloud: DataSourceNoCloud [seed=/dev/sr0][dsmode=net]
  • cloud-init 가 user-data를 /var/lib/cloud/instance/user-data.txt 에 복사하는지 확인합니다.

    $ cat user-data.txt
    #cloud-config
    password: cilogon
    chpasswd: {expire: False}
    ssh_pwauth: True
    ssh_authorized_keys:
      - ssh-rsa AAA...fhHQ== sample@redhat.com
참고

OpenStack의 경우 인스턴스 생성 및 관리에cloud-init 를 사용하여 인스턴스를 구성하는 데 필요한 정보가 포함되어 있습니다. 특정 프로시저 는 사용자 지정 인스턴스 만들기 를 참조하십시오.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

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

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

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

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동