본문 바로가기

IAC35

[AWS EKS] CoreDNS Addon을 FARGATE로 띄우기 (w. Terraform) # 0. 서론eks의 모든 노드들을 카펜터로 띄우기 시작했다.카펜터가 아닌 노드가 없기 때문에 karpenter 자체는 fargate로 띄워야만 했다.여기까지는 managed node group > karpenter로 마이그레이션하다가 알게 된 것이고.. 카펜터만 띄우는 설정으로 새로 클러스터를 띄우다보니 coredns가 karpenter보다 먼저 떠야 한다는 것을 알게 되었다.(카펜터도 내부 dns에 의존하는 무언가가 있나보다. 더 자세히 알아보진 않았다.) 따라서 karpenter와 마찬가지로 coredns도 fargate로 띄우도록 설정을 변경하게 되었다.이 때 필요한 과정을 terraform으로 설명하겠다. # 1. coredns fargate profile 생성loc.. 2024. 4. 28.
[Terraform Associate (003)] 2024-02-17 합격 후기 https://www.credly.com/badges/797fde64-28d6-4dd8-b59d-2ff7a1ab2309/public_url HashiCorp Certified: Terraform Associate (003) was issued by HashiCorp to Sumin Hong.Earners of the HashiCorp Certified: Terraform Associate certification know the basic concepts, skills, and use cases associated with open source HashiCorp Terraform. They understand and can utilize Terraform according to the certificat.. 2024. 2. 18.
[EKS/Terraform] Secondary IP 줄이기 with Terraform # 현상 18개 파드가 존재하는 10.10.0.218 노드가 있다. 그러나 해당 노드엔 2개 eni / eni포함 총 60개의 ip가 붙어있다.... 다른 노드들도 사용하는 파드들에 비해 상당히 많은 ip들을 갖고 있었고, 이로 인해 서브넷에 가용 ip가 부족해졌다. # 분석 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI Elastic network interfaces - Amazon Elastic Compute Cloud For EC2 instances in an IPv6-only subnet, if you attach a secondary network interface to the instanc.. 2024. 2. 6.
[Terraform] AD User 만들기 # 사용한 프로바이더 https://registry.terraform.io/providers/l-with/ldap/latest/docs Terraform Registry registry.terraform.io terraform { required_providers { ldap = { source = "l-with/ldap" version = ">= 0.4" } } } locals { ad_server_ip = "1.1.1.1" ad_domain = "honglab.com" ad_admin_pw = "" } provider "ldap" { host = local.ad_server_ip port = 389 tls = false bind_user = "Admin@${local.ds_domain}" bind_p.. 2024. 1. 31.
[Cluster-Autoscaler] Over Provisioning with Terraform # 현상 node의 cpu / memory가 거의 대부분 점유되고 있는 상황에서도 node가 늘어나지 않고 있다. 내가 생각했을 때 CA를 사용하면 노드 리소스가 80% 이상 사용 중일 때 새로 노드 추가 ~ 뭐 이런식으로 진행될 줄 알았는데, 그게 아니었다. 노드가 새로 추가되는건 노드에 자리가 없어서 배치되지 못하는 pod가 존재할 때 … 이다. 사실 쿠버네티스 사용 목적 등을 생각하면 그게 맞다. 하지만 파드가 하나 새로 떠야되는데 그 때서야 노드 프로비저닝을 시작한다? → 느리다. → 어느정도의 over provisioning이 필요하다. # Over Provisioning https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscal.. 2023. 11. 26.
[ArgoCD] repo-server PVC 붙이기 (w. Terraform) # argocd repo-server 란? https://argo-cd.readthedocs.io/en/stable/operator-manual/server-commands/argocd-repo-server/ Argocd repo server - Argo CD - Declarative GitOps CD for Kubernetes Argocd repo server argocd-repo-server Run ArgoCD Repository Server Synopsis ArgoCD Repository Server is an internal service which maintains a local cache of the Git repository holding the application manifests, an.. 2023. 11. 3.
[Keycloak 21/Terraform] AWS SAML 로그인 연동하기 # provider 설정 2023.10.29 - [공부/IaC] - [Terraform] Keycloak Provider 구성하기 (Keycloak 21) # 로컬 변수 설정 locals { keycloak_url = "" # keycloak 주소 keycloak_realm = "" # aws용 keycloak realm 이름 } # [keycloak] aws client 생성 resource "keycloak_saml_client" "aws" { realm_id = local.keycloak_realm client_id = "urn:amazon:webservices" idp_initiated_sso_url_name = "amazon-aws" assertion_consumer_post_url = "htt.. 2023. 10. 29.
[Terraform] Keycloak Provider 구성하기 (Keycloak 21) # 공식 문서 https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs#client-credentials-grant-setup-recommended Terraform Registry registry.terraform.io 여기에 어느정도 설명은 나와있으나, 21버전/사진 과 함께 설명해본다. # Terraform용 Client 생성 키클락 내 모든 권한을 갖도록 만들 것이다. -> master realm에서 client를 만들어야 한다. Client ID만 필수로 정해주자 > 하단의 Next Capability Config도 수정해주자 Client authentication : ON Standard flow : OFF Direct ac.. 2023. 10. 29.
[terraform-provider-kubernetes/Issue] StorageClass ReclaimPolicy 관련 이미 생성된 Strorage Class의 경우, Reclaim Policy를 변경할 수 없다. 그러나 Terraform 으로 변경 시도 시 변경된다고 뜸 -> 실제로 변경되진 않음 Terraform으로 변경 시도 시, replacement되도록 변경되어야 한다. 이미 누가 이슈를 올려놨다. https://github.com/hashicorp/terraform-provider-kubernetes/issues/1965 Storage class reclaim_policy changes don't force recreation · Issue #1965 · hashicorp/terraform-provider-kubernetes For a plan like this: # kubernetes_storage_class.. 2023. 9. 5.
[RBAC & IRSA] ECR Secret Updater Cronjob 구성 pod가 ECR의 이미지를 받아오는 방법은 여러가지가 있다. 1. EKS에서 보편적이고 권장되는 방법인, EKS Node Role의 권한으로 받아오는 것 2. ECR Token 값을 받아와 Docker Secret으로 저장 후 pod가 해당 Secret을 물고 올라감 나도 당연히 우리 회사의 새 아키텍처에서 1번으로 세팅해두고 싶었다. 그러나! 새 아키텍처에서는 "모든 계정의 클러스터" 에서 "공용 계정의 ECR" 에서 이미지를 받아오는 것으로 결정됐다. 뭐...그래도 Cross Account로 받아오는 방법이 당연 있을텐데, 역시 ECR Repository 단위로 타 계정을 허용해줄 수 있었다. { "Version": "2008-10-17", "Statement": [ { "Sid": "AllowPus.. 2023. 9. 4.