
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
안녕하세요.
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라는 에러가 뜹니다.
