pod
를 배포하기 위해서는 pod
가 실행될 때 사용하는 하나 이상의 fargate profile
을 정의해야 함fargate profile
: fargate로 pod를 생성하기 위한 조건을 명시해놓은 프로파일cd /home/ec2-user/environment/manifests
cat <<EOF> eks-demo-fargate-profile.yaml
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-demo
region: ${AWS_REGION}
fargateProfiles:
- name: frontend-fargate-profile
selectors:
- namespace: default
labels:
app: frontend-fargate
EOF
eksctl create fargateprofile -f eks-demo-fargate-profile.yaml
eksctl get fargateprofile --cluster eks-demo -o json
pod
중, frontend pod를 fargate로 프로비저닝하는 작업을 수행kubectl delete -f frontend-deployment.yaml
frontend-deployment.yaml
파일 수정frontend-fargate
로 변경cd /home/ec2-user/environment/manifests
cat <<EOF> frontend-deployment.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-frontend
namespace: default
spec:
replicas: 3
selector:
matchLabels:
app: frontend-fargate
template:
metadata:
labels:
app: frontend-fargate
spec:
containers:
- name: demo-frontend
image: $ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/demo-frontend:latest
imagePullPolicy: Always
ports:
- containerPort: 80
EOF
frontend-service.yaml
파일도 수정cat <<EOF> frontend-service.yaml
---
apiVersion: v1
kind: Service
metadata:
name: demo-frontend
annotations:
alb.ingress.kubernetes.io/healthcheck-path: "/"
spec:
selector:
app: frontend-fargate
type: NodePort
ports:
- protocol: TCP
port: 80
targetPort: 80
EOF
kubectl apply -f frontend-deployment.yaml
kubectl apply -f frontend-service.yaml
fargate-ip-xx
노드에 프로비저닝되었음을 확인할 수 있음Fargate worker nodes
리스트를 확인할 수 있음