ingress를 이용하여 서비스를 외부로 노출 시키려 했으나 안됨
default namspace에 노출 시킬 marvel-service 생성되어있음
ingress 도 생성 되어있음

ingress-nginx namespace에 ingress 컨트롤러 설치되어있음

열심히 curl 날리지만 돌아오는건 404......
명령어: $ curl -v dame.yoo.com:30545/
* About to connect() to dame.yoo.com port 30545 (#0)
* Trying 192.168.10.51...
* Connected to dame.yoo.com (192.168.10.51) port 30545 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: dame.yoo.com:30545
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Tue, 26 Oct 2021 14:09:46 GMT
< Content-Type: text/html
< Content-Length: 146
< Connection: keep-alive
<
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host dame.yoo.com left intact
몇일을 삽질했지만 역시 모든것은 log에 있었다.......
명령어: $ kubectl logs ingress-nginx-controller-54676dffd6-ncqsq
NGINX Ingress controller
Release: v1.0.4
Build: 9b78b6c197b48116243922170875af4aa752ee59
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.19.9
-------------------------------------------------------------------------------
W1026 13:31:07.430488 6 client_config.go:615] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I1026 13:31:07.430617 6 main.go:221] "Creating API client" host="https://10.96.0.1:443"
I1026 13:31:07.471612 6 main.go:265] "Running in Kubernetes cluster" major="1" minor="20" git="v1.20.11" state="clean" commit="27522a29febbcc4badac257763044d0d90c11abd" platform="linux/amd64"
I1026 13:31:07.651978 6 main.go:104] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"
I1026 13:31:07.679371 6 ssl.go:531] "loading tls certificate" path="/usr/local/certificates/cert" key="/usr/local/certificates/key"
I1026 13:31:07.711701 6 nginx.go:253] "Starting NGINX Ingress controller"
I1026 13:31:07.728065 6 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"ingress-nginx-controller", UID:"b76c6a1b-d704-40ab-ab57-e27628b1e536", APIVersion:"v1", ResourceVersion:"121944", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller
I1026 13:31:08.819395 6 store.go:367] "Ignoring ingress because of error while validating ingress class" ingress="default/marvel-ingress" error="ingress does not contain a valid IngressClass"
I1026 13:31:08.914508 6 nginx.go:295] "Starting NGINX process"
I1026 13:31:08.914763 6 leaderelection.go:243] attempting to acquire leader lease ingress-nginx/ingress-controller-leader...
I1026 13:31:08.918376 6 nginx.go:315] "Starting validation webhook" address=":8443" certPath="/usr/local/certificates/cert" keyPath="/usr/local/certificates/key"
I1026 13:31:08.918558 6 controller.go:152] "Configuration changes detected, backend reload required"
I1026 13:31:08.923640 6 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader
I1026 13:31:08.924168 6 status.go:84] "New leader elected" identity="ingress-nginx-controller-54676dffd6-ncqsq"
I1026 13:31:08.933444 6 status.go:215] "POD is not ready" pod="ingress-nginx/ingress-nginx-controller-54676dffd6-ncqsq" node="worker1"
I1026 13:31:08.975521 6 controller.go:169] "Backend successfully reloaded"
I1026 13:31:08.975596 6 controller.go:180] "Initial sync, sleeping for 1 second"
I1026 13:31:08.976102 6 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54676dffd6-ncqsq", UID:"488bdc52-33e0-45cd-aa28-a20804a34c89", APIVersion:"v1", ResourceVersion:"122079", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I1026 13:33:15.324075 6 store.go:342] "Ignoring ingress because of error while validating ingress class" ingress="default/marvel-ingress" error="ingress does not contain a valid IngressClass"
W1026 13:33:34.424066 6 controller.go:952] Error obtaining Endpoints for Service "ingress-nginx/marvel-service": no object matching key "ingress-nginx/marvel-service" in local store
W1026 13:33:34.424100 6 controller.go:952] Error obtaining Endpoints for Service "ingress-nginx/pay-service": no object matching key "ingress-nginx/pay-service" in local store
I1026 13:33:34.443719 6 main.go:101] "successfully validated configuration, accepting" ingress="marvel-ingress/ingress-nginx"
I1026 13:33:34.450569 6 store.go:367] "Ignoring ingress because of error while validating ingress class" ingress="ingress-nginx/marvel-ingress" error="ingress does not contain a valid IngressClass"
[ 마지막 줄 확인]
"Ignoring ingress because of error while validating ingress class" ingress="ingress-nginx/marvel-ingress" error="ingress does not contain a valid IngressClass"
문제는 IngressClass가 유효하지 않다고 로그에 다찍혀있다....
ingress class name은 아래 명령어를 입력하면 나온다.
ingress-nginx controller의 이름이 nginx 였다.
명령어: $ kubectl describe ingressclasses
Name: nginx
Labels: app.kubernetes.io/component=controller
app.kubernetes.io/instance=ingress-nginx
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/version=1.0.4
helm.sh/chart=ingress-nginx-4.0.6
Annotations: <none>
Controller: k8s.io/ingress-nginx
Events: <none>
ingress 설정 yaml 파일에 annotation 한줄 추가.

접속 성공!!
문제가 있으면 로그 부터 보는 습관을 길러라

Ingress 쪽 실습해보다가 에러를 만나 이 글을 보게되었는데 제가 마주한 에러랑 똑같아서 쉽게 해결 할 수 있었습니다. 감사합니다!