Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
iconfalse
title목차

 

Table of Contents

Ingress 개요

Info
iconfalse
Info
iconfalse
titlehttps://medium.com/devops-mojo/kubernetes-ingress-overview-what-is-kubernetes-ingress-introduction-to-k8s-ingress-b0f81525ffe2

Info
  • 하나의 IP나 도메인으로 다수의 서비스 제공 (단일 Endpoint)
  • L7을 기본으로한 부하 분산이므로 많은 기능을 제공
  • Domain base Routing
  • Uri base Routing
  • 부하분산
  • SSL 종료
  • Ingress Controller필수
  • Service의 LoadBalancer Type과 같이 Load Balancer가 요구 됩니다.
  • 다양한 Ingress Controller가 있으며, 무료의 경우 기능사용에 제약이 많으므로 유료를 권장합니다.
  • Cloud환경에서는 ApplicationGateway또는 ApplicationLoadBalancer와 연동해서 사용가능합니다. (예: AZURE-AGIC, AWS ALB-INGRESS)

Ingress Controller

Info



Ingress Manifest

Info
iconfalse

https://dev-k8sref-io.web.app/docs/services/ingress-v1/

Info
iconfalse


Code Block
titleingress.yaml
linenumberstrue
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: nginx-svc
            port:
              number: 80


Ingress 실습

Info
iconfalse

Ingress 와 연결할 어플리케이션 배포

Code Block
titlenginx-deploy.yaml, nginx-svc.yaml
linenumberstrue
collapsetrue
sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f nginx-deploy.yaml 
deployment.apps/nginx-deploy created

sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f nginx-svc.yaml   
service/nginx-svc created

sansae@sansaeAir15m2 k8s-lab-workspace % k get svc
NAME           TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)        AGE
kubernetes     ClusterIP      10.0.0.1       <none>          443/TCP        2m57s
nginx-svc      ClusterIP      10.0.245.161   <none>          80/TCP         3s

Ingress Controller 배포

Code Block
titlehttps://kubernetes.github.io/ingress-nginx/deploy/#azure
linenumberstrue
sansae@sansaeAir15m2 k8s-lab-workspace % kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.0/deploy/static/provider/cloud/deploy.yaml

namespace/ingress-nginx created
serviceaccount/ingress-nginx created
serviceaccount/ingress-nginx-admission created
role.rbac.authorization.k8s.io/ingress-nginx created
role.rbac.authorization.k8s.io/ingress-nginx-admission created
clusterrole.rbac.authorization.k8s.io/ingress-nginx created
clusterrole.rbac.authorization.k8s.io/ingress-nginx-admission created
rolebinding.rbac.authorization.k8s.io/ingress-nginx created
rolebinding.rbac.authorization.k8s.io/ingress-nginx-admission created
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx created
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx-admission created
configmap/ingress-nginx-controller created
service/ingress-nginx-controller created
service/ingress-nginx-controller-admission created
deployment.apps/ingress-nginx-controller created
job.batch/ingress-nginx-admission-create created
job.batch/ingress-nginx-admission-patch created
ingressclass.networking.k8s.io/nginx created
validatingwebhookconfiguration.admissionregistration.k8s.io/ingress-nginx-admission created

sansae@sansaeAir15m2 k8s-lab-workspace % k get all -n ingress-nginx 
NAME                                            READY   STATUS      RESTARTS   AGE
pod/ingress-nginx-admission-create-pknd2        0/1     Completed   0          110s
pod/ingress-nginx-admission-patch-6x9cm         0/1     Completed   2          110s
pod/ingress-nginx-controller-654497b5fc-mmgfl   1/1     Running     0          110s

NAME                                         TYPE           CLUSTER-IP    EXTERNAL-IP    PORT(S)                      AGE
service/ingress-nginx-controller             LoadBalancer   10.0.40.254   4.230.148.14   80:32251/TCP,443:31606/TCP   111s
service/ingress-nginx-controller-admission   ClusterIP      10.0.167.0    <none>         443/TCP                      111s

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/ingress-nginx-controller   1/1     1            1           110s

NAME                                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/ingress-nginx-controller-654497b5fc   1         1         1       110s

NAME                                       COMPLETIONS   DURATION   AGE
job.batch/ingress-nginx-admission-create   1/1           6s         111s
job.batch/ingress-nginx-admission-patch    1/1           19s        111s
Code Block
sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f ingress.yaml
ingress/minimal-ingress created