콘솔 또는 CLI를 사용하여 구성을 많이 변경할 수 있지만 일부 구성 동기화 기본값을 재정의하고 SSL 인증서 확인을 제어하며 인증 기관을 사용하려면 kubectl 명령어를 사용해야 합니다.
RootSync 구성 파일 만들기 및 수정
kubectl 명령어를 사용하여 구성 동기화를 구성하려면 YAML 파일을 만들어서 RootSync 객체를 수정합니다.
Google Cloud 콘솔 또는 Google Cloud CLI를 사용하여 구성 동기화를 설치하면 구성 동기화는 root-sync라는 RootSync 객체를 자동으로 만듭니다. 이 객체에는 구성 동기화에 대한 최신 구성 정보가 포함됩니다. Google Cloud 콘솔 또는 Google Cloud CLI에서 변경을 수행할 때마다 root-sync가 업데이트됩니다.
kubectl을 사용하여 수정할 수 있는 필드에 대해 알아보기
Google Cloud 콘솔 또는 Google Cloud CLI에서 지원되지 않는 필드에 kubectl 명령어를 사용하여 root-sync에 고급 변경사항을 적용할 수 있습니다. kubectl 명령어를 사용해서 RootSync 또는 RepoSync 객체를 직접 만든 후 업데이트하려면 RootSync 및 RepoSync 필드를 참조하세요.
다음 섹션에서 만드는 YAML 파일을 변경하기 전에 다음 표를 숙지합니다. 이 표에는 편집 및 추가할 수 있는 필드가 나열되어 있습니다. 이 표에 나열되지 않은 필드를 수정하면 구성 동기화는 Google Cloud 콘솔 또는 Google Cloud CLI에서 구성 동기화를 마지막으로 구성했을 때 설정한 값으로 변경사항을 자동으로 되돌립니다.
키
설명
spec.git.noSSLVerify
noSSLVerify는 SSL 인증서 확인을 사용 설정 또는 사용 중지할지 여부를 지정합니다. 기본값: false noSSLVerify가 true로 설정된 경우 Git에 SSL 인증서 확인을 건너뛰도록 지정합니다.
spec.git.caCertSecretRef.name
인증 기관(CA) 인증서가 포함된 보안 비밀의 이름입니다. 이 필드가 제공되면 Git 서버는 이 CA에서 발급한 인증서를 사용해야 합니다. CA 인증서는 `cert`라는 키 아래 보안 비밀에 저장되어야 합니다.
spec.override.resources
컨테이너 리소스 요청 및 한도 재정의 목록입니다. 선택사항.
목록의 각 항목에 3개 필드가 포함됩니다.
containerName: 이 필드는 git-sync, oci-sync, hydration-controller, 또는 reconciler 중 하나일 수 있습니다.
cpuRequest(선택사항)
cpuLimit(선택사항)
memoryRequest(선택사항)
memoryLimit(선택사항)
리소스 요청 또는 한도의 재정의 값이 제공되지 않았으면 요청 또는 한도에 대해 기본 리소스 값이 사용됩니다.
spec.override.gitSyncDepth
gitSyncDepth를 사용하면 가져올 Git 커밋 수를 재정의할 수 있습니다.
0보다 작지 않아야 합니다.
이 필드가 0이면 구성 동기화가 전체 클론을 수행하고 이 필드가 0보다 크면 부분 클론을 수행합니다.
이 필드를 제공하지 않으면 구성 동기화가 이를 자동으로 구성합니다.
spec.override.statusMode
statusMode를 사용하면 리소스 수준 상태 캡처를 사용 설정하거나 사용 중지할 수 있습니다.
기본값은 enabled입니다.
리소스 수준 상태 캡처를 사용 중지하려면 이 필드를 disabled로 설정합니다.
spec.override.reconcileTimeout
reconcileTimeout을 사용하면 포기하기 전에 적용 그룹의 리소스가 조정될 때까지 기다리는 시간에 대한 기준점을 재정의할 수 있습니다. 커밋의 모든 리소스는 종속 항목을 기반으로 여러 적용 그룹에 있을 수 있습니다.
기본 제한 시간은 5m입니다.
문자열을 사용하여 이 필드 값을 지정합니다(예: 30s, 5m).
spec.override.enableShellInRendering
enableShellInRendering은 렌더링 프로세스에서 셸 액세스를 사용 설정 또는 사용 중지할지 여부를 지정합니다. Kustomize 원격 베이스에는 셸 액세스가 필요합니다. 이 필드를 true로 설정하면 렌더링 프로세스에서 셸 액세스를 사용 설정하고 공개 저장소에서 원격 베이스를 가져올 수 있습니다.
기본값은 false입니다.
파일 만들기
root-sync를 위한 구성 파일을 만들고 수정하려면 다음 단계를 완료하세요.
올바른 클러스터에 대한 구성 정보를 검색하고 있는지 확인하려면 kubectl 명령줄 액세스를 구성합니다.
만든 YAML 파일을 열고 필요한 구성 변경을 수행합니다. 예를 들어 git-sync 컨테이너의 메모리 한도를 재정의하려면 다음 필드를 굵게 표시합니다.
apiVersion:v1items:-apiVersion:configsync.gke.io/v1beta1kind:RootSyncmetadata:annotations:configmanagement.gke.io/managed-by-hub:"true"configmanagement.gke.io/update-time:"1644945169"creationTimestamp:"2022-02-15T17:12:52Z"generation:1name:root-syncnamespace:config-management-systemresourceVersion:"211980457"uid:aa30a94b-2825-4590-ad30-5af848403502spec:git:auth:nonebranch:maindir:/quickstart/config-syncperiod:15srepo:https://github.com/GoogleCloudPlatform/anthos-config-management-samplesrevision:HEADsecretRef:{}override:resources:-containerName:"git-sync"memoryLimit:"400Mi"sourceFormat:unstructured# Remainder of RootSync omitted
변경사항으로 오류가 발생하지 않았는지 확인하려면 nomos status 명령어를 사용합니다.
nomosstatus
인증 기관 구성
아직 신뢰할 수 없는 인증 기관(CA)의 인증서로 구성된 서버의 경우, 구성 동기화는 CA 인증서를 사용하여 서버에 대한 HTTPS 연결을 확인하도록 구성할 수 있습니다. 이는 Git, Helm 또는 OCI 서버에서 지원됩니다. CA 인증서에는 전체 SSL 인증서(루트/중간/리프)가 포함되어야 합니다.
서버가 이미 신뢰할 수 있는 CA를 사용 중이거나 HTTPS를 통해 연결하지 않는 경우 이 단계를 건너뛰고 caCertSecretRef를 설정하지 않습니다.
RootSync
Git 서버의 인증서를 발급하는 데 사용된 CA 인증서를 가져와서 파일에 저장합니다.
RootSync 객체의 경우 config-management-system 네임스페이스에 보안 비밀을 만들어야 합니다. 예를 들면 다음과 같습니다.
[[["이해하기 쉬움","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-09-01(UTC)"],[],[],null,["# Configure Config Sync with kubectl commands\n\nThis page explains how to configure Config Sync using `kubectl` commands\nafter you've\n[installed Config Sync using the Google Cloud console or Google Cloud CLI](/kubernetes-engine/enterprise/config-sync/docs/how-to/installing-config-sync).\n\nWhile you can make many configuration changes using the console or CLI, you\nneed to use `kubectl` commands to\n[override some Config Sync defaults](/kubernetes-engine/enterprise/config-sync/docs/reference/rootsync-reposync-fields#override-resources), to control SSL certificate\nverification, and to use a certificate authority.\n\nCreate and edit the RootSync configuration file\n-----------------------------------------------\n\nTo configure Config Sync using `kubectl` commands, you edit a\n[RootSync object](/kubernetes-engine/enterprise/config-sync/docs/reference/rootsync-reposync-fields) by creating\na YAML file.\n\nWhen you install Config Sync using the Google Cloud console or\nGoogle Cloud CLI, Config Sync automatically creates a RootSync object named\n`root-sync`. This object contains the most recent configuration information for\nConfig Sync. Whenever you make a change in the Google Cloud console or\nGoogle Cloud CLI, `root-sync` is updated.\n\n### Learn about the fields you can edit using `kubectl`\n\nYou can make advanced changes to `root-sync` using `kubectl` commands for the\nfields not supported in the Google Cloud console or Google Cloud CLI. If you want to\ncreate and then update RootSync or RepoSync objects directly using `kubectl`\ncommands, see\n[RootSync and RepoSync fields](/kubernetes-engine/enterprise/config-sync/docs/reference/rootsync-reposync-fields).\n\nBefore you make any changes to the YAML file that you create in the following\nsection, familiarize yourself with the following table. This table lists the\nfields that you can edit and add. If you edit fields not listed in this table,\nConfig Sync automatically reverts changes back to the values you set when you\nlast configured Config Sync in the Google Cloud console or Google Cloud CLI.\n\n| **Note:** Changes to fields that aren't in the preceding table are only reverted for the RootSync object that Config Sync creates when you install using the Google Cloud console or Google Cloud CLI. If you manually created a RootSync object named `root-sync` using an alternate installation method, you can edit all of the fields listed in [RootSync and RepoSync fields](/kubernetes-engine/enterprise/config-sync/docs/reference/rootsync-reposync-fields).\n\n### Create the file\n\nTo create and edit a configuration file for `root-sync`, complete the\nfollowing steps:\n\n1. To make sure that you're retrieving the configuration information for the\n correct cluster, configure `kubectl` command-line access:\n\n gcloud container clusters get-credentials \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e \\\n --zone \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e \\\n --project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of the cluster that has the Config Sync configuration that you want to change\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone that you created your cluster in\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your project ID\n2. Copy the configuration information from the RootSync object that\n Config Sync created into a YAML file:\n\n kubectl get rootsync root-sync -n config-management-system -o yaml \u003e\n \u003cvar translate=\"no\"\u003eFILE_NAME\u003c/var\u003e.yaml\n\n Replace \u003cvar translate=\"no\"\u003eFILE_NAME\u003c/var\u003e with a name for your configuration\n file.\n3. Open the YAML file that you created and make the required configuration\n changes. For example, to override the memory limit of the `git-sync`\n container, add the following fields in bold:\n\n apiVersion: v1\n items:\n - apiVersion: configsync.gke.io/v1beta1\n kind: RootSync\n metadata:\n annotations:\n configmanagement.gke.io/managed-by-hub: \"true\"\n configmanagement.gke.io/update-time: \"1644945169\"\n creationTimestamp: \"2022-02-15T17:12:52Z\"\n generation: 1\n name: root-sync\n namespace: config-management-system\n resourceVersion: \"211980457\"\n uid: aa30a94b-2825-4590-ad30-5af848403502\n spec:\n git:\n auth: none\n branch: main\n dir: /quickstart/config-sync\n period: 15s\n repo: https://github.com/GoogleCloudPlatform/anthos-config-management-samples\n revision: HEAD\n secretRef: {}\n override:\n resources:\n - containerName: \"git-sync\"\n memoryLimit: \"400Mi\"\n sourceFormat: unstructured\n # Remainder of RootSync omitted\n\n4. Apply the changes to the YAML file:\n\n kubectl apply -f \u003cvar translate=\"no\"\u003eFILE_NAME\u003c/var\u003e.yaml\n\n5. To verify that Config Sync has applied your changes, view the RootSync\n object:\n\n kubectl describe rootsync root-sync -n config-management-system\n\n6. To verify that your changes haven't introduced any errors, use the\n [`nomos status`](/kubernetes-engine/enterprise/config-sync/docs/how-to/nomos-command#status-install) command:\n\n nomos status\n\n### Configure Certificate Authority\n\nFor servers configured with certificates from a Certificate Authority (CA)\nthat is not already trusted, Config Sync can be configured to use a CA\ncertificate to verify HTTPS connections to the server. This is supported for Git,\nHelm, or OCI servers. The CA certificate\nmust include full SSL certificates (Root/Intermediate/Leaf).\nIf your server is already using a trusted CA or you are not connecting over HTTPS,\nyou can skip this step and leave `caCertSecretRef` unset. \n\n### `RootSync`\n\n1. Fetch the CA certificate which was used to issue the certificate for your\n Git server and save it to a file.\n\n2. For `RootSync` objects, the Secret must be created in the `config-management-system`\n namespace. For example:\n\n ```\n kubectl create secret generic ROOT_CA_CERT_SECRET_NAME \n\n --namespace=config-management-system \n\n --from-file=cert=/path/to/CA_CERT_FILE\n ```\n\n \u003cbr /\u003e\n\n3. When you configure the `RootSync` object,\n set the value of the `caCertSecretRef.name` field in the `RootSync`\n object to \u003cvar translate=\"no\"\u003eROOT_CA_CERT_SECRET_NAME\u003c/var\u003e.\n\n### `RepoSync`\n\n1. Fetch the CA certificate which was used to issue the certificate for your\n Git server and save it to a file.\n\n2. For `RepoSync` objects, the Secret must be created in the same namespace as the\n RepoSync. For example:\n\n ```\n kubectl create secret generic NAMESPACE_CA_CERT_SECRET_NAME \n\n --namespace=REPO_SYNC_NAMESPACE \n\n --from-file=cert=/path/to/CA_CERT_FILE\n ```\n\n \u003cbr /\u003e\n\n3. When you [configure the `RepoSync`](/kubernetes-engine/enterprise/config-sync/docs/how-to/multiple-repositories#manage-namespace-repos-in-namespace),\n set the value of the `caCertSecretRef.name` field in the `RepoSync`\n object to \u003cvar translate=\"no\"\u003eNAMESPACE_CA_CERT_SECRET_NAME\u003c/var\u003e.\n\nRemove the RootSync object\n--------------------------\n\nTo delete `root-sync`, run the following command: \n\n kubectl delete -f \u003cvar translate=\"no\"\u003eFILE_NAME\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eFILE_NAME\u003c/var\u003e with the name of your RootSync\nconfiguration file. For example, `root-sync.yaml`.\n\nDeleting a RootSync or RepoSync object does not clean up Config Sync\nannotations and labels. To clean up any managed resources, sync from an empty\nGit directory.\n\nWhat's next\n-----------\n\n- Learn more about the [RootSync and RepoSync fields](/kubernetes-engine/enterprise/config-sync/docs/reference/rootsync-reposync-fields).\n- Discover how to [Monitor RootSync and RepoSync objects](/kubernetes-engine/enterprise/config-sync/docs/how-to/monitor-rootsync-reposync)."]]