kopsã使ã£ã¦AWSä¸ã«kubernetesãæ§ç¯ããã¨ãã«Ingress Controllerã¯ã©ãã«ããããæ©ãã§ãã
GKEã§çãã¦ãã¾ãã
ä»ã¾ã§ã¯GKE使ã£ã¦ã¦Ingress ControllerãGLBCã使ã£ã¦ãªããåæã«ãã£ã¦ããã¦ããªã¿ãããªæãã§ã k8sã使ãå´ãããªã«æ°ã«ãã¦ãªãã£ããã§ããã EKSãããã¨ãããã¨ã§AWSã§ããã«ã¯ã©ãããã°ããã ããã¨ãããã¨ãèãå§ããã¨ããã®ãçµç·¯ã§ãã
ã¨ããããIngressã¨ã¯ï¼
An Ingress is a collection of rules that allow inbound connections to reach the cluster services.
ã¨ããéããå¤é¨ããã®ãªã¯ã¨ã¹ããåãµã¼ãã¹ã«æ¯ãåããã«ã¼ã«ãæ¸ããã¨ãã§ãã¾ãã ãªã®ã§ãå¤é¨ã®ã¯ã©ã¦ããããã¤ãä¸ã§ç«ã¦ãå ´åãIngressã使ã£ãæ¹ãç¡é§ãªLBããã¦ãã«ããã®ã§è²ã ç¯ç´ã«ãªãã¾ãã
internet | [ Ingress ] --|-----|-- [ Services ]
Ingressã«ã¯Ingress Controllerãå¿ è¦ã§ã
Ingress Controllerã¯Ingressã¨ããobjectãç»é²ãããã¨ãã«å®éã«ã¤ãªããããã«ããå¦çããã¦ãããcontrollerã§ãã Kubernetesã¯ããããcontrollerããã£ã±ããã¦ãä»ã®objectãåãããã«objectç»é²ããã¨ãcontrollerãeventãpollingãã¦è¦å¼µã£ã¦ãã¦å¤åãããã°ä½ããããã¨ããã¢ã¼ããã¯ãã£ã«ãªã£ã¦ãã¾ããç´ æ´ãããã§ãããæ©ã人éãç½®ãæãã¦ãã
Ingress Controllerã©ãã«ããï¼ï¼
ã¨ãããã¨ã§æ¬é¡ã§ãããkopsã§Kubernetesãæ§ç¯ããã¨ãã«ã¯ã¾ã Ingress Controllerã¯ãã¾ãããè¦ã¯ãªãã ã£ã¦ãããã§ãããã¨ã¯ããæåã©ããã使ããããã¨ãããã¨ã§ã¡ãã£ã¨æ©ãã§ãã¾ãã
ã¾ãAWSã§Ingress Controllerãããªãããã¦ããã®3ã¤ã®ã©ããããªã¨ãããã¨ããã¾ã§ã¯ã°ã°ã£ã¦ãªãã¨ãªãæ´ã¿ã¾ããã
- coreos/alb-ingress-controller
- zalando-incubator/kube-ingress-aws-controller
- kubernetes/ingress-nginx
AWS使ã£ã¦ã身ã¨ãã¦ã¯ALBãACMãªã©AWSã«çµ±åããã¦ãã¦ã»ãã
AWSã«ã¯ãã¤ãEKSãããã ãããããç¨åº¦çµ±åããã¦ãããããªä»çµã¿ã§Ingressãããããã ããã«HTTPã§æ¯ãåãã«ã¼ã«ã¨ããã°å½ç¶ALBãæãæµ®ãã¶ããã§ãã
ã¨ãããã¨ã§ãalb-ingress-controller
ãkube-ingress-aws-controller
ã¨ããAWSã®ALBã使ã£ãIngress Controllerã§æ¤è¨ãããã¨ã«ãã¾ããã
alb-ingress-controller
ãã¨ã¦ãåèã«ããã¦ãããã¾ããããããã¨ããããã¾ãããããã¨ããããã¾ãã
ä½ãæ¹ãªã©ã¯ãã¡ãã®è¨äºããwalkthroughãå ¬å¼ã§ç¨æããã¦ã¦ããã¥ã¡ã³ãã親åã§ç¹ã«ã¯ã¾ããã¨ãªã使ããã¨ãã§ãã¾ããã
Ingressã«annotationsãæå®ãããã¨ã§ãALBãèµ·åããsubnetã®æå®ããACMã®æå®ãsecurity groupã®æå®ãALBã®listener ruleã使ã£ãæ¯ãåããªã©ãããããã¨ã¯ã»ã¨ãã©ã§ãã¦ãããã顧客ãæ±ãã¦ãããã®ã ã¨ãªã£ããã§ãããã¡ãã£ã¨è¦ä»¶ãæºãããªããã®ãã»ã»
Ingressã®Health check pathãALBãã¨ã«ããæå®ã§ããªã
alb-ingress-controllerã ã¨IngressãServiceã®NodePortã«å¯¾ãã¦Health checkããããã§ããããã®ã¨ãã®ãã¹ãALBãã¨ã«ããè¨å®ã§ããªãã®ã§ãã GKEã®GLBCã ã¨readiness probeã§ã§ããã®ã§ããããããã ã¨æã£ã¦ã¾ããã»ã»
Health checks
Currently, all service backends must satisfy either of the following requirements to pass the HTTP(S) health checks sent to it from the GCE loadbalancer:
- Respond with a 200 on '/'. The content does not matter.
- Expose an arbitrary URL as a readiness probe on the pods backing the Service.
PRãåºã¦ããã©éå§ãæããããªãã»ã»
ãã¡ãã®PRã§Serviceã«annotationãæ¸ããã¨ã§health check pathãæå®ã§ããææ¡ãããã¦ã¾ãããã¡ãã£ã¨é²æãè³ãããªãããã»ã»
OSSã«åå ãããã¨ããæ°æã¡ãããã®ã§è²¢ç®ãã¦ãããã¨ãæãã¾ããããããããIngressã®healthcheckãåå¥ã«åãæ¿ãããã¨ããèããéªæªãªã®ããªã¨ããæ°ã«ããªã£ã¦ãã¾ããã
/
ãå
¨ã¦ä½ãå¦çãã200ãè¿ãããã«ã¢ããªã±ã¼ã·ã§ã³ã調æ´ããã®ã¯é£ããããªã®ã§ãæ®éã«åã¢ããªã±ã¼ã·ã§ã³å´ã«/healthz
ã¿ãããªã¨ã³ããã¤ã³ããä½ã£ã¦ããã£ã¦200ãè¿ãããã«ãã¦ãããã£ã¦ããã®ã解決çãªãã§ãããã¤ã³ãã©æ§ç¯å´ããããã¨ã¢ããªã±ã¼ã·ã§ã³ãéçºããã¨ã³ã¸ãã¢ã«ãããªãã¨å¼·è¦ããããªããªã¨ããæããããã¾ãã
kube-ingress-aws-controller
ã¨ãããã¨ã§ããä¸ã¤ã®åè£ã§ãããkube-ingress-aws-controller
ã§ãã
ããããã¡ãã®ãµã¤ããåèã«ããã¦ãããã¾ããããããã¨ããããã¾ãããããã¨ããããã¾ãã
kube-ingress-aws-controller
ãACMãsubnetæå®ãsecurity groupæå®ãªã©ALBã¨ãã¦ã®æ©è½ã¯åé¡ãªãããã§ãã
å½åkube-ingress-aws-controller
ã¯ALBã®listener ruleã使ããã«ãå¥éIngress controllerãããã«å¿
è¦ã¨ãããã¨ãç¥ãããããããã¨æã£ããã§ããåçã«controllerã§è§£æ±ºããã«ã¯AWSã«ã¨ãããéãã¦ã¯ãããªãã®ãããããªãã¨ããæ°æã¡ã«ãªã£ã¦ãã¾ããã
ããã«kopsã®addonã¨ãã¦ãç´¹ä»ããã¦ããããããæ£æ»æ³ãªã®ãã¨ããæ°ã«ãã»ã»
ããã«ããã«ãå¥éå¿ è¦ãªIngress Controllerã§ããSkipperèªä½ãé«æ©è½ã§ããããã¨ããå°è±¡ã§ãã
kube-ingress-aws-controller + Skipper ã®çµã¿åããã§ããã°ãalb-ingress-controllerã§åé¡ã ã£ãIngressããã®health checkã¯åã«skipperã«å¯¾ãã¦è¡ãã ãã§OKã§ãã ãã¨ã¯ãSkipperãåServiceã«ï¼NodePortãããªãã¦ClusterIPã§OKï¼ãããã·ãã¦ããã¾ãã
ã¾ã¨ã
ããã¾ã§è²ã èãã¦ãã¾ããããããããIngress Controllerãã©ããããã£ã¦ãããã¨ãèãã¦ãã¨ãããããã¦æè¿åå¼·ä¼ã¨ãã§ããé£å¼ããã¦ããIstioã¨ãLinkerdã¨ãã«ããã¤ãã®ã§ã¯ãªããã¨ããæ°ã«ãªã£ã¦ãã¾ããããã ãã¾ã ãããããªããªã®ãã¡ããã¨åãã£ã¦ãªãã®ã§ã追ãã¤ãã«ã¯ããå°ãæéãå¿ è¦ã§ãã