WEBBOOK CHAPTER

Git에서 EKS까지: 18장 Deployment·Service로 첫 내부 배포를 완주한다

18장 Deployment·Service로 첫 내부 배포를 완주한다

먼저 manifest의 placeholder를 실제 ECR image로 바꾼 복사본을 만든다. 원본을 sed -i로 훼손하지 않고 envsubst, Kustomize 또는 pipeline의 kubectl set image를 사용한다.


kubectl apply -f examples/k8s/10-app.yaml
kubectl -n flownote set image deployment/flownote 
  app="$ACCOUNT_ID.dkr.ecr.ap-northeast-2.amazonaws.com/flownote:$SHA"
kubectl -n flownote rollout status deployment/flownote --timeout=5m
kubectl -n flownote get pod,service,endpointslice -o wide

외부 ALB를 만들기 전에 port-forward로 내부 계약을 검사한다.


kubectl -n flownote port-forward service/flownote 18080:80
curl --fail http://127.0.0.1:18080/health/ready
curl -s http://127.0.0.1:18080/api/runtime | jq

Service의 port: 80은 client가 보는 port이고 targetPort: http는 container port의 name을 가리킨다. name을 사용하면 container port 숫자가 바뀌어도 Service reference가 더 명확하다. EndpointSlice에 address가 없다면 Pod phase보다 readiness와 selector를 먼저 본다.