Bootstrap 과정 이해하기 Part. 1
Bootstrap 과정 이해하기 Part. 1에서는 Kustomization 이후 ArgoCD가 구성되는 과정에 대해서 살펴보도록 하겠습니다.
ArgoCD Template 구조
먼저 ArgoCD Template 구조를 살펴보기 위해 k8s-common-chart의 argocd directory에서 tree명령어를 입력하면 아래와 같이 출력되는 것을 확인할 수 있습니다.
k8s-common-chart/argocd > tree
.
├── argocd-ingress.yaml
├── argocd-rbac-cm.yaml
├── argocd-secrets.yaml
├── bootstrap.yaml
├── clustersecretstore.yaml
├── external-secrets.yaml
├── kustomization.yaml
└── namespace.yaml
ArgoCD를 구성할 때 k8s-chart-value/eksdapne2-aolu/argocd/kustomization.yml
가 있는 경로에서 kustomize build 후 kubectl apply를 쳤었습니다. 이 때 kustomization.yml
의 상단에 위치한 resources에 지정된 부분이 바로 ArgoCD의 Template이 됩니다. 그리고 그 아래의 Patch는 생성된 Resource들에 대해 지정한 부분(certification 설정 등)을 필요에 따라 patch 하게 됩니다.
ArgoCD Template 안에도 보면 kustomization.yaml
이 있는데, 이 yaml 또한 k8s-chart-value/eksdapne2-aolu/argocd/kustomization.yml
와 동일하게 ArgoCD Template 내부의 yaml을 resources로 생성하게 되고, 필요에 따라 patch를 하게 됩니다.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: argocd
resources:
# Create the argocd namespace
- namespace.yaml
# ClusterSecretStore: Operator for getting secrets from secrets manager or ssm
- clustersecretstore.yaml
# Create a external secret to sync the data
- external-secrets.yaml
# Set up the argocd secrets
- argocd-secrets.yaml
# Create the overall argocd Resources
- https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/ha/install.yaml
# Create the ingress for argocd
- argocd-ingress.yaml
# Register the bootstrap applications
- bootstrap.yaml
patches:
# Patch HA command option
- target:
group: apps
version: v1
kind: Deployment
name: argocd-server
patch: |-
- op: add
path: /spec/template/spec/containers/0/args/-
value: --insecure
각 yaml 역할
ArgoCD Template를 구성하는 yaml은 kustomization.yaml을 제외한 7개 yaml이 있습니다.
namespace.yaml
ArgoCD 리소스들을 생성하기 위해 argocd namespace를 생성하기 위한 yaml
external-secrets.yaml
Github Token이나 다른 Application 들에서 Secrets을 참조하는 Secrets Store에서 가져올 수 있도록 사용하는 Operator
clustersecretstore.yaml
위의 External Secrets Opreator에서 참조해서 가져올 수 있도록 SecretStore를 생성해야합니다. ClusterSecretStore는 여러 Namespace에서 해당 ClusterSecretStore를 참조해서 값을 가져오도록 하는데 사용됩니다.
여기서 사용되는 SecretStore는 AWS Systems Manager Parameter Store, AWS Secrets Manager 에서 값을 가져오게 됩니다.
argocd-secrets.yaml
ArgoCD에서 Git Repository를 참조할 떄 사용되는 Github Token을 External Secrets으로 가져와서 Kubernetes Secret으로 만들어서 참조하게 됩니다. 실습에서 사용되는 k8s-common-chart, k8s-app-chart, k8s-chart-value Repository를 참조하게 됩니다.
argocd-rbac-cm.yaml
SSO를 연동한 경우, SSO Group에 맞춰서 RBAC(Role Based Access Control)을 적용해야한다. 이 때 각 Group에서 접근할 수 있는 리소스에 대한 설정을 적용할 때 사용된다.
argocd-ingress.yaml
기본적으로 제공되는 Argocd 매니페스트에는 Ingress 가 포함되있지 않습니다. 따라서 ArgoCD에 접근하기 위한 목적으로 Ingress를 생성합니다. 여기에 기본적인 설정은 되있지만, Certificate와 host에 대한 정보는 k8s-chart-value의 argocd 경로에서 specify-ingress-v2-host-certificate.yaml
을 통해 주입됩니다.
bootstrap.yaml
k8s-common-chart/bootstrap
의 Helm Chart들을 하나의 Application으로 관리할 수 있도록 bootstrap이라는 application을 생성할 때 사용됩니다. 여기에 주입되는 value는 k8s-chart-value의 argocd 경로에서 add-boostrap-variables.yaml
을 통해 주입됩니다.
Last updated