구성 커넥터를 사용하면 종속 관계와 관계없이 임의의 순서로 리소스를 만들고 업데이트할 수 있습니다. GKE는 선언된 구성을 원하는 상태의 eventual consistency로 이동합니다.
예를 들어, 해당 PubSubTopic 전에 PubSubSubscription을 생성하는 경우 구성 커넥터는 연관된 구독을 생성하기 전에 주제가 만들어질 때까지 기다립니다.
구성 커넥터 설치가 일치하지 않는 상태로 유지되는 시간은 관리되는 리소스 수 및 유형에 따라 달라집니다. GKE 클러스터에 대한 변경은 일반적으로 수초 내에 수행됩니다. 하지만 Google Cloud 리소스 생성 시간은 리소스 유형에 따라 달라질 수 있습니다. 예를 들어 단일 PubSubTopic은 만들기에 몇 초가 걸립니다. Google Cloud 리소스는 생성되기 까지 일관성에 도달하지 않습니다. 예를 들어 SQLInstance 및 SQLDatabase를 만들 때 시스템은 데이터베이스를 만드는 몇 분 동안 일치하지 않는 상태입니다.
GKE 및 구성 커넥터는 업데이트가 수행될 때마다 또는 사전 구성된 기본 간격을 기준으로 하는 평균 지터 기간을 두고 각 리소스를 조정합니다. 각 리소스의 참조 페이지에 있는 '구성 커넥터 기본 평균 조정 간격(초)'에서 기본 간격을 확인할 수 있습니다.
각 리소스 링크는 리소스 개요를 참조하세요.
조정에 오류가 있으면 구성 커넥터가 최대 백오프가 2분인 지수 백오프를 사용하여 재시도합니다. 해당 리소스의 이벤트에서 오류를 볼 수 있습니다.
조정 간격 구성
구성 커넥터 1.102부터는 구성 커넥터에서 관리하는 cnrm.cloud.google.com/reconcile-interval-in-seconds 주석을 사용하여 리소스의 평균 조정 간격을 구성할 수 있습니다. 주석 값은 리소스 참조 페이지의 '구성 커넥터 기본 평균 조정 간격(초)' 기본값을 덮어씁니다.
주석 값은 시간(초)을 나타내는 음수가 아닌 정수여야 합니다. 값이 0으로 설정된 경우 구성 커넥터는 리소스가 UpToDate 상태에 도달하면 조정 시작을 중지합니다.
예를 들어 기본 Google Cloud API 할당량 문제가 발생하지 않도록 구성 커넥터에서 리소스를 더 적게 조정하려는 경우 평균 조정 간격 값을 1시간으로 설정하면 됩니다.
구성 커넥터가 리소스를 더 자주 조정하여 드리프트를 더 빨리 수정하도록 하려면 주석을 작은 값으로 설정하면 됩니다.
동일한 그룹 버전 종류(GVK)를 공유하는 특정 유형의 모든 리소스에 다음 스크립트를 주석으로 추가할 수 있습니다.
#!/bin/bashKIND=RESOURCE_KINDNAMESPACE=RESOURCE_NAMESPACEANNOTATION_KEY="cnrm.cloud.google.com/reconcile-interval-in-seconds"ANNOTATION_VALUE=RECONCILE_INTERVAL
kubectlannotate--overwrite--all${KIND}${ANNOTATION_KEY}=${ANNOTATION_VALUE}-n${NAMESPACE}echo"Annotation added to all ${KIND} RESOURCE"
다음을 바꿉니다.
RESOURCE_KIND: 주석을 추가할 리소스 종류입니다.
RESOURCE_NAMESPACE: 주석을 추가할 리소스가 포함된 네임스페이스입니다.
RECONCILE_INTERVAL: 조정 간격(초)입니다.
조정 간격을 0으로 설정하여 리소스에 대한 드리프트 수정을 중지할 수 있지만 리소스 활성화는 사용 중지되지 않습니다. Spec 리소스를 변경하면 리소스가 다시 조정됩니다.
조정 간격을 0으로 설정하면 되돌릴 수 없습니다. 즉, 값을 다시 0이 아닌 숫자로 변경해도 구성 커넥터에서 리소스를 다시 조정하지 않습니다.
0 조정 간격을 되돌리려면 다음 옵션을 사용합니다.
새 조정을 사용 설정하려면 리소스 사양을 조정 간격 값으로 수정합니다.
cnrm.cloud.google.com/deletion-policy: "abandon" 주석을 설정하여 리소스를 폐기하고 조정 간격 값이 0이 아닌 리소스를 다시 만듭니다.
변경 가능하지만 읽을 수 없는 필드는 변경 시에만 활성화됨
일부 API는 읽을 수 없지만 변경 가능한 필드를 제공합니다(예: SQL 사용자의 비밀번호). 이러한 필드가 수정되었는지 확인할 수 없기 때문에 변경 가능하지만 읽을 수 없는 필드는 커스텀 리소스가 수정될 때만 업데이트됩니다.
변경할 수 없는 필드를 수정할 때 리소스가 다시 생성되지 않음
리소스의 일부 필드는 변경 불가능하며, 대상 리소스를 삭제한 후 다시 만들지 않는 한 조정이 불가능합니다.
이러한 경우 구성 커넥터가 이 다시 만들기를 수행하는 대신 리소스에 대해 'UpdatedFailed' Kubernetes 이벤트를 방출합니다. 그러면 사용자가 리소스를 삭제하고 다시 만들어야 합니다.
예시 이벤트:
Warning UpdateFailed 37m (x643 over 15d) computeinstance-controller Update call failed: the desired mutation for the following field(s) is invalid: [bootDisk.0.InitializeParams.0.Image networkInterface.0.NetworkIp]
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-21(UTC)"],[[["\u003cp\u003eConfig Connector uses a reconciliation strategy to maintain the desired state of resources, automatically adjusting them to match the declared configuration.\u003c/p\u003e\n"],["\u003cp\u003eThe time it takes for resources to reach consistency varies, depending on the type of resource and whether they are already created, with changes to a GKE cluster generally completing within seconds, while Google Cloud resources might require more time.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure the average reconciliation interval for resources using the \u003ccode\u003ecnrm.cloud.google.com/reconcile-interval-in-seconds\u003c/code\u003e annotation, allowing for adjustments to frequency and control, while setting the interval to 0 will stop all reconciliations once it reaches an "UpToDate" status.\u003c/p\u003e\n"],["\u003cp\u003eMutable but unreadable fields (e.g., passwords) are only updated when the custom resource is modified, and immutable fields that can't be reconciled will trigger an "UpdatedFailed" event, requiring manual deletion and recreation of the resource.\u003c/p\u003e\n"],["\u003cp\u003eReconciliation retries, in case of an error, are set with an exponential backoff, and are capped at a maximum of two minutes.\u003c/p\u003e\n"]]],[],null,["# Reconciliation strategy\n=======================\n\n*** ** * ** ***\n\nWith declarative configuration, you define the desired state of the system. The\nsystem then works constantly to remain as close as possible to this state. See\n[Declarative management of Kubernetes objects using configuration files](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/)\nfor more information.\n\nWith Config Connector, you can create and update resources in any order,\nregardless of dependency relationships. GKE moves your declared\nconfiguration towards\n[eventual consistency](https://en.wikipedia.org/wiki/Eventual_consistency)\nwith the desired state.\n\nFor example, if you create a `PubSubSubscription` before the corresponding\n`PubSubTopic`, Config Connector waits until the topic is created before\ncreating the associated subscription.\n\nThe duration your Config Connector installation remains inconsistent depends on\nthe number and types of resources it manages. Changes to a GKE\ncluster are typically executed in seconds. However, the time to create\nGoogle Cloud resources can vary based on the type of resource. For\nexample, a single `PubSubTopic` takes seconds to create. Google Cloud\nresources do not reach consistency until they are created. For example, when\ncreating an `SQLInstance` and an `SQLDatabase`, the system is inconsistent for a\nperiod of minutes while the database is created.\n\nGKE and Config Connector reconcile each resource with every\nupdate or after a jitter period with an average based on the preconfigured default\ninterval. You can find the default interval in \"Config Connector Default Average\nReconcile Interval In Seconds\" from each resource's reference page.\nFor links to each resource, see the [Resource overview](/config-connector/docs/reference/overview).\nWhen there is an\nerror in reconciling, Config Connector retries with exponential backoff where\nmaximum backoff is two minutes. You can view any errors in the\n[Events](/config-connector/docs/how-to/monitoring-your-resources#viewing_events)\nof a given resource.\n\nConfiguring the reconciliation interval\n---------------------------------------\n\nStarting from Config Connector [1.102](/config-connector/docs/release-notes#March_30_2023), you can configure the average reconcile interval for resources managed by Config Connector with the `cnrm.cloud.google.com/reconcile-interval-in-seconds` annotation. The value of the annotation overwrites the default value of \"Config Connector Default Average\nReconcile Interval In Seconds\" from the [resource reference](/config-connector/docs/reference/overview)\npage.\nThe value of the annotation should be a non-negative integer representing time in seconds. If the value is set to 0, Config Connector stops initiating reconciliations for the resource once it reaches the [UpToDate](/config-connector/docs/how-to/monitoring-your-resources#-specific_events) status.\n\nFor example, if you want Config Connector to reconcile a resource less frequently to avoid hitting underlying Google Cloud\n[API quota issues](/config-connector/docs/best-practices#quota-limits), you can set the average reconciliation interval value to 1 hour. \n\n cnrm.cloud.google.com/reconcile-interval-in-seconds: \"3600\"\n\nIf you want Config Connector to reconcile a resource more frequently to correct drifts sooner, you can set the annotation with a small value.\n\nYou can annotate all resources of a particular type that shares the same Group Version Kind (GVK) with the following script:\n**Note:** If you are using a GitOps-style workflow, for example with [Config Sync](/anthos-config-management/docs/config-sync-overview), the following script may not be applicable. Instead, you must update the YAML files with the annotation set in your source of truth. \n\n #!/bin/bash\n\n KIND=\u003cvar translate=\"no\"\u003eRESOURCE_KIND\u003c/var\u003e\n NAMESPACE=\u003cvar translate=\"no\"\u003eRESOURCE_NAMESPACE\u003c/var\u003e\n ANNOTATION_KEY=\"cnrm.cloud.google.com/reconcile-interval-in-seconds\"\n ANNOTATION_VALUE=\u003cvar translate=\"no\"\u003eRECONCILE_INTERVAL\u003c/var\u003e\n\n kubectl annotate --overwrite --all ${KIND} ${ANNOTATION_KEY}=${ANNOTATION_VALUE} -n ${NAMESPACE}\n echo \"Annotation added to all ${KIND} RESOURCE\"\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESOURCE_KIND\u003c/var\u003e: the resource kind that you want to annotate.\n- \u003cvar translate=\"no\"\u003eRESOURCE_NAMESPACE\u003c/var\u003e: the namespace that contains the resources that you want to annotate.\n- \u003cvar translate=\"no\"\u003eRECONCILE_INTERVAL\u003c/var\u003e: the reconcile interval in seconds.\n\nYou can set the reconciliation interval to 0 to disable drift correction for a resource, but it does not disable resource actuation. If you make changes to the resource [`Spec`](/config-connector/docs/concepts/resources#spec_and_status), the resource will be reconciled again.\n\nSetting the reconciliation interval to 0 is irreversible. This means changing the value back to a non-zero number does not make Config Connector reconcile the resource again.\n\nIf you want to revert the 0 reconciliation interval, you have the following options:\n\n- Modify the resource spec with the reconciliation interval value to enable new reconciliations.\n- Abandon the resource by setting the annotation `cnrm.cloud.google.com/deletion-policy: \"abandon\"` and recreate the resource with a reconciliation interval value other than 0.\n\nMutable but unreadable fields are actuated on change only\n---------------------------------------------------------\n\nSome APIs expose fields that are not readable, but are mutable (for example, the\npassword for a SQL user). Due to the inability to see if these fields have been\nmodified, mutable but unreadable fields are updated only when the custom\nresource is modified.\n\nResources are not recreated when modifying immutable fields\n-----------------------------------------------------------\n\nSome fields in a resource are immutable, and can't be reconciled without\ndeleting, then re-creating the target resource.\n\nIn these situations, Config Connector emits an \"UpdatedFailed\" Kubernetes event\nfor the resource rather than perform this re-creation. You must then delete and\nre-create the resource.\n\nExample event: \n\n Warning UpdateFailed 37m (x643 over 15d) computeinstance-controller Update call failed: the desired mutation for the following field(s) is invalid: [bootDisk.0.InitializeParams.0.Image networkInterface.0.NetworkIp]"]]