apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-resource-backend
spec:
defaultBackend:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
rules:
- http:
paths:
- path: /icons
pathType: ImplementationSpecific
backend:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: icon-assets
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
위와 같은 deploy.yaml 파일을 실행하면 nginx controller가 실행된다.
yaml 파일을 살펴보면..
ingress-nginx image를 가져와서 pod가 하나 생긴다.
replica set이 없으니 pod는 하나만 생긴다.
pod는 하나의 서비스로 묶어주고, 외부에서 접근할 수 있도록 처리가 필요하다. nginx yaml 파일에 따라 다르게 설정이 되있는 것을 확인했다.
이런 식으로 Service type을 NodePort로 열어서 외부에서 파드에 접근할 수 있게 할 수도 있고,
로드밸런서를 써서, 클라우드에서 제공하는 로드밸런서의 IP를 이용해서 외부에서 파드에 접근할 수 있게 할 수도 있다.
yaml 파일에 정의된 pod, service 등은 ingress-nginx에 만들어져서
위와 같이 생긴 것을 확인할 수 있다.