Skip to content

fix: Ansible SSM 배포 안정성 수정 - #269

Merged
WAFriend3416 merged 4 commits into
mainfrom
feat/v3-k8s-iac
Mar 9, 2026
Merged

fix: Ansible SSM 배포 안정성 수정#269
WAFriend3416 merged 4 commits into
mainfrom
feat/v3-k8s-iac

Conversation

@WAFriend3416

Copy link
Copy Markdown
Contributor

Summary

  • Helm 설치 추가 (gateway-fabric에서 필요)
  • kubeadm join에 --node-name 추가 (worker label 불일치 방지)
  • Calico YAML Jinja2 인용 수정
  • SSM Agent snap → deb 패키지 (ARM64 안정성)
  • IAM S3 ListBucket 권한 추가
  • KUBECONFIG 환경변수 명시
  • ansible.cfg 정리 (SSH 제거, deprecation 경고 억제)
  • SSM S3 버킷 설정 추가

머지 후 순서

  1. Terraform apply (IAM + user_data 변경 반영)
  2. Ansible deploy

aws_ssm 플러그인은 모듈 파일 전송에 S3 버킷 필수.
dojangkok-v3-ansible-ssm 버킷 생성 및 인벤토리에 설정 추가.
OIDC Role에 S3 권한 추가.
- K8S 노드에 SSM Agent 설치 user_data 추가 (Ubuntu 24.04 미포함)
- K8S 노드 IAM Role에 S3 버킷 권한 추가 (aws_ssm 파일 전송용)
- IAM S3 권한에 s3:ListBucket 추가
- Phase 4 play에 KUBECONFIG 환경변수 명시
- ansible.cfg에서 SSH 설정 제거, deprecation 경고 억제
- Helm 설치 추가 (gateway-fabric role에서 필요)
- kubeadm join에 --node-name 추가 (label 시 노드 이름 불일치 방지)
- Calico YAML cidr 값 Jinja2 인용 수정
- SSM Agent snap → deb 패키지로 변경 (ARM64 안정성)
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Terraform Plan Result

Step Status
Format
Init
Validate
Plan ✅ (no changes)
Plan Output
data.aws_subnet.existing_public_2a: Reading...
module.k8s_networking.aws_route_table.private["b"]: Refreshing state... [id=rtb-0ef388ef9d04626ad]
data.aws_vpc.existing: Reading...
module.security_groups.aws_security_group.this["k8s-worker"]: Refreshing state... [id=sg-0eb102353fe218d7c]
module.iam.aws_iam_role.k8s_node: Refreshing state... [id=k8s-dev-k8s-node-role]
module.security_groups.aws_security_group.this["alb"]: Refreshing state... [id=sg-0fd2087b83241ae00]
data.aws_subnet.existing_public_2c: Reading...
module.nat_instance.data.aws_ami.ubuntu: Reading...
module.security_groups.aws_security_group.this["k8s-cp"]: Refreshing state... [id=sg-0d5c6758856f08de4]
module.nat_instance.aws_security_group.nat: Refreshing state... [id=sg-046863b47a5cc25ee]
module.k8s_networking.aws_route_table.private["c"]: Refreshing state... [id=rtb-081770596a8ef4708]
module.k8s_networking.aws_route_table.private["a"]: Refreshing state... [id=rtb-04a2d013db1067042]
module.k8s_networking.aws_subnet.subnets["k8s-2c"]: Refreshing state... [id=subnet-0106aaf456f78fd5e]
module.k8s_networking.aws_subnet.subnets["public-2b"]: Refreshing state... [id=subnet-05f16a9a1efe3c005]
module.k8s_networking.aws_subnet.subnets["k8s-2a"]: Refreshing state... [id=subnet-00a2042e138e1ecd2]
module.k8s_networking.aws_subnet.subnets["k8s-2b"]: Refreshing state... [id=subnet-02d8dd03a70651764]
data.aws_subnet.existing_public_2c: Read complete after 1s [id=subnet-08e037b9fbd856118]
module.k8s_nodes.data.aws_ami.ubuntu: Reading...
data.aws_subnet.existing_public_2a: Read complete after 1s [id=subnet-0d0295b4a08a503a9]
module.alb.aws_lb_target_group.gateway: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-2:662505429975:targetgroup/k8s-dev-k8s-gw/afb6d3a30fc143bb]
module.nat_instance.aws_iam_role.nat: Refreshing state... [id=k8s-dev-nat-role]
module.nat_instance.data.aws_ami.ubuntu: Read complete after 1s [id=ami-05d7ff9706f910b7d]
data.aws_internet_gateway.existing: Reading...
module.iam.aws_iam_role_policy_attachment.ssm: Refreshing state... [id=k8s-dev-k8s-node-role-20260309121557845700000005]
module.iam.aws_iam_role_policy.ecr_pull: Refreshing state... [id=k8s-dev-k8s-node-role:ecr-pull]
module.iam.aws_iam_instance_profile.k8s_node: Refreshing state... [id=k8s-dev-k8s-node-profile]
module.iam.aws_iam_role_policy.ebs_csi: Refreshing state... [id=k8s-dev-k8s-node-role:ebs-csi]
module.security_groups.aws_security_group_rule.ingress["k8s-worker-0"]: Refreshing state... [id=sgrule-3012860758]
module.security_groups.aws_security_group_rule.ingress["k8s-cp-4"]: Refreshing state... [id=sgrule-1354244792]
module.security_groups.aws_security_group_rule.ingress["k8s-worker-2"]: Refreshing state... [id=sgrule-885223098]
module.security_groups.aws_security_group_rule.ingress["k8s-cp-3"]: Refreshing state... [id=sgrule-2417291742]
module.security_groups.aws_security_group_rule.ingress["k8s-cp-5"]: Refreshing state... [id=sgrule-1974369562]
module.security_groups.aws_security_group_rule.ingress["k8s-cp-0"]: Refreshing state... [id=sgrule-1329480909]
data.aws_internet_gateway.existing: Read complete after 1s [id=igw-09f0f9ca0e2253420]
module.security_groups.aws_security_group_rule.ingress["k8s-cp-1"]: Refreshing state... [id=sgrule-4244024556]
module.k8s_nodes.data.aws_ami.ubuntu: Read complete after 1s [id=ami-05d7ff9706f910b7d]
module.security_groups.aws_security_group_rule.ingress["alb-0"]: Refreshing state... [id=sgrule-1850839637]
module.security_groups.aws_security_group_rule.ingress["k8s-cp-2"]: Refreshing state... [id=sgrule-4030896237]
module.security_groups.aws_security_group_rule.ingress["alb-1"]: Refreshing state... [id=sgrule-2146326490]
module.security_groups.aws_security_group_rule.ingress["k8s-worker-1"]: Refreshing state... [id=sgrule-1335755561]
module.security_groups.aws_security_group_rule.egress["alb"]: Refreshing state... [id=sgrule-2160571382]
module.security_groups.aws_security_group_rule.egress["k8s-cp"]: Refreshing state... [id=sgrule-2228715407]
module.security_groups.aws_security_group_rule.egress["k8s-worker"]: Refreshing state... [id=sgrule-2428394968]
aws_security_group_rule.alb_to_worker_nodeport: Refreshing state... [id=sgrule-3788724177]
data.aws_vpc.existing: Read complete after 2s [id=vpc-08b809f7d33f0f9b1]
module.k8s_networking.aws_route_table_association.private["k8s-2b"]: Refreshing state... [id=rtbassoc-0fe67314253cbeda2]
module.k8s_networking.aws_route_table_association.private["k8s-2c"]: Refreshing state... [id=rtbassoc-0c4f991dc3462d73b]
module.k8s_networking.aws_route_table_association.private["k8s-2a"]: Refreshing state... [id=rtbassoc-0a25b01071246f15d]
module.nat_instance.aws_iam_role_policy.nat_self_heal: Refreshing state... [id=k8s-dev-nat-role:nat-self-heal]
module.nat_instance.aws_iam_instance_profile.nat: Refreshing state... [id=k8s-dev-nat-profile]
module.nat_instance.aws_iam_role_policy_attachment.nat_ssm: Refreshing state... [id=k8s-dev-nat-role-20260309121558006300000006]
module.k8s_networking.aws_route_table.public[0]: Refreshing state... [id=rtb-039f93f48a4319ee6]
module.alb.aws_lb.this: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-2:662505429975:loadbalancer/app/k8s-dev-k8s-alb/87ddc20cc0b35393]
module.k8s_nodes.aws_instance.control_plane: Refreshing state... [id=i-067b8d8d002505e5e]
module.k8s_nodes.aws_instance.workers["w-2a-1"]: Refreshing state... [id=i-06164041f3ba02f5a]
module.k8s_nodes.aws_instance.workers["w-2b-1"]: Refreshing state... [id=i-0f814632ef4eaba95]
module.k8s_nodes.aws_instance.workers["w-2c-1"]: Refreshing state... [id=i-0713d1264e7f4e0d1]
module.nat_instance.aws_launch_template.nat: Refreshing state... [id=lt-06f441deafceba4f2]
module.k8s_networking.aws_route_table_association.public["public-2b"]: Refreshing state... [id=rtbassoc-062546cd59ab820f6]
module.nat_instance.aws_autoscaling_group.nat: Refreshing state... [id=k8s-dev-nat-asg]
module.alb.aws_lb_listener.https[0]: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-2:662505429975:listener/app/k8s-dev-k8s-alb/87ddc20cc0b35393/10b97a9115aa858b]
module.alb.aws_lb_listener.http: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-2:662505429975:listener/app/k8s-dev-k8s-alb/87ddc20cc0b35393/1753cdf377de8a77]
module.alb.aws_lb_target_group_attachment.workers["w-2c-1"]: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-2:662505429975:targetgroup/k8s-dev-k8s-gw/afb6d3a30fc143bb-2026030912162161130000000d]
module.alb.aws_lb_target_group_attachment.workers["w-2a-1"]: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-2:662505429975:targetgroup/k8s-dev-k8s-gw/afb6d3a30fc143bb-2026030912162212460000000f]
module.alb.aws_lb_target_group_attachment.workers["w-2b-1"]: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-2:662505429975:targetgroup/k8s-dev-k8s-gw/afb6d3a30fc143bb-2026030912162195770000000e]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # module.iam.aws_iam_role_policy.ssm_s3 will be created
  + resource "aws_iam_role_policy" "ssm_s3" {
      + id          = (known after apply)
      + name        = "ssm-s3-transfer"
      + name_prefix = (known after apply)
      + policy      = jsonencode(
            {
              + Statement = [
                  + {
                      + Action   = [
                          + "s3:GetObject",
                          + "s3:PutObject",
                          + "s3:DeleteObject",
                          + "s3:GetBucketLocation",
                          + "s3:ListBucket",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:s3:::dojangkok-v3-ansible-ssm",
                          + "arn:aws:s3:::dojangkok-v3-ansible-ssm/*",
                        ]
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + role        = "k8s-dev-k8s-node-role"
    }

  # module.k8s_nodes.aws_instance.control_plane will be updated in-place
  ~ resource "aws_instance" "control_plane" {
        id                                   = "i-067b8d8d002505e5e"
        tags                                 = {
            "Environment"      = "k8s-dev"
            "ManagedBy"        = "terraform"
            "Name"             = "k8s-dev-cp"
            "Project"          = "dojangkok"
            "k8s:cluster-name" = "dojangkok-v3"
            "k8s:nodepool"     = "system"
            "k8s:role"         = "control-plane"
        }
      + user_data                            = "36a3c6492d421275603efbd5b55ddb59396bf446"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

  # module.k8s_nodes.aws_instance.workers["w-2a-1"] will be updated in-place
  ~ resource "aws_instance" "workers" {
        id                                   = "i-06164041f3ba02f5a"
        tags                                 = {
            "Environment"      = "k8s-dev"
            "ManagedBy"        = "terraform"
            "Name"             = "k8s-dev-w-2a-1"
            "Project"          = "dojangkok"
            "k8s:cluster-name" = "dojangkok-v3"
            "k8s:nodepool"     = "default"
            "k8s:role"         = "worker"
        }
      + user_data                            = "36a3c6492d421275603efbd5b55ddb59396bf446"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

  # module.k8s_nodes.aws_instance.workers["w-2b-1"] will be updated in-place
  ~ resource "aws_instance" "workers" {
        id                                   = "i-0f814632ef4eaba95"
        tags                                 = {
            "Environment"      = "k8s-dev"
            "ManagedBy"        = "terraform"
            "Name"             = "k8s-dev-w-2b-1"
            "Project"          = "dojangkok"
            "k8s:cluster-name" = "dojangkok-v3"
            "k8s:nodepool"     = "default"
            "k8s:role"         = "worker"
        }
      + user_data                            = "36a3c6492d421275603efbd5b55ddb59396bf446"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

  # module.k8s_nodes.aws_instance.workers["w-2c-1"] will be updated in-place
  ~ resource "aws_instance" "workers" {
        id                                   = "i-0713d1264e7f4e0d1"
        tags                                 = {
            "Environment"      = "k8s-dev"
            "ManagedBy"        = "terraform"
            "Name"             = "k8s-dev-w-2c-1"
            "Project"          = "dojangkok"
            "k8s:cluster-name" = "dojangkok-v3"
            "k8s:nodepool"     = "default"
            "k8s:role"         = "worker"
        }
      + user_data                            = "36a3c6492d421275603efbd5b55ddb59396bf446"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

Plan: 1 to add, 4 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "tfplan"
Releasing state lock. This may take a few moments...

Pushed by: @WAFriend3416

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Ansible Syntax Check Result ✅

Step Status
Syntax Check
Lint

Pushed by: @WAFriend3416

@WAFriend3416
WAFriend3416 merged commit a7d59e1 into main Mar 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant