이 페이지에서는 OS 정책을 간략하게 설명합니다. OS 정책을 사용하여 가상 머신(VM) 인스턴스에서 소프트웨어 구성의 배포, 구성, 유지보수, 보고를 자동화하고 중앙화합니다.
사용 사례
OS 정책은 다음과 같은 시나리오에 적합합니다.
모니터링 및 로깅 등의 작업을 위한 에이전트 설치 및 유지관리
보안 에이전트 등의 에이전트를 배포하고 이러한 에이전트가 모든 VM에서 실행되는지 확인
시작 스크립트 유연성 향상. OS 정책을 사용하면 기존 스크립트를 수정하고 다시 배포할 수 있습니다.
규정 준수 확인 실행
소프트웨어 패키지의 업데이트 저장소 추가
운영체제의 파일 관리
조건 기반 스크립트 실행. 운영체제 내에서 일관된 상태를 유지하도록 특정 조건에 따라 실행되는 스크립트를 설정할 수 있습니다.
구성요소
OS 정책
OS 정책은 패키지, 저장소, 파일 또는 스크립트로 정의된 커스텀 리소스 등 OS 리소스에 대한 선언적 구성이 포함된 파일입니다.
OS 리소스는 에이전트 설치와 같은 단일 태스크를 실행할 수 있으며 여러 할당을 변경하지 않고도 재사용할 수 있습니다.
여러 OS 리소스를 하나의 OS 정책으로 결합하여 여러 단계의 워크플로를 만들 수 있습니다. 예를 들어 OS 정책에는 저장소를 설정하는 하나의 리소스와 해당 저장소에서 특정 패키지를 설치하는 두 번째 리소스가 있을 수 있습니다.
OS 정책 할당은 VM Manager에서 OS 정책을 VM에 적용하는 데 사용됩니다. OS 정책 할당을 사용하면 여러 OS 정책을 결합하여 라벨, OS 제품군, 영역 같은 필터를 통해 이를 VM의 동적 그룹에 타겟팅할 수 있습니다.
예를 들어 다음을 지정하여 Google Kubernetes Engine을 실행 중인 정책을 제외하고 테스트 환경의 모든 Ubuntu VM에 세 가지 정책을 적용하는 OS 정책 할당을 만들 수 있습니다.
정책 A: 모니터링 에이전트 설치
정책 B: 로깅 에이전트 설치
정책 C: 보안 에이전트 설치
라벨 포함: env:test
라벨 제외: goog-gke-node
OS 제품군: ubuntu
출시
새 OS 정책 할당을 만들면 VM Manager는 출시 구성에 따라 각 VM에 OS 정책을 적용합니다. 출시 중에 각 OS 정책의 사본이 VM에 배치됩니다. OS 정책 할당을 업데이트하면 VM Manager가 대상 VM에 있는 OS 정책에 대한 구성 변경사항을 확인하고 적용합니다.
구성 변경으로 인해 발생할 수 있는 잠재적인 서비스 중단을 파악할 수 있도록 새 구성 변경사항을 천천히 적용하는 것이 좋습니다. 이렇게 하면 출시를 취소하고 문제를 해결하는 데 필요한 시간을 확보할 수 있습니다.
출시 옵션을 지정하면 구성 변경 속도를 따라잡고 구성 배포 속도를 제어할 수 있습니다. OS 정책 할당의 각 작업은 출시 프로세스를 시작합니다. 작업에는 OS 정책 할당 만들기, 업데이트 또는 삭제가 포함됩니다.
출시 옵션을 사용하여 다음을 설정할 수 있습니다.
웨이브 크기(중단 예산): 한 번에 롤아웃이 발생할 수 있는 VM의 고정 숫자 또는 백분율입니다. 즉, 출시 시점에는 지정된 수의 VM만 대상으로 합니다.
대기 시간: 서비스가 VM에 정책을 적용하는 시점과 VM이 중단 임곗값에서 삭제된 시점 사이의 시간입니다. 예를 들어 대기 시간이 15분인 경우 VM이 정책을 적용한 후 중단 프로세스에서 15분간 기다려야 VM이 중단 임곗값에서 VM을 삭제하고 출시를 진행할 수 있습니다.
대시 시간은 출시 속도를 제어하는 데 도움이 되며 잠재적인 출시 문제를 조기에 포착하고 해결할 수도 있습니다. 출시 상태를 모니터링하기에 충분한 시간을 선택하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-19(UTC)"],[[["\u003cp\u003eOS policies automate the deployment, configuration, maintenance, and reporting of software configurations on virtual machine (VM) instances.\u003c/p\u003e\n"],["\u003cp\u003eOS policies are used to manage tasks such as installing and maintaining agents, deploying security agents, managing files, running compliance checks, and executing condition-based scripts.\u003c/p\u003e\n"],["\u003cp\u003eOS policy assignments combine multiple OS policies and target them to dynamic groups of VMs by using filters like labels, OS families, and zones.\u003c/p\u003e\n"],["\u003cp\u003eRollouts enable pacing of configuration changes and controlling the speed of configuration deployments, using wave size and wait time settings to mitigate disruptions.\u003c/p\u003e\n"],["\u003cp\u003eVM Manager uses OS Config agents on VMs to apply changes specified in OS policies, with a periodic enforcement check every 60 minutes.\u003c/p\u003e\n"]]],[],null,["This page provides an overview of OS policies. Use OS policies to automate and centralize the\ndeployment, configuration, maintenance, and reporting of software configurations\non your virtual machine (VM) instances.\n\nUse cases\n\nOS policies are ideal for the following scenarios:\n\n- Installing and maintaining agents for tasks such as monitoring and logging\n- Deploying agents such as security agents, and ensuring that these agent are running on all VMs\n- Improving startup script flexibility. With OS policies you can modify existing scripts and re-deploy them\n- Running compliance checks\n- Adding update repositories for software packages\n- Managing files on the operating system\n- Running condition-based scripts. You can set up scripts that run based on certain conditions to maintain consistent state within the operating system.\n\n| **Note:** Custom OS policy scripts and output files that you define using the [`Exec`](/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments#exec) resource don't use [customer-managed encryption keys (CMEKs)](/kms/docs/cmek). These OS policies are incompatible with Google Cloud's [Access\n| Transparency](/assured-workloads/access-transparency/docs/overview) and [Access\n| Approval](/assured-workloads/access-approval/docs/overview). Make sure that you don't include any sensitive information in these scripts or output files.\n\nComponents\n\nOS policy\n\nAn OS policy is a file that contains the declarative configuration for OS\nresources such as packages, repositories, files, or custom resources defined by\nscripts.\n\nAn OS resource can perform a single task such as installing an agent and can be\nreused without changes in different assignments.\nYou can create a multi-step workflow by combining multiple OS resources into a single\nOS policy. For example, an OS policy can have one resource that sets up a repository\nand a second resource that installs specific packages from that repository.\n\nFor more information about OS policies, see\n[OS policy and OS policy assignment](/compute/vm-manager/docs/os-policies/working-with-os-policies).\n\nOS policy assignment\n\nOS policy assignments are used by VM Manager to apply your OS policies to\nVMs. Use OS policy\nassignments to combine multiple OS policies and target them to a dynamic group\nof VMs by using filters such as labels, OS families, and zones.\n\nFor example, an OS policy assignment that applies three policies\nto all the Ubuntu VMs in your test environment, while excluding those that are\nrunning Google Kubernetes Engine, can be created by specifying the following:\n\n- Policy A: install monitoring agent\n- Policy B: install logging agent\n- Policy C: install security agent\n- Include label: `env:test`\n- Exclude label: `goog-gke-node`\n- OS family: `ubuntu`\n\n| **Note:** OS policy assignments are zonal resources. One assignment can target multiple VMs in a single zone. For more information about zonal resources, see [Zonal resources](/compute/docs/regions-zones/global-regional-zonal-resources#zoneresource).\n\nRollouts\n\nWhen you create a new OS policy assignment, VM Manager applies the\nOS policies to each VM according to the rollout configuration. During the rollout,\na copy of each OS policy is placed on the VM. When you update an OS policy assignment,\nVM Manager checks and enforces the configuration changes for the\nOS policy that is on the target VM.\n\nWe recommend that you apply new configuration changes slowly to ensure that\nyou have time to identify any potential disruptions that might be caused\nby configuration changes. This provides you with time needed to cancel\nthe rollout and address the issue.\n\nSpecifying the rollout option enables you to pace configuration changes and\ncontrol the speed of configuration deployments. Each operation for\nan OS policy assignment starts a rollout process. Operations include the creation,\nupdate, or deletion of an OS policy assignment.\n\nYou can use the rollout option to set the following:\n\n- Wave size (disruption budget): the fixed number or percentage of VMs that can experience a rollout at one time. This means that at any moment of the rollout only a specified number of VMs are targeted.\n- Wait time: the time between when the service applies policies to the VM and when a VM is removed from the disruption threshold. For example, a wait time of 15 minutes means that the rollout process must wait 15 minutes after applying the policies to a VM before it can remove the VM from the disruption threshold and the rollout can proceed. The wait time helps control the speed of a rollout and also lets you catch and resolve potential rollout issues early. Select a time that is long enough for you to monitor the status of your rollouts.\n\nFor information about how to create OS policy assignments, see\n[Creating an OS policy assignment](/compute/vm-manager/docs/os-policies/create-os-policy-assignment).\n\nOS Config agent\n\nDuring VM Manager setup, OS Config agents are enabled on the VMs in\nyour project. The OS Config agents that are running on these target VMs use\nstandard system utilities to apply the changes that are specified in the\nOS policies.\n\n- Linux VMs run system package managers such as `apt` or `yum` for package installation, or `/bin/sh` for scripting.\n- Windows VMs run `googet` package manager and PowerShell for scripting.\n\nFor information about how to set up VM Manager,\nsee [Setting up VM Manager](/compute/vm-manager/docs/setup#overview).\n\nHow OS policies work\n\nTo use OS policies for maintaining your operating systems, do the following:\n\n1. Create or download OS policies\n2. Create OS policy assignments that applies these OS policies to the target VMs\n\n[](/static/compute/images/os-config/os-configuration-arch.png) Figure 1. OS policies architecture overview\n\nAfter the OS policy assignments are created, VM Manager periodically\nchecks and enforces these OS policies. The time interval between each\nenforcement check is 60 minutes.\n\nDuring the check and enforcement, VM Manager completes the\nfollowing steps:\n\n1. Identifies the OS policy assignments for a VM.\n2. Identifies the OS policies associated with the OS policy assignments.\n3. Sends the information for each OS policy to the OS Config agent that is running on the VM.\n4. The OS Config agent then validates each policy and makes the following\n updates:\n\n - If resources within an OS policy are already in their desired state, then the OS Config agent does not perform any actions\n - If resources within an OS policy are not in their desired state, then the OS Config agent takes appropriate actions to bring the resources to the desired state\n5. Collects the compliance status of each OS policy that is applied to the VM.\n To view compliance reports, see\n [View compliance reports](/compute/vm-manager/docs/os-policies/view-compliance).\n\nPricing\n\nFor information about pricing, see\n[VM Manager pricing](/compute/vm-manager/pricing).\n\nWhat's next?\n\n- Review [OS policy and OS policy assignment](/compute/vm-manager/docs/os-policies/working-with-os-policies).\n- Learn how to [create an OS policy assignment](/compute/vm-manager/docs/os-policies/create-os-policy-assignment).\n- Learn how to [manage OS policy assignments](/compute/vm-manager/docs/os-policies/manage-os-policy)."]]