Deployment에 대한 Ingress 생성

(기존 Deployment에 대한 새로운 Ingress 생성에서 넘어옴)

1 개요[ | ]

Deployment에 대한 Ingress 생성
기존 Deployment에 대한 새로운 Ingress 생성

2 시나리오[ | ]

Deployment에 대한 Service 생성
  • 네임스페이스 world에 Deployment 2개가 있다.
  • 각각에 대해 80 포트로 ClusterIP Service를 생성. 이름은 Deployment와 동일하게.
Service에 대한 Ingress 생성

3 실습[ | ]

기존 Deployment에 대한 Service 생성
$ k -n world expose deploy europe --port 80
service/europe exposed
$ k -n world expose deploy asia --port 80
service/asia exposed
Service에 대한 Ingress 생성
$ k get ingressClass
NAME    CONTROLLER             PARAMETERS   AGE
nginx   k8s.io/ingress-nginx   <none>       12m
$ vi ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: world
  namespace: world
spec:
  ingressClassName: nginx
  rules:
  - host: "world.universe.mine"
    http:
      paths:
      - path: /europe
        pathType: Prefix
        backend:
          service:
            name: europe
            port:
              number: 80
      - path: /asia
        pathType: Prefix
        backend:
          service:
            name: asia
            port:
              number: 80
$ k apply -f ingress.yaml 
ingress.networking.k8s.io/world created
$ curl http://world.universe.mine:30080/europe/
hello, you reached EUROPE
$ curl http://world.universe.mine:30080/asia/
hello, you reached ASIA
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}