반응형
이슈
CNPG Cluster 파드에 kube-system, cnpg-system 네임스페이스로 부터 들어오는 트래픽이 8000번 포트로 접근할 수 있도록 허용하는 Network Policy를 적용하였는데, 다음과 같은 에러가 발생하였다.
kubectl cnpg status cluster-example-1

failed to get status by proxying to the pod, you might lack permissions to get pods/proxy: the server is currently unable to handle the request (get pods https:cluster-example-1-1:8000)
해결
결론부터 말하면, ingress로 네임스페이스 뿐가 아니라 calico vxlan ip를 ip block으로 허용해주었더니 이슈가 사라졌다.
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: cnpg-system
- ipBlock:
cidr: 10.150.22.42/32 # calico vxlan ip
ports:
- port: 5432
protocol: TCP
- port: 8000
protocol: TCP
- port: 9187
protocol: TCP
- port: 9443
protocol: TC
원인
생각해보니 간단했다.
트래픽의 출발이 pod가 아니다. kubectl cnpg status [ cnpg 클러스터명 ] 명령어로 cnpg 클러스터 파드의 8000번 포트로 접근하는 것이다.

kubectl 명령어를 보내면 kube-apiserver가 프록시 서버 역할을 해주어 파드 쪽으로 트래픽을 라우팅을 해준다. 이때 타고 나가는 네트워크 인터페이스가 calico-vxlan이다. Cnpg Cluster Pod 입장에서는 특정 네임스페이스에서 들어오는 트래픽이 아니라 특정 IP에서 들어오는 트래픽이므로, 해당 트래픽은 NetworkPolicy에서 IpBlock 설정으로 허용해주어야 한다.
반응형
'Ops > Kubernetes' 카테고리의 다른 글
| Ingress에서 Gateway API로 전환해야 하는 이유 (0) | 2025.10.23 |
|---|---|
| [이슈] 파드가 반복해서 Evicted되는 현상 (0) | 2025.09.16 |
| K8S NFS 동적 프로비저닝 구현하기 (0) | 2025.09.16 |
| kubectl로 여러 Kubernetes 클러스터 제어하기 (3) | 2025.08.25 |
| [이슈] Traefik에서 대량으로 포트 오픈 시 발생한 이슈 (1) | 2025.08.07 |