커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
3-4강 / nodeport 설정 후 퍼블릭 ip로 pod에 접속이 안됩니다.
실무에 바로 쓰는 쿠버네티스 클라우드
챕터 3
북마크
서*민
댓글
31
추천
0
조회수
46
조회수
46
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.



안녕하세요.


nodePort를 사용하였을때 node의 public ip로 접속이 되지 않아서 문의 드립니다.


일단 지금까지 진행 상황은 아래와 같습니다.


1. Dockerfile을 아래와 같이 작성하였고

FROM nginx:1.27.0


WORKDIR /usr/share/nginx/html
COPY ./index.html ./index.html

2.아래의 명령어로 이미지를 build하고 push하였습니다.(mac m1칩을 사용하고 있어 platform을 맞추기 위해 사용한 명령어 입니다.)

docker buildx build --platform linux/amd64 --output type=image,push=true -t 842676009366.dkr.ecr.ap-northeast-2.amazonaws.com/hello-kube:1.0.0 .

3.그리고 sample-replicaset.yaml파일을 apply했고

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: sample-replicaset
  namespace: default
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: 842676009366.dkr.ecr.ap-northeast-2.amazonaws.com/hello-kube:1.0.0

4.sample-service.yaml도 apply 했습니다.

apiVersion: v1
kind: Service
metadata:
  name: sample-service
  namespace: default
spec:
  type: NodePort
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      nodePort: 30001


5.강의를 따라 인바운드 규칙을 추가하였습니다.

스파르타 즉문즉답


⚠️문제 상황:


그런데 nodePort를 설정하지 않고 그냥 로컬에서 port-forward를 했을 때는 localhost:8080으로 접속이 잘 되었는데,

nodePort를 설정하고 public ip인 http://13.125.167.254:30001 로 접속하면

스파르타 즉문즉답


사진과 같이 connection_refused라는 에러가 뜹니다.


취소
 공유
취소
댓글 0
댓글 알림
나의얼굴