ããã«ã¡ã¯ãSRE ã® @int128 ã§ãã
Quipper ã§ã¯æ¥æ¬ãã°ãã¼ãã«åãã®ãµã¼ãã¹ãããããã® Amazon EKS ã¯ã©ã¹ã¿ã§æä¾ãã¦ãã¾ããService Level ãä¿ã¡ãªããã¯ã©ã¹ã¿ãéç¨ãã¦ããã«ã¯ Cluster Autoscaler ã Datadog Agent ãªã©ã®ã³ã³ãã¼ãã³ããå¿ è¦ä¸å¯æ¬ ã«ãªãã¾ããã¾ããDeveloper Productivity ãæ¹åãã¦ããããã«å 製ãã¼ã«ã§ GitHub ã CI ãªã©ã®ã¡ããªã¯ã¹ãã¢ãã¿ãªã³ã°ããåãçµã¿ãé²ãã¦ãã¾ããQuipper ã§ã¯ãã®ãããªã·ã¹ãã å ±éã®ã³ã³ãã¼ãã³ãã System Components ã¨å¼ãã§ãã¾ãã
Service Level ã Developer Productivity ãç¶ç¶çã«æ¹åãã¦ããã«ã¯ãã³ã³ãã¼ãã³ãã®è¨å®å¤æ´ãç´ æ©ã試ããããæ°ããã³ã³ãã¼ãã³ããç°¡åã«å°å ¥ãããã§ããç°å¢ãä¸å¯æ¬ ã§ããæ¬è¨äºã§ã¯ SRE ãç´é¢ãã課é¡ã¨ ArgoCD ã Renovate ã«ãã解決çãç´¹ä»ãã¾ãã
課é¡ã¨è§£æ±ºç
ããã¾ã§ System Components ã®ãããã¤ã¯ CircleCI ä¸ã§ã·ã§ã«ã¹ã¯ãªãããå®è¡ãã¦ãã¾ãããSystem Components ã®æ°ãå°ãªãæ§æãã·ã³ãã«ãªå ´åããã®ãã㪠CI Ops ã¨å¼ã°ããæ¹æ³ã§ååã§ãããããããQuipper ã§ã¯ Cluster Autoscaler ã Horizontal Pod Autoscaler ãªã©ã®å°å ¥ãçµã¦ System Components ã®æ°ã大ããå¢å ãã¾ããã
ä¾ãã°ãæ¥æ¬åãã®ã¹ã¿ãã£ãµããªã®éçºã§å©ç¨ãã¦ãã staging ã¯ã©ã¹ã¿ã§ã¯ãSystem Components ã®æ°ã¯ä»¥ä¸ã®ããã«æ¨ç§»ãã¦ãã¾ããã
- 2020å¹´3ææç¹: 9件
- 2020å¹´6ææç¹: 13件
- 2020å¹´9ææç¹: 15件
- 2020å¹´12ææç¹: 22件ï¼GitOpså°å ¥å¾ï¼
SRE ã管çãã¦ããã¯ã©ã¹ã¿ã¯è¨4ã¤ãããã¯ã©ã¹ã¿ãã¨ã« System Components ã®æ§æã¯å°ããã¤éãã¾ããä¾ãã°ãstaging ã¯ã©ã¹ã¿ã§ã¯ãªã½ã¼ã¹å¹çãæ¹åããããã«è©¦é¨çã« Vertical Pod Autoscaler ãå°å ¥ãã¦ãã¾ããã¾ããå æ¥ @chaspy ãç´¹ä»ãã HPA External Metrics ã«ãã Scheduled Scaling ã®ä»çµã¿ã¯ã°ãã¼ãã«åãã®ã¯ã©ã¹ã¿ã§ã®ã¿éç¨ãã¦ãã¾ãã
è¤éã«å¢å ãç¶ãã System Components ãããã¾ã§ã®ææ³ã§ç®¡çããã®ã¯éçãè¿ãã¦ãã¾ãããããã§ããããã§ã¹ãã®æ§æããããã¤ã®ä»çµã¿ãæ¹åãããã¨ã«ãã¾ããã
ããã¾ã§ã®ã·ã§ã«ã¹ã¯ãªããã«ãããããã¤ã§ã¯ã以ä¸ã®ãããªèª²é¡ãããã¾ããã
- æéã®çµéã¨ã¨ãã«æ¡ä»¶åå²ã kustomize patch ãå¢ãã¦ããããã¤ã¹ã¯ãªããã®ä¿å®æ§ãæªåãã¦ãã
- ãããã¤ã¹ã¯ãªãããããªã½ã¼ã¹ãåé¤ããå ´åããªã½ã¼ã¹ã®ååãå¤æ´ããå ´åã¯ãæä½æ¥ã§
kubectl delete
ãå®è¡ããå¿ è¦ããã - ã³ã³ãã¼ãã³ãã®ãã¼ã¸ã§ã³ãèªåçã«ä¸ããä»çµã¿ããªããããå¤ããã¼ã¸ã§ã³ã®ã³ã³ãã¼ãã³ãã使ãç¶ãã¦ãã¾ã
ã¾ãã課é¡1ã解決ããããã«ãããã§ã¹ãã®å ±éåãããã¦ã¯ã©ã¹ã¿åä½ã§ãããã§ã¹ãã管çãããã¨ã«ãã¾ãããYAMLãã¡ã¤ã«ãå¤§å¹ ã«å¢ãããã¡ãªããã¯ããã¾ãããæ¡ä»¶åå²ãããããèªã¿è§£ãè² æ ããªããªããã¨ãã¯ã©ã¹ã¿åä½ã®è¨å®å¤æ´ã容æã«ãªããã¨ã®ã¡ãªããã大ããã¨èãã¾ãããå ·ä½çã«ã¯ã以ä¸ã®ãããªãã£ã¬ã¯ããªæ§æã§ãããã§ã¹ãã管çãã¦ãã¾ãã
system-components âââ overlays âââ CLUSTER_NAME â âââ COMPONENT_NAME â âââ ... âââ ...
overlays
ãã£ã¬ã¯ããªã«ã¯ã¯ã©ã¹ã¿ãã¨ã«ãããã§ã¹ããé
ç½®ãã¾ããå
±éé¨åãä½ãã¨ã¯ã©ã¹ã¿åä½ã§ã®å¤æ´ãé£ãããªããã base
ã¯ä½ããªãã«ã¼ã«ã«ãã¦ãã¾ããä»ã®ã¨ãã base
ã®å¿
è¦æ§ãæããå ´é¢ã¯ããã¾ããã
課é¡2㯠GitOps ã¸ã®ç§»è¡ã§è§£æ±ºã§ãã¾ããã¾ãã課é¡3㯠GitOps 㨠Renovate ãçµã¿åããããã¨ã§è§£æ±ºã§ãã¾ãã
ãããã®è§£æ±ºçã詳ãã説æãã¦ããã¾ãã
GitOps ã¸ã®ç§»è¡
Quipper ã§ã¯ãã§ã« ArgoCD ãå°å ¥ãã¦ãããã¢ããªã±ã¼ã·ã§ã³ã® GitOps 移è¡ã«åãçµãã§ãã¾ããSystem Components ã«ã¤ãã¦ãåæ§ã« ArgoCD ãå©ç¨ãããã¨ã«ãã¾ããã
GitOps ã¸ã®ç§»è¡ãå§ãã9ææç¹ã§ã¯ã4ã¯ã©ã¹ã¿ã§åè¨59件ã®ã³ã³ãã¼ãã³ããããã¾ãããã³ã³ãã¼ãã³ãã®æ°ãå¤ããã¨ãæ¥ã ã®éç¨ã§ç¶ç¶çãªå¤æ´ããããã¨ãèããã¨ããããã§ã¹ãã®æ´æ°ãæ¢ãã¦ãã¹ã¦ã®ã³ã³ãã¼ãã³ããä¸åº¦ã« GitOps ã«ç§»è¡ãããã¨ã¯ä¸å¯è½ã§ããã
ããã§ãã³ã³ãã¼ãã³ããã¨ã«ä»¥ä¸ã®æé ãç¹°ãè¿ããã¨ã«ãã¾ããã
- Git ãªãã¸ããªã® topic branch ã«ãããã§ã¹ãã追å ãã
- ArgoCD ã® Application ãªã½ã¼ã¹ã追å ããããã®æãApplication ãªã½ã¼ã¹ã®åç §å ã topic branch ã«ãã¦ãauto sync ãç¡å¹ã«ãã¦ãã
- ArgoCD ã§ã¯ã©ã¹ã¿ã¨ãããã§ã¹ãã®å·®åã確èªãã
- Git ãªãã¸ããªã§ Pull Request ãä½æããã¬ãã¥ã¼ããé¡ããã
- ã¬ãã¥ã¼å¾ã« Pull Request ããã¼ã¸ããã¨ãArgoCD ã«ãã£ã¦ãããã¤ããã
- ãããã¤ã¹ã¯ãªããããã³ã³ãã¼ãã³ããåé¤ãã
å¾è¿°ãã IAM Roles for Service Accounts ã®å°å ¥ãªã©ãGitOps ã¸ã®ç§»è¡ã§ã³ã³ãã¼ãã³ãã®æ§æãå¤ããå ´åã¯ãæé 3ã§ãããã§ã¹ãã sync ãã¦åä½ç¢ºèªããªããé²ãã¾ããã
ã¾ãããã¼ã ã§ç§»è¡ä½æ¥ã«åãçµããããã«å ã»ã©ã®æé ã Migration Guide ã«ã¾ã¨ãã¦å ±æãã¾ãããæåã®ã¯ã©ã¹ã¿ã¯ @int128 ã試è¡é¯èª¤ããªããé²ãã¾ããããæ®ãã®3ã¯ã©ã¹ã¿ã«ã¤ãã¦ã¯ @chaspy @rbmrclo ãååãã¦ããã¾ããã
GitOps ã¸ã®ç§»è¡ã«ããã£ã¦ã¯ä»¥ä¸ã®æè¡ç課é¡ãèæ ®ãã¾ããã
1. ã¯ã¬ãã³ã·ã£ã«ã®åãæ±ã
ããã¾ã§ã®ãããã¤ã¹ã¯ãªããã§ã¯ CircleCI ã®ç°å¢å¤æ°ãéãã¦ã¯ã¬ãã³ã·ã£ã«ãåãåã£ã¦ãã¾ãããä¾ãã° Datadog ã® API ãã¼ãããã¾ããGitOps ã¸ã®ç§»è¡ã«ããã£ã¦ã¯ãã¯ã¬ãã³ã·ã£ã«ãå¥ã®ä»çµã¿ã§ç®¡çããå¿ è¦ãããã¾ãã
Quipper ã§ã¯ãã§ã«ã¢ããªã±ã¼ã·ã§ã³ã®ã¯ã¬ãã³ã·ã£ã«ã aws-secret-operator ã§ç®¡çãã¦ãã¾ããSystem Components ã®ã¯ã¬ãã³ã·ã£ã«ã«ã¤ãã¦ã aws-secret-operator ã«ç§»è¡ãããã¨ã«ãã¾ãããããã§ã¯ã¬ãã³ã·ã£ã«ãå®å ¨ã«ãããã¤ã§ãã¾ãã
AWS API ãå©ç¨ããã³ã³ãã¼ãã³ãã§ã¯ããã¾ã§ IAM Access Key ãå©ç¨ãã¦ãã¾ãããããããaws-secret-operator ãå©ç¨ãã IAM Access Key ã aws-secret-operator ã§ç®¡çããå ´åã誰ãæåã« IAM Access Key ãã¯ã©ã¹ã¿ã«ãããã¤ããã®ãã¨ããåé¡ãããã¾ãããã®ãããªé¶ã¨åµã®åé¡ããã¯ã¬ãã³ã·ã£ã«ã®æ¼æ´©ãªã¹ã¯ãè¸ã¾ãã¦ããã®æ©ä¼ã«ãã¹ã¦ã® System Components ã IAM Roles for Service Accounts (IRSA) ã«ç§»è¡ãããã¨ã«ãã¾ãããIRSA ã«ã¤ãã¦ã¯å¥ã®è¨äºã§ç´¹ä»ããäºå®ã§ãã
2. Helm chart ã®åãæ±ã
Datadog Agent ãªã©ã®ä¸é¨ã®ã³ã³ãã¼ãã³ãã§ã¯ Helm chart ããããã¤ãã¦ãã¾ããArgoCD 㧠Helm chart ããããã¤ããã«ã¯ä»¥ä¸ã®é¸æè¢ãããã¾ãã
- ArgoCD 㧠Helm releases ã管çãã
helm template
ã§ã¬ã³ããªã³ã°ãããããã§ã¹ãã Git ãªãã¸ããªã«æ ¼ç´ããArgoCD ã§ãããã¤ãã
åè ã¯æ§æ管çãã·ã³ãã«ã§ããä¸æ¹ã§ãå¾è ã®å ´åãå®éã«ãããã¤ããããããã§ã¹ãã Pull Request ã§ç¢ºèªã§ãã¾ããQuipper ã§ã¯ Pull Request ã®ã¬ãã¥ã¼ããã¼ãå®çãã¦ãããå¾è ã®ã¡ãªããã大ããã¨èãã¾ããã
Helm chart ã®ç®¡çã«ã¯ Helmfile ãå©ç¨ãã¦ãã¾ããHelmfile ãå©ç¨ããã¨ãchart ã® URL ããã¼ã¸ã§ã³ã YAML ãã¡ã¤ã«ã§å®£è¨çã«ç®¡çã§ãã¾ããã¾ããRenovate ã Helmfile ã«å¯¾å¿ãã¦ãããããç¶ç¶çãªãã¼ã¸ã§ã³ã¢ãããå¯è½ã§ãã
ã³ã³ãã¼ãã³ãã®è¨å®ãå¤æ´ããå ´åã¯ä»¥ä¸ã®ãããªä½æ¥ããã¼ã«ãªãã¾ãã
- ã³ã³ãã¼ãã³ããå©ç¨ãã Helm chart ã®
values.yaml
ãä¿®æ£ãã make
ã³ãã³ãã§ã¬ã³ããªã³ã°æ¸ã¿ãããã§ã¹ããæ´æ°ãã- Pull Request ãä½æãã
- Pull Request ãã¬ãã¥ã¼ãã
- Pull Request ããã¼ã¸ããã¨ãArgoCD ã«ãã£ã¦ãããã¤ããã
ããæé 2ãå¿ããå ´åã§ã CI ã§ã¬ã³ããªã³ã°æ¸ã¿ãããã§ã¹ããèªåçã«æ´æ°ãããããã«ãã¦ãã¾ãã人éã¯ãã¤ããã¹ããã¦ãã¾ãã®ã§ãæ©æ¢°ããã¹ããå®ã£ã¦ãããä»çµã¿ã好ãã§ãã
ãã㧠Helm chart ã確å®ãã¤ç¶ç¶çã«ãããã¤ãã¦ãããããã«ãªãã¾ããã
3. App of Apps Pattern ã«ããéç´ç®¡ç
ArgoCD ã®ããã¥ã¡ã³ãã§ã¯ App of Apps ã¨ãããã¿ã¼ã³ãç´¹ä»ããã¦ãã¾ãããã®ãã¿ã¼ã³ã§ã¯ãå Application ãªã½ã¼ã¹ãæãã親 Application ãªã½ã¼ã¹ãå®ç¾©ãããã¨ã§ãè¤æ°ã® Application ãã¾ã¨ãã¦ç®¡çã§ãã¾ãã
Quipper ã§ã¯ã¯ã©ã¹ã¿åä½ã« ArgoCD ã管çãã¦ãããããã¯ã©ã¹ã¿åä½ã«è¦ª Application ãªã½ã¼ã¹ãå®ç¾©ãããã¨ã«ãã¾ãããå ·ä½çã«ã¯ã以ä¸ã®ãããªãã£ã¬ã¯ããªæ§æ㧠Application ã管çãã¦ãã¾ãã
system-components âââ overlays âââ staging-cluster-01 â âââ bootstrap â â âââ system-components.yaml # 親 Application ãªã½ã¼ã¹ â âââ applications â â âââ argocd.yaml # å Application ãªã½ã¼ã¹ â â âââ ... # å Application ãªã½ã¼ã¹ â âââ argocd â â âââ kustomization.yaml # ArgoCD ã®ãããã§ã¹ã â â âââ deployment.yaml # ArgoCD ã®ãããã§ã¹ã â â âââ ...
親 Application ã§ã¯ applications
ãã£ã¬ã¯ããªãåç
§ããããã«ãã¾ãããã®ããã«è¨è¨ãããã¨ã§ãArgoCD 㯠applications
ãã£ã¬ã¯ããªã«ãã Application ãªã½ã¼ã¹ããã¹ã¦ãããã¤ãã¦ããã¾ããã¾ããapplications
ãã£ã¬ã¯ããªã«æ°ãã Application ãªã½ã¼ã¹ã追å ããã¨ãArgoCD ãå¤æ´ãæ¤ç¥ãã¦ãããã¤ãã¦ããã¾ãã
ArgoCD Server ã§ã¯ä»¥ä¸ã®ããã«è¡¨ç¤ºããã¾ãã
éå»ã« @d-kuro ã App of Apps Pattern ãæ¤è¨ãã¦ãããã¨ãããããã£ã¬ã¯ããªã Application ãªã½ã¼ã¹ã®æ§æã«ã¤ãã¦ã¯å½¼ã¨è°è«ããªããè¨è¨ãé²ãã¾ããã
4. ã¯ã©ã¹ã¿ã®åæå
EKS ã¯ã©ã¹ã¿ãåæåããã«ã¯ä»¥ä¸ã®ã³ã³ãã¼ãã³ããå¿ è¦ã§ãã
- aws-secret-operatorï¼ArgoCD ã®ã¯ã¬ãã³ã·ã£ã«ã管çããããï¼
- ArgoCD
- 親 Application
ãããã®ã³ã³ãã¼ãã³ãããããã¤ããã°ãArgoCD ãå Application ãèªåçã«ãããã¤ãã¦ããã¾ãã
ã§ã¯ããããã®ã³ã³ãã¼ãã³ããã©ããªæ段ã§ãããã¤ããã°ããã§ãããããQuipper ã§ã¯ AWS CodeBuild 㧠Terraform ãå®è¡ã㦠AWS ãªã½ã¼ã¹ã管çãã¦ãããã¨ãè¸ã¾ããã¨ã以ä¸ã®æ¹æ³ãèãããã¾ãã
- æ°ãã EKS ã¯ã©ã¹ã¿ã®ä½ææã« Terraform ããåæåã¹ã¯ãªãããèªåå®è¡ãã
- æ°ãã EKS ã¯ã©ã¹ã¿ãåæåããããã® CodeBuild Project ãç¨æããåæåã¹ã¯ãªãããæåå®è¡ãã
Terraform å®ç¾©ãã¡ã¤ã«ã¨ Kubernetes ãããã§ã¹ããã¡ã¤ã«ã¯ããããå¥ã®ãªãã¸ããªã§ç®¡çãã¦ãããããå¾è ãé¸æãã¾ããã
æçµçã«ãæ°ããã¯ã©ã¹ã¿ãæ§ç¯ããæé ã¯ä»¥ä¸ã®ããã«ãªãã¾ããã
- SRE ã Terraform 㧠æ°ãã EKS ã¯ã©ã¹ã¿ã追å ããããã® Pull Request ãä½æãã
- SRE ã Pull Request ããã¼ã¸ãã
- AWS CodeBuild ã§
terraform apply
ãå®è¡ããã¦ãèªåçã«ä»¥ä¸ã®ãªã½ã¼ã¹ãä½æããã- æ°ãã EKS ã¯ã©ã¹ã¿
- æ°ãã EKS ã¯ã©ã¹ã¿ãåæåããããã® CodeBuild Project
- SRE ã¯ã¯ã©ã¹ã¿åæåç¨ã® CodeBuild Project ãæåå®è¡ãã
- AWS CodeBuild ã§
kubectl apply
ãå®è¡ããã¦ãæå°éã®ã³ã³ãã¼ãã³ãããããã¤ããã - ArgoCD ã§æ®ãã®ã³ã³ãã¼ãã³ãããããã¤ããã
Renovate ã«ããç¶ç¶çãªãã¼ã¸ã§ã³ã¢ãã
Quipper ã§ã¯ Renovate ã¨ãããµã¼ãã¹ãå©ç¨ãã¦ãã¾ããRenovate ã¯ã©ã¤ãã©ãªãããã«ã¦ã§ã¢ãªã©ã®ãã¼ã¸ã§ã³ã¢ããã Pull Request ã§éç¥ãã¦ããããµã¼ãã¹ã§ããä¾ãã°ãingress-nginx ã¨ããã³ã³ãã¼ãã³ãã®æ°ãããã¼ã¸ã§ã³ããªãªã¼ã¹ãããã¨ã以ä¸ã®ãã㪠Pull Request ãä½æããã¾ãã
ããã¯ã©ããªä»çµã¿ã§å®ç¾ãã¦ããã®ã§ãããããå®ã¯ kustomization.yaml
ã helmfile.yaml
ããªãã¸ããªã«ç½®ãã¦ããã ãã§ãRenovate ãèªåçã« Pull Request ãéã£ã¦ããã¾ããå
ã»ã©ã®ä¾ã 㨠helmfile.yaml
ã以ä¸ã®ããã«å¤æ´ãã Pull Request ãä½æããã¾ãã
repositories: - name: ingress-nginx url: https://kubernetes.github.io/ingress-nginx releases: - name: ingress-nginx chart: ingress-nginx/ingress-nginx - version: 3.13.0 + version: 3.15.2 values:
Renovate ãå¹æçã«æ´»ç¨ããã«ã¯è¨å®ã«å·¥å¤«ãå¿ è¦ã§ããSystem Components ã®ãã¼ã¸ã§ã³ã¢ããã¯ã¯ã©ã¹ã¿åä½ã§è¡ãããï¼åºæ¬çã« staging ã§åä½ç¢ºèªãã¦ãã production ã«å±éããï¼ã®ã§ãRenovate ã§ã¯ã¯ã©ã¹ã¿åä½ã§ Pull Request ãä½æãããããã«è¨å®ãã¦ãã¾ãããã®ã¸ã㯠@suzuki-shunsuke ãå¿«é©ãªç°å¢ãæ´åãã¦ããã¾ããã詳ãã㯠Renovate ã® Tips ãã覧ãã ããã
ã¾ã¨ã
System Components ã®ãããã¤ã GitOps ã«ç§»è¡ãããã¨ã§ä»¥ä¸ã®å¹æããã£ãã¨èãã¦ãã¾ãã
ã¾ããæç¶ãåãã宣è¨åã®ãããã¤æ¹å¼ã«å¤ãããã¯ã©ã¹ã¿ã«ã©ããªãããã§ã¹ããé ç½®ããã¦ãããåããããããªãã¾ãããããã«ãããè¨å®ã®å¤æ´ãæ°ããã³ã³ãã¼ãã³ãã®è¿½å ãç°¡åã«ã§ããããã«ãªãã¾ãããçµæçã«ãService Level ã Developer Productivity ãæ©ããµã¤ã¯ã«ã§æ¹åãã¦ããããã®åºç¤ãã§ãã¾ããã
ã¾ãããªã½ã¼ã¹ã®åé¤ãååå¤æ´ãè¡ã£ãå ´åã ArgoCD ã確å®ã«ãªã½ã¼ã¹ãåé¤ãããããã¯ã©ã¹ã¿ã«ã´ããæ®ããªãããã«ãªãã¾ãããkubectl apply
ã«ãããããã¤ã§ã¯ä¸è¦ãªãªã½ã¼ã¹ãæä½æ¥ã§åé¤ããå¿
è¦ãããã¾ããããã¤ãã¤ãå¿ãã¦ãã¾ããã¨ãããã¾ãããã¯ã©ã¹ã¿ãããããªç¶æ
ã«ä¿ã¤ãã¨ã§ãèªç¥è² è·ã軽æ¸ããå¹æããã£ãã¨èãã¦ãã¾ãã
GitOps ã«å ã㦠Renovate ãå©ç¨ãããã¨ã§ãã³ã³ãã¼ãã³ãã®ãã¼ã¸ã§ã³ã¢ãããç°¡åãã¤ç¶ç¶çã«è¡ããããã«ãªãã¾ãããããã«ãããã»ãã¥ãªãã£ããããæ°æ©è½ã¸ã®å¯¾å¿ãæ©ããªã£ãã¨æãã¦ãã¾ãã
Quipper ã§ã¯ä¸çã®æã¦ã¾ã§å¦ã³ãå±ããã仲éãåéãã¦ãã¾ãããªããçè ãæå±ãã SRE Team ãåéä¸ã§ããã«ã¸ã¥ã¢ã«é¢è«ãå¿åããå¾ ã¡ãã¦ãã¾ãã