Joo's
article thumbnail
반응형

먼저 deployment를 이용해서 web pod를 만든다.

 

cluster IP로 Service를 만든다.

apiVersion: v1
kind: Service
metadata:
  name: [서비스 이름]          # ✅ 서비스 이름 변경
  namespace: [네임스페이스]
spec:
  type: ClusterIP
  internalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  selector:
    app: [deployment or pod 이름]          # ✅ 대상 Deployment(Pod) 라벨 맞추기
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: 80
    - name: https
      port: 443
      protocol: TCP
      targetPort: 443

 

ingress 만들기

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: [ingress 이름]
  namespace: [네임스페이스]
  annotations:
    alb.ingress.kubernetes.io/backend-protocol: HTTPS
    alb.ingress.kubernetes.io/certificate-arn: [aws certificate arn] # 기존 ACM 인증서 그대로 사용
    alb.ingress.kubernetes.io/healthcheck-protocol: HTTPS
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]'
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/ssl-redirect: "443"
    alb.ingress.kubernetes.io/target-type: ip
spec:
  ingressClassName: alb
  rules:
  - host: [443포트로 접속할 host 이름]
    http:
      paths:
      - path: /*
        pathType: ImplementationSpecific
        backend:
          service:
            name: [서비스 이름]
            port:
              number: 443

  tls:
  - hosts:
    - [443포트로 접속할 host 이름]
    secretName: [시크릿 이름]  # TLS Secret 이름 (서비스용 Secret 생성 필요)

---

route53에서 호스트 영역 만들고

record 추가하기

원하는 레코드 이름 입력하고 별칭 선택

ingress를 만들면 Application 로드밸런서가 생성된다.

생성된 지역을 선택하고 로드밸런서를 선택한 후 record를 생성한다.

반응형
profile

Joo's

@JooJY

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!