13.5. 시스템 그룹에 업데이트 배포
Containerfile 을 수정하여 운영 체제의 구성을 변경할 수 있습니다. 업데이트는 컨테이너 이미지를 빌드한 후 레지스트리로 푸시하고 운영 체제를 재부팅합니다.
bootc switch 명령을 사용하여 컨테이너 이미지 소스를 변경할 수도 있습니다. 컨테이너 레지스트리의 콘텐츠에 따라 RHEL 이미지 모드 운영 체제의 특정 구성이 결정됩니다. 컨테이너 이미지 참조 전환을 참조하십시오.
일반적으로 시스템 그룹에 업데이트를 배포할 때 중앙 관리 서비스를 사용하여 중앙 서비스에 연결하는 각 시스템에 설치할 클라이언트를 제공할 수 있습니다. 관리 서비스에는 클라이언트가 한 번의 등록을 수행해야 하는 경우가 많습니다.
다음은 시스템 그룹에 업데이트를 배포하는 예입니다. 필요한 경우 관리 서비스의 자격 증명을 이미지에 삽입하여 영구 systemd 서비스를 생성할 수 있습니다.
명확한 이유로 예제의 Containerfile은 최적화되지 않습니다. 예를 들어 이미지에 여러 계층을 생성하지 않도록 하는 최적화는 RUN 을 한 번 호출하는 것입니다.
클라이언트를 RHEL 이미지의 이미지 모드에 설치하고 시작 시 실행하여 시스템을 등록할 수 있습니다.
사전 요구 사항
-
management-client는
cron작업 또는 별도의systemd서비스를 사용하여 서버에 대한 향후 연결을 처리합니다.
프로세스
다음 특성을 사용하여 관리 서비스를 생성합니다. 시스템을 업그레이드할 시기를 결정합니다.
FROM registry.redhat.io/rhel10/rhel-bootc:latest # Management services determine when to upgrade the system. # Disable bootc-fetch-apply-updates.timer if it is included in the base image. RUN systemctl disable bootc-fetch-apply-updates.timer # Install the client from dnf, or some other method that applies for your client RUN dnf install management-client -y && dnf clean all # Inject the credentials for the management service into the image ARG activation_key= # The existence of .run_next_boot acts as a flag to determine if the # registration is required to run when booting RUN touch /etc/management-client/.run_next_boot COPY <<"EOT" /usr/lib/systemd/system/management-client.service [Unit] Description=Run management client at boot After=network-online.target ConditionPathExists=/etc/management-client/.run_client_next_boot [Service] Type=oneshot EnvironmentFile=/etc/management-client/.credentials ExecStart=/usr/bin/management-client register --activation-key ${CLIENT_ACTIVATION_KEY} ExecStartPre=/bin/rm -f /etc/management-client/.run_next_boot ExecStop=/bin/rm -f /etc/management-client/.credentials [Install] WantedBy=multi-user.target EOT # Link the service to run at startup RUN ln -s /usr/lib/systemd/system/management-client.service /usr/lib/systemd/system/multi-user.target.wants/management-client.service # Store the credentials in a file to be used by the systemd service RUN echo -e "CLIENT_ACTIVATION_KEY=${activation_key}" > /etc/management-client/.credentials # Set the flag to enable the service to run one time # The systemd service will remove this file after the registration completes the first time RUN touch /etc/management-client/.run_next_boot-
기본 이미지에 포함된 경우
bootc-fetch-apply-updates.timer를 비활성화합니다. -
dnf를 사용하여 클라이언트 또는 클라이언트에 적용되는 다른 방법을 사용하여 클라이언트를 설치합니다. - 관리 서비스의 자격 증명을 이미지에 삽입합니다.
-
기본 이미지에 포함된 경우