EKS에서 단일 애플리케이션을 n개의 POD으로 다중 배포하기(4)

안녕하세요 오늘은 BESPIN GLOBAL innovate AI실 송규호님이 작성해주신 ‘EKS에서 단일 애플리케이션을 n개의 POD으로 다중 배포하기(1)’ 무엇인지 소개해드리도록 하겠습니다.

AWS EKS 환경에서 단일 애플리케이션에 대하여 일부 환경변수만 변경하여 다중 배포하는 방법인데요. 변경이 필요한 부분은 각 애플리케이션 환경마다 AWS Parameter Store에 변수 등록을 한 후 Codebuild 환경변수에서 제어 하여 배포하는 방식입니다.

목차
  1. EKS 환경 구축
  2. 샘플 애플리케이션 생성 후 AWS Code Commit 연동
  3. 도커 이미지 만들고 ECR 설정
  4. CodeBuild 설정
  5. parameter store 설정, codebuild 환경변수 설정 후 애플리케이션 배포 실행

5. parameter store 설정, codebuild 환경변수 설정 후 애플리케이션 배포 실행

  • parameter-store에 변수 등록

같은 namespace에서 여러개의 pod 배포 시, parameter-store 변수 세팅 namespace명을 동일하게 설정

다른 namespace에 구성 시, parameter-store 변수 세팅 namespace명을 다르게 설정

parameter-store 변수 세팅 namespace명을 다르게 설정

namespace|app-name|Limit-CPU|Limit-Memroy|Requests-CPU|Requests-Memory

  • 빌드 실패
[Container] 2024/03/18 03:15:04.996261 Running command kubectl apply -f kubernetes/deployment.yaml
error: You must be logged in to the server (the server has asked for the client to provide credentials)

[Container] 2024/03/18 03:15:06.254708 Command did not exit successfully kubectl apply -f kubernetes/deployment.yaml exit status 1
[Container] 2024/03/18 03:15:06.258949 Phase complete: POST_BUILD State: FAILED
[Container] 2024/03/18 03:15:06.258970 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: kubectl apply -f kubernetes/deployment.yaml. Reason: exit status 1
  • Troble Shooting :

eks 서비스 들어가서 IAM 액세스 항목에 codebuild role 추가

Troble Shooting :
최종 buildspec.yml
  • 최종 buildspec.yml
version: 0.2 

env:
  parameter-store:
    PLANT_DEPLOY_INFO: "$PARAM_SOTRE" 
phases: 
  install: 
    runtime-versions: 
      nodejs: 20
    commands: 
      - set -x
      - echo $PLANT_DEPLOY_INFO
      - NAMESPACE2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f1)"
      - APP_NAME2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f2)"
      - LIMITS_CPU2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f3)"
      - LIMITS_MEM2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f4)"
      - REQ_CPU2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f5)"
      - REQ_MEM2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f6)"
      - apt update
      - apt install bc -y
      - curl -o kubectl <https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl>
      - chmod +x ./kubectl
      - mv ./kubectl /usr/local/bin/kubectl
      - mkdir ~/.kube
      - curl -L <https://istio.io/downloadIstio> | ISTIO_VERSION=1.21.0 TARGET_ARCH=x86_64 sh -
      - chmod +x ./istio-1.21.0/bin/istioctl
      - mv ./istio-1.21.0/bin/istioctl /usr/local/bin/istioctl
      - aws eks update-kubeconfig --name sgh --region $AWS_DEFAULT_REGION
      - cat ~/.kube/config
      - echo Installing source NPM dependencies...
      - npm install
  pre_build: 
    commands: 
      - echo Logging in to Amazon ECR...
      - docker login --username AWS -p $(aws ecr get-login-password --region $AWS_DEFAULT_REGION) $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/
  build: 
    commands: 
      - echo Build started on `date` 
      - echo Building the Docker image...    
      - npm run build
      - docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG . 
      - docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG 
      - echo Build completed on `date` 
      - echo Pushing the Docker image... 
      - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
  post_build: 
    commands: 
      - echo $NAMESPACE
      - cat templates/deployment.yaml | sed -e 's/__NAMESPACE__/'"$NAMESPACE2"'/g' -e 's/__APP_NAME__/'"$APP_NAME2"'/g' -e 's/__LIMITS_CPU__/'"$LIMITS_CPU2"'/g' -e 's/__LIMITS_MEM__/'"$LIMITS_MEM2"'/g' -e 's/__REQ_CPU__/'"$REQ_CPU2"'/g' -e 's/__REQ_MEM__/'"$REQ_MEM2"'/g' > kubernetes/deployment.yaml
      - AWS_ECR_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
      - DATE=date
      - echo Build completed on $DATE
      - sed -i.bak 's#AWS_ECR_URI#'"$AWS_ECR_URI"'#' ./kubernetes/deployment.yaml
      - sed -i.bak 's#DATE_STRING#'"$DATE"'#' ./kubernetes/deployment.yaml
      - cat kubernetes/deployment.yaml
      - istioctl kube-inject -f ./kubernetes/deployment.yaml | kubectl apply -f - --record
      # - kubectl apply -f kubernetes/deployment.yaml

cache: 
  paths: 
    - '/root/.m2/**/*' 
  • CodeBuild Log
[Container] 2024/03/18 06:48:26.872234 Running on CodeBuild On-demand
[Container] 2024/03/18 06:48:26.872249 Waiting for agent ping
[Container] 2024/03/18 06:48:27.073610 Waiting for DOWNLOAD_SOURCE
[Container] 2024/03/18 06:48:32.590809 Phase is DOWNLOAD_SOURCE
[Container] 2024/03/18 06:48:32.592702 CODEBUILD_SRC_DIR=/codebuild/output/src4042633370/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/hw_poc
[Container] 2024/03/18 06:48:32.593172 YAML location is /codebuild/output/src4042633370/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/hw_poc/buildspec.yml
[Container] 2024/03/18 06:48:32.595163 Not setting HTTP client timeout for source type codecommit
[Container] 2024/03/18 06:48:32.595311 Processing environment variables
[Container] 2024/03/18 06:48:32.631883 Decrypting parameter store environment variables
[Container] 2024/03/18 06:48:32.890202 Selecting 'nodejs' runtime version '20' based on manual selections...
[Container] 2024/03/18 06:48:34.678429 Running command echo "Installing Node.js version 20 ..."
Installing Node.js version 20 ...

[Container] 2024/03/18 06:48:34.683796 Running command n $NODE_20_VERSION
     copying : node/20.9.0
   installed : v20.9.0 (with npm 10.1.0)

[Container] 2024/03/18 06:49:13.026772 Moving to directory /codebuild/output/src4042633370/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/hw_poc
[Container] 2024/03/18 06:49:13.028316 Expanded cache path /root/.m2/**/*
[Container] 2024/03/18 06:49:13.054248 Configuring ssm agent with target id: codebuild:95c2f26e-21f5-4344-bd9a-a6c9f9449841
[Container] 2024/03/18 06:49:13.109923 Successfully updated ssm agent configuration
[Container] 2024/03/18 06:49:13.110286 Registering with agent
[Container] 2024/03/18 06:49:13.110300 Phases found in YAML: 4
[Container] 2024/03/18 06:49:13.110307  INSTALL: 21 commands
[Container] 2024/03/18 06:49:13.110325  PRE_BUILD: 2 commands
[Container] 2024/03/18 06:49:13.110328  BUILD: 8 commands
[Container] 2024/03/18 06:49:13.110332  POST_BUILD: 9 commands
[Container] 2024/03/18 06:49:13.110591 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2024/03/18 06:49:13.110604 Phase context status code:  Message: 
[Container] 2024/03/18 06:49:13.188533 Entering phase INSTALL
[Container] 2024/03/18 06:49:13.189046 Running command set -x
+ CODEBUILD_LAST_EXIT=0
+ export -p
+ pwd
+ exit 0

[Container] 2024/03/18 06:49:13.194868 Running command echo $PLANT_DEPLOY_INFO
***

[Container] 2024/03/18 06:49:13.200610 Running command NAMESPACE2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f1)"

[Container] 2024/03/18 06:49:13.208264 Running command APP_NAME2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f2)"

[Container] 2024/03/18 06:49:13.213668 Running command LIMITS_CPU2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f3)"

[Container] 2024/03/18 06:49:13.219005 Running command LIMITS_MEM2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f4)"

[Container] 2024/03/18 06:49:13.224852 Running command REQ_CPU2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f5)"

[Container] 2024/03/18 06:49:13.230506 Running command REQ_MEM2="$(echo "$PLANT_DEPLOY_INFO" | cut -d '|' -f6)"

[Container] 2024/03/18 06:49:13.236111 Running command apt update

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Hit:1 <https://apt.corretto.aws> stable InRelease
Hit:2 <http://archive.ubuntu.com/ubuntu> jammy InRelease
Get:3 <http://security.ubuntu.com/ubuntu> jammy-security InRelease [110 kB]
Get:4 <http://archive.ubuntu.com/ubuntu> jammy-updates InRelease [119 kB]
Get:5 <http://archive.ubuntu.com/ubuntu> jammy-backports InRelease [109 kB]
Get:6 <http://security.ubuntu.com/ubuntu> jammy-security/restricted amd64 Packages [1961 kB]
Get:7 <http://archive.ubuntu.com/ubuntu> jammy-updates/restricted amd64 Packages [1998 kB]
Get:8 <http://security.ubuntu.com/ubuntu> jammy-security/universe amd64 Packages [1079 kB]
Get:9 <http://archive.ubuntu.com/ubuntu> jammy-updates/main amd64 Packages [1848 kB]
Get:10 <http://security.ubuntu.com/ubuntu> jammy-security/main amd64 Packages [1569 kB]
Get:11 <http://archive.ubuntu.com/ubuntu> jammy-updates/universe amd64 Packages [1353 kB]
Get:12 <http://security.ubuntu.com/ubuntu> jammy-security/main i386 Packages [522 kB]
Get:13 <http://security.ubuntu.com/ubuntu> jammy-security/universe i386 Packages [745 kB]
Get:14 <http://archive.ubuntu.com/ubuntu> jammy-updates/main i386 Packages [734 kB]
Get:15 <http://archive.ubuntu.com/ubuntu> jammy-updates/universe i386 Packages [868 kB]
Get:16 <http://archive.ubuntu.com/ubuntu> jammy-backports/universe i386 Packages [19.8 kB]
Get:17 <http://archive.ubuntu.com/ubuntu> jammy-backports/universe amd64 Packages [33.3 kB]
Get:18 <http://archive.ubuntu.com/ubuntu> jammy-backports/main amd64 Packages [80.9 kB]
Get:19 <http://archive.ubuntu.com/ubuntu> jammy-backports/main i386 Packages [71.1 kB]
Fetched 13.2 MB in 2s (7491 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
11 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: <https://apt.corretto.aws/dists/stable/InRelease:> Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

[Container] 2024/03/18 06:49:21.632057 Running command apt install bc -y

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  bc
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 87.6 kB of archives.
After this operation, 220 kB of additional disk space will be used.
Get:1 <http://archive.ubuntu.com/ubuntu> jammy/main amd64 bc amd64 1.07.1-3build1 [87.6 kB]
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Fetched 87.6 kB in 0s (1156 kB/s)
Selecting previously unselected package bc.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 34409 files and directories currently installed.)
Preparing to unpack .../bc_1.07.1-3build1_amd64.deb ...
Unpacking bc (1.07.1-3build1) ...
Setting up bc (1.07.1-3build1) ...

[Container] 2024/03/18 06:49:27.755400 Running command curl -o kubectl <https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl>
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  2 44.2M    2 1156k    0     0  1437k      0  0:00:31 --:--:--  0:00:31 1436k
 76 44.2M   76 33.9M    0     0  19.0M      0  0:00:02  0:00:01  0:00:01 19.0M
100 44.2M  100 44.2M    0     0  21.8M      0  0:00:02  0:00:02 --:--:-- 21.9M

[Container] 2024/03/18 06:49:29.810148 Running command chmod +x ./kubectl

[Container] 2024/03/18 06:49:29.815802 Running command mv ./kubectl /usr/local/bin/kubectl

[Container] 2024/03/18 06:49:29.848493 Running command mkdir ~/.kube

[Container] 2024/03/18 06:49:29.854779 Running command curl -L <https://istio.io/downloadIstio> | ISTIO_VERSION=1.21.0 TARGET_ARCH=x86_64 sh -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   101  100   101    0     0   1168      0 --:--:-- --:--:-- --:--:--  1174

100  4899  100  4899    0     0  36302      0 --:--:-- --:--:-- --:--:-- 36302

Downloading istio-1.21.0 from <https://github.com/istio/istio/releases/download/1.21.0/istio-1.21.0-linux-amd64.tar.gz> ...

Istio 1.21.0 Download Complete!

Istio has been successfully downloaded into the istio-1.21.0 folder on your system.

Next Steps:
See <https://istio.io/latest/docs/setup/install/> to add Istio to your Kubernetes cluster.

To configure the istioctl client tool for your workstation,
add the /codebuild/output/src4042633370/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/hw_poc/istio-1.21.0/bin directory to your environment path variable with:
     export PATH="$PATH:/codebuild/output/src4042633370/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/hw_poc/istio-1.21.0/bin"

Begin the Istio pre-installation check by running:
     istioctl x precheck 

Need more information? Visit <https://istio.io/latest/docs/setup/install/> 

[Container] 2024/03/18 06:49:30.993401 Running command chmod +x ./istio-1.21.0/bin/istioctl

[Container] 2024/03/18 06:49:31.011956 Running command mv ./istio-1.21.0/bin/istioctl /usr/local/bin/istioctl

[Container] 2024/03/18 06:49:31.067674 Running command aws eks update-kubeconfig --name sgh --region $AWS_DEFAULT_REGION
Added new context arn:aws:eks:us-east-1:794187215716:cluster/sgh to /root/.kube/config

[Container] 2024/03/18 06:49:43.283756 Running command cat ~/.kube/config
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJZFUrc1hadFdxN0F3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBek1UZ3dNRFUxTXpaYUZ3MHpOREF6TVRZd01UQXdNelphTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUURZbWRoZmFiR0VYdUQzWHlRekdkVnRZblc5OWh5VkIxUzcrSEoxUmZkWE5yUDJkNWduUVc5NlZOaCsKRG1kbGo1cXUyVW5ibDQ0dlo3MDNQY0V5Yk40UjV2eCtKSmV3dVRIZFlScWRhZ3gwcU1oVVIvU3BOdkc0WWhmcwpMMWFLajFXd3N4d3ZCL01ienJaeTJPelROUmZPWjhhby9wZktYY2tVNmdNTDVTcmR0a0R6YXZwbzdrZmhXQWlYCkNaYnRtbXVJRkU2R3BvdVVpaVpZMWNReVJQQlZRWDZxVWRwNmRzYmJlK0lnaEtIeXVYZFJaR2FQbjZJL3VPTEEKeU00OEdWeE02MWdLM1V6K0hGWEZlaXhSSmdGWTI3RWo4SnU1MVhQbGs3WkdBNUFIaXMraFJQek05NC9sQTZKWAppL3hCaXNEcS9rQlRPUTZMMUJaSkZxTFMzYXJCQWdNQkFBR2pXVEJYTUE0R0ExVWREd0VCL3dRRUF3SUNwREFQCkJnTlZIUk1CQWY4RUJUQURBUUgvTUIwR0ExVWREZ1FXQkJUSk1lRE5Pd2h1N3lOQWxPM2dkNkVmSlVUeHNqQVYKQmdOVkhSRUVEakFNZ2dwcmRXSmxjbTVsZEdWek1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQVhHRGt5UTdTaApZaDVCRy9zV0tzRlYzOVU0VzFRNWMrMkRSN0dERnI4OUVkTUVGazBlaWt6NFd0ZllpQVVZS0xOdjh4eXhZb2JkCkNYZnVkY2xMWFpSeU1WaG5Yb09IQkdMTXdmK3RHSkdJbGlHejhWNVZVT3g4Y3NiQUdFMkNydGVRMFozS2xJcjcKZXRWY2lKUlRaRVM5YUxNTDlDN21KamhQODRETnVqbFl5bW9JUkFLckZDZXhST09IS0s2Vm5rWk1LM1dIcDlNUAp0aTNtOHdjazBFWlRTOG1rbUNORTczUnhPOXRyL09MdnNYZEVKT2V4ZjBYOXdNZ1dUemZiUU1nTjR2UFdsMHBtClNmckl1UUR2Y3NyZFI5dGdzUG5QU3QyVTZZUytVUFNNdVB0RHhwT2N3YkVOSmczSzd6TXFlM2tNT29odVo1amUKd0lyZWxocVIyUlJLCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: <https://93BD2467247B645F71A04A0CE6A89891.gr7.us-east-1.eks.amazonaws.com>
  name: arn:aws:eks:us-east-1:794187215716:cluster/sgh
contexts:
- context:
    cluster: arn:aws:eks:us-east-1:794187215716:cluster/sgh
    user: arn:aws:eks:us-east-1:794187215716:cluster/sgh
  name: arn:aws:eks:us-east-1:794187215716:cluster/sgh
current-context: arn:aws:eks:us-east-1:794187215716:cluster/sgh
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-1:794187215716:cluster/sgh
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - --region
      - us-east-1
      - eks
      - get-token
      - --cluster-name
      - sgh
      - --output
      - json
      command: aws

[Container] 2024/03/18 06:49:43.289976 Running command echo Installing source NPM dependencies...
Installing source NPM dependencies...

[Container] 2024/03/18 06:49:43.294345 Running command npm install
npm WARN deprecated @babel/plugin-proposal-private-methods@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm WARN deprecated domexception@2.0.1: Use your platform's native DOMException instead
npm WARN deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility>
npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated workbox-cacheable-response@6.6.0: workbox-background-sync@6.6.0
npm WARN deprecated workbox-google-analytics@6.6.0: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.

added 1558 packages, and audited 1559 packages in 22s

258 packages are looking for funding
  run `npm fund` for details

9 vulnerabilities (3 moderate, 6 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

[Container] 2024/03/18 06:50:06.008749 Phase complete: INSTALL State: SUCCEEDED
[Container] 2024/03/18 06:50:06.008771 Phase context status code:  Message: 
[Container] 2024/03/18 06:50:06.041044 Entering phase PRE_BUILD
[Container] 2024/03/18 06:50:06.041632 Running command echo Logging in to Amazon ECR...
Logging in to Amazon ECR...

[Container] 2024/03/18 06:50:06.056018 Running command docker login --username AWS -p $(aws ecr get-login-password --region $AWS_DEFAULT_REGION) $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
<https://docs.docker.com/engine/reference/commandline/login/#credentials-store>

Login Succeeded

[Container] 2024/03/18 06:50:06.936658 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2024/03/18 06:50:06.936680 Phase context status code:  Message: 
[Container] 2024/03/18 06:50:06.966276 Entering phase BUILD
[Container] 2024/03/18 06:50:06.966712 Running command echo Build started on `date`
Build started on Mon Mar 18 06:50:06 UTC 2024

[Container] 2024/03/18 06:50:07.002359 Running command echo Building the Docker image...
Building the Docker image...

[Container] 2024/03/18 06:50:07.014027 Running command npm run build

> hw_poc@0.1.0 build
> react-scripts build

Creating an optimized production build...
One of your dependencies, babel-preset-react-app, is importing the
"@babel/plugin-proposal-private-property-in-object" package without
declaring it in its dependencies. This is currently working because
"@babel/plugin-proposal-private-property-in-object" is already in your
node_modules folder for unrelated reasons, but it may break at any time.

babel-preset-react-app is part of the create-react-app project, which
is not maintianed anymore. It is thus unlikely that this bug will
ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
your devDependencies to work around this error. This will make this message
go away.
  
Compiled successfully.

File sizes after gzip:

  46.62 kB  build/static/js/main.0452c7f5.js
  1.78 kB   build/static/js/453.2d48edfc.chunk.js
  515 B     build/static/css/main.f855e6bc.css

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve
  serve -s build

Find out more about deployment here:

  <https://cra.link/deployment>

[Container] 2024/03/18 06:50:16.404340 Running command docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG .
#0 building with "default" instance using docker driver

#1 [internal] load build definition from dockerfile
#1 transferring dockerfile: 115B done
#1 DONE 0.1s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/node:20-alpine
#3 DONE 0.3s

#4 [1/4] FROM docker.io/library/node:20-alpine@sha256:bf77dc26e48ea95fca9d1aceb5acfa69d2e546b765ec2abfb502975f1a2d4def
#4 resolve docker.io/library/node:20-alpine@sha256:bf77dc26e48ea95fca9d1aceb5acfa69d2e546b765ec2abfb502975f1a2d4def 0.0s done
#4 sha256:121edf6661770d20483818426b32042da33323b6fd30fc1ad4cd6890a817e240 1.16kB / 1.16kB done
#4 sha256:ae7f6c370720be0fd4120606ee84f6170037f6c163b91522eea08cbe574d78ff 7.14kB / 7.14kB done
#4 sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8 3.41MB / 3.41MB 0.1s
#4 sha256:9f16480e2ff54481cb1ea1553429bf399e8269985ab0dec5b5af6f55ea747d3f 0B / 42.19MB 0.1s
#4 sha256:092226d52cac3f544d7973fe7ba4416bc2cd5b69e4016804efb95026fe6b108b 0B / 2.34MB 0.1s
#4 sha256:bf77dc26e48ea95fca9d1aceb5acfa69d2e546b765ec2abfb502975f1a2d4def 1.43kB / 1.43kB done
#4 sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8 3.41MB / 3.41MB 0.1s done
#4 sha256:092226d52cac3f544d7973fe7ba4416bc2cd5b69e4016804efb95026fe6b108b 2.34MB / 2.34MB 0.2s done
#4 extracting sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8
#4 sha256:0493dfb2ff9c5bd770291dc14d4e30caff25c72bcdfbea04e9bf2f4013e21db0 0B / 448B 0.2s
#4 sha256:9f16480e2ff54481cb1ea1553429bf399e8269985ab0dec5b5af6f55ea747d3f 10.49MB / 42.19MB 0.3s
#4 sha256:0493dfb2ff9c5bd770291dc14d4e30caff25c72bcdfbea04e9bf2f4013e21db0 448B / 448B 0.2s done
#4 sha256:9f16480e2ff54481cb1ea1553429bf399e8269985ab0dec5b5af6f55ea747d3f 23.07MB / 42.19MB 0.4s
#4 sha256:9f16480e2ff54481cb1ea1553429bf399e8269985ab0dec5b5af6f55ea747d3f 33.55MB / 42.19MB 0.5s
#4 extracting sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8 0.4s done
#4 sha256:9f16480e2ff54481cb1ea1553429bf399e8269985ab0dec5b5af6f55ea747d3f 42.19MB / 42.19MB 0.7s done
#4 extracting sha256:9f16480e2ff54481cb1ea1553429bf399e8269985ab0dec5b5af6f55ea747d3f
#4 extracting sha256:9f16480e2ff54481cb1ea1553429bf399e8269985ab0dec5b5af6f55ea747d3f 4.2s done
#4 extracting sha256:092226d52cac3f544d7973fe7ba4416bc2cd5b69e4016804efb95026fe6b108b
#4 extracting sha256:092226d52cac3f544d7973fe7ba4416bc2cd5b69e4016804efb95026fe6b108b 0.3s done
#4 extracting sha256:0493dfb2ff9c5bd770291dc14d4e30caff25c72bcdfbea04e9bf2f4013e21db0 done
#4 DONE 6.4s

#5 [2/4] WORKDIR /app
#5 ...

#6 [internal] load build context
#6 transferring context: 254.59MB 8.3s done
#6 DONE 8.5s

#5 [2/4] WORKDIR /app
#5 DONE 3.4s

#7 [3/4] COPY . .
#7 DONE 4.8s

#8 [4/4] RUN npm install
#8 4.288 
#8 4.288 up to date, audited 1559 packages in 3s
#8 4.289 
#8 4.289 258 packages are looking for funding
#8 4.289   run `npm fund` for details
#8 4.295 
#8 4.295 9 vulnerabilities (3 moderate, 6 high)
#8 4.295 
#8 4.295 To address issues that do not require attention, run:
#8 4.295   npm audit fix
#8 4.295 
#8 4.295 To address all issues (including breaking changes), run:
#8 4.295   npm audit fix --force
#8 4.295 
#8 4.295 Run `npm audit` for details.
#8 4.296 npm notice 
#8 4.296 npm notice New minor version of npm available! 10.2.4 -> 10.5.0
#8 4.296 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.0>
#8 4.296 npm notice Run `npm install -g npm@10.5.0` to update!
#8 4.296 npm notice 
#8 DONE 4.4s

#9 exporting to image
#9 exporting layers
#9 exporting layers 3.0s done
#9 writing image sha256:88ef090a2cf05b545417b5914c05bfaef68818d03a3d5940a0c39c6c0a110474 done
#9 naming to docker.io/library/ecr_hw_poc:latest done
#9 DONE 3.0s

[Container] 2024/03/18 06:50:40.052586 Running command docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG

[Container] 2024/03/18 06:50:40.077118 Running command echo Build completed on `date`
Build completed on Mon Mar 18 06:50:40 UTC 2024

[Container] 2024/03/18 06:50:40.082863 Running command echo Pushing the Docker image...
Pushing the Docker image...

[Container] 2024/03/18 06:50:40.087926 Running command docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
The push refers to repository [794187215716.dkr.ecr.us-east-1.amazonaws.com/ecr_hw_poc]
1328fb23a169: Preparing
29a6defaaea8: Preparing
fb34b4b42a13: Preparing
468d581477ea: Preparing
b4770ab48df1: Preparing
f6810059c632: Preparing
d4fc045c9e3a: Preparing
f6810059c632: Waiting
d4fc045c9e3a: Waiting
468d581477ea: Layer already exists
b4770ab48df1: Layer already exists
f6810059c632: Layer already exists
d4fc045c9e3a: Layer already exists
fb34b4b42a13: Pushed
1328fb23a169: Pushed
29a6defaaea8: Pushed
latest: digest: sha256:a649a36eb48fbf55867971e2b9fdf9f1602b62eede9f88f197c89b79cc4e6c9d size: 1787

[Container] 2024/03/18 06:50:51.214669 Phase complete: BUILD State: SUCCEEDED
[Container] 2024/03/18 06:50:51.214689 Phase context status code:  Message: 
[Container] 2024/03/18 06:50:51.244153 Entering phase POST_BUILD
[Container] 2024/03/18 06:50:51.244631 Running command echo $NAMESPACE
chungju

[Container] 2024/03/18 06:50:51.249268 Running command cat templates/deployment.yaml | sed -e 's/__NAMESPACE__/'"$NAMESPACE2"'/g' -e 's/__APP_NAME__/'"$APP_NAME2"'/g' -e 's/__LIMITS_CPU__/'"$LIMITS_CPU2"'/g' -e 's/__LIMITS_MEM__/'"$LIMITS_MEM2"'/g' -e 's/__REQ_CPU__/'"$REQ_CPU2"'/g' -e 's/__REQ_MEM__/'"$REQ_MEM2"'/g' > kubernetes/deployment.yaml

[Container] 2024/03/18 06:50:51.255924 Running command AWS_ECR_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG

[Container] 2024/03/18 06:50:51.260038 Running command DATE=date

[Container] 2024/03/18 06:50:51.265564 Running command echo Build completed on $DATE
Build completed on date

[Container] 2024/03/18 06:50:51.270074 Running command sed -i.bak 's#AWS_ECR_URI#'"$AWS_ECR_URI"'#' ./kubernetes/deployment.yaml

[Container] 2024/03/18 06:50:51.280755 Running command sed -i.bak 's#DATE_STRING#'"$DATE"'#' ./kubernetes/deployment.yaml

[Container] 2024/03/18 06:50:51.285821 Running command cat kubernetes/deployment.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: chungju
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: parser
  namespace: chungju
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: gp2
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: parser
  namespace: chungju
  labels:
    app: parser
spec:
  replicas: 1
  selector:
    matchLabels:
      app: parser
  template:
    metadata:
      labels:
        app: parser
    spec:
      volumes:
        - name: aws-sc-ebs-pvc-parser
          persistentVolumeClaim:
            claimName: parser
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - parser
            topologyKey: "kubernetes.io/hostname"
      containers:
        - name: parser
          image: 794187215716.dkr.ecr.us-east-1.amazonaws.com/ecr_hw_poc:latest
          ports:
            - containerPort: 8080
          volumeMounts:
            - mountPath: /hom_data
              name: aws-sc-ebs-pvc-parser
          resources:
            limits:
              cpu: 0.25
              memory: 64Mi
            requests:
              cpu: 0.25
              memory: 64Mi
          env:
            - name: DATE
              value: 'date'
          envFrom:
          - secretRef:
              name: heis-secret
          #readinessProbe:
          #  httpGet:
          #    path: '/actuator/health'
          #    port: 8080
          #  initialDelaySeconds: 10
          #  timeoutSeconds: 2
          #  periodSeconds: 5
          #  failureThreshold: 10
          #livenessProbe:
          #  httpGet:
          #    path: '/actuator/health'
          #    port: 8080
          #  initialDelaySeconds: 120
          #  timeoutSeconds: 2
          #  periodSeconds: 5
          #  failureThreshold: 5
---
apiVersion: v1
kind: Service
metadata:
  name: parser
  namespace: chungju
  labels:
    app: parser
spec:
  ports:
    - port: 8080
      targetPort: 8080
  selector:
    app: parser

[Container] 2024/03/18 06:50:51.290445 Running command istioctl kube-inject -f ./kubernetes/deployment.yaml | kubectl apply -f - --record
namespace/chungju created
persistentvolumeclaim/parser created
deployment.apps/parser created
service/parser created

[Container] 2024/03/18 06:50:52.789741 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2024/03/18 06:50:52.789762 Phase context status code:  Message:

여기까지 ‘EKS에서 단일 애플리케이션을 n개의 POD으로 다중 배포하기(4)’에 대해 소개해드렸습니다. 유익한 정보가 되셨길 바랍니다. 감사합니다. 

Written by 송 규호 / innovate AI실

BESPIN GLOBAL